You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since I can run GLSL shaders that use DX9 style samplers through spirv-opt and back, I figured it was a glslangValidator bug. I compiled both the HLSL and the expected GLSL output and disassembled them. The only functional difference I could find was that the HLSL version had this line:
Both versions perform the texture lookup using OpImageSampleImplicitLod, but according to the SPIR-V docs for it, only the OpTypeSampledImage argument is correct to pass to it. spirv-val seems to agree:
error: 34: Expected Sampled Image to be of type OpTypeSampledImage: ImageSampleImplicitLod
If I swap it out for those two lines, reassemble and cross compile it to GLSL, then the output correctly contains the sampler declaration and passes validation.
The text was updated successfully, but these errors were encountered:
slembcke
changed the title
HLSL legacy sampler2D support.
HLSL legacy samplers cause invalid output.
Apr 26, 2018
I think there are some conflating comments here, as the DX9 path to the unimplemented(...) might not be taken (and some other things). But, fundamentally, yes, glslang is not supporting DX9.
This is captured in #362. So, if that's the real issue here, we can close this.
If a HLSL shader declares a sampler2D uniform, that uniform is dropped when cross-compiling to GLSL using glslangValidator/spirv-cross.
For example, this is my input HLSL:
This is the resulting GLSL:
Since I can run GLSL shaders that use DX9 style samplers through spirv-opt and back, I figured it was a glslangValidator bug. I compiled both the HLSL and the expected GLSL output and disassembled them. The only functional difference I could find was that the HLSL version had this line:
While the GLSL version had these two lines:
Both versions perform the texture lookup using OpImageSampleImplicitLod, but according to the SPIR-V docs for it, only the OpTypeSampledImage argument is correct to pass to it. spirv-val seems to agree:
If I swap it out for those two lines, reassemble and cross compile it to GLSL, then the output correctly contains the sampler declaration and passes validation.
The text was updated successfully, but these errors were encountered: