DirectXShaderCompiler icon indicating copy to clipboard operation
DirectXShaderCompiler copied to clipboard

[SPIR-V] `[[vk::combinedImageSampler]]` refuses to work with `SamplerComparisonState`

Open h3r2tic opened this issue 3 years ago • 0 comments

Hey, I tried doing this:

[[vk::combinedImageSampler]]
Texture2D foo: register(t0);
[[vk::combinedImageSampler]]
SamplerComparisonState foo_sampler: register(s0);

And got this error:

'combinedImageSampler' attribute only applies to Textures (e.g., Texture2D) and SamplerState

Interestingly, there is a workaround, which even causes SPIR-V Cross to produce the correct GLSL 😀: make a dummy SamplerState using the same register, and apply [[vk::combinedImageSampler]] to that instead!

[[vk::combinedImageSampler]]
Texture2D foo: register(t0);
[[vk::combinedImageSampler]]
SamplerState foo_sampler_UNUSED: register(s0);
SamplerComparisonState foo_sampler: register(s0);

h3r2tic avatar Sep 29 '22 12:09 h3r2tic