slang icon indicating copy to clipboard operation
slang copied to clipboard

Support glslang [[spv::format_formatName]] syntax

Open ArielG-NV opened this issue 11 months ago • 1 comments

nv-ray-tracing-motion-blur.slang & raygen.slang both used for the output image:

layout(rgba8)
RWTexture2D<float4> outputImage;

glslang cross compiles this (HLSL->SPIR-V) incorrectly into:

%251 = OpTypeImage %float 2D 0 0 0 2 Rgba32f

Slang does not follow this behavior due to parsing a format modifier from layout(format). Slang outputs %251 = OpTypeImage %float 2D 0 0 0 2 Rgba8f

glslang covers the incorrect compiling case with the solution of [[spv::format_rgba8]] as general syntax for specifying layout if spirv is the target. Slang should support this syntax to properly compile with a larger subset of GLSL syntax.

ArielG-NV avatar Mar 18 '24 18:03 ArielG-NV