I updated glslang and noticed that in vulkan-relaxed mode it started outputting extra combined image sampler variables without set/binding decorations. Here's a simple example that demonstrates the issue:
Compiling this with glslangValidator -V -R shader.frag and then validating with spirv-val --target-env vulkan1.1 frag.spv outputs the following:
error: line 26: UniformConstant id '13' is missing DescriptorSet decoration.
From Vulkan spec, section 14.5.2:
These variables must have DescriptorSet and Binding decorations specified
%texsamp = OpVariable %_ptr_UniformConstant_11 UniformConstant
I bisected and landed on c59b876ca0f5b672d7cfeb4d591b346e97b1966c as the commit that introduced the issue.
Before the change (or when removing -R), the working shader looked like this:
I don't really understand c59b876ca0f5b672d7cfeb4d591b346e97b1966c yet, but it looks like it might be overeager about converting samplers? There aren't any samplers in structs or function parameters here, so I wouldn't expect any change to the spirv, compared to non-relaxed mode.
I updated glslang and noticed that in vulkan-relaxed mode it started outputting extra combined image sampler variables without set/binding decorations. Here's a simple example that demonstrates the issue:
Compiling this with
glslangValidator -V -R shader.frag
and then validating withspirv-val --target-env vulkan1.1 frag.spv
outputs the following:I bisected and landed on c59b876ca0f5b672d7cfeb4d591b346e97b1966c as the commit that introduced the issue.
Before the change (or when removing
-R
), the working shader looked like this:After the change, the combined image sampler was hoisted to top-level scope:
I don't really understand c59b876ca0f5b672d7cfeb4d591b346e97b1966c yet, but it looks like it might be overeager about converting samplers? There aren't any samplers in structs or function parameters here, so I wouldn't expect any change to the spirv, compared to non-relaxed mode.