DirectXShaderCompiler
DirectXShaderCompiler copied to clipboard
[SPIR-V] `[[vk::combinedImageSampler]]` refuses to work with `SamplerComparisonState`
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);