glslang
glslang copied to clipboard
HLSL Format RWTexture mismatching Int and Float types
https://github.com/KhronosGroup/SPIRV-Tools/pull/5458 shows a failure with Test/hlsl.format.rwtexture.frag
and shows
Failing ToSpirv/HlslCompileTest.FromFile/hlsl_format_rwtexture_frag
error: [VUID-StandaloneSpirv-Image-04965] Image Format type (float or int) does not match Sample Type operand
%42 = OpTypeImage %int 1D 0 0 0 2 Rg32f
It's not clear what the desired result is here, given this is what the HLSL code asks for. Perhaps it should emit an error in this case, and perhaps the test shouldn't be doing this:
[[spv::format_rg32f]] RWTexture1D <int4> g_tTex1di4;
so looking at DXC (https://godbolt.org/z/vTMr3qbnW) it has
warning: unknown attribute 'format_rg32f' ignored [-Wunknown-attributes]
and then just goes OpTypeImage %int 1D 2 0 0 2 Rgba32i
So I assume the desire result is to warn the user the spv::format
attribute is non-sense and ignore it
After talking with @spencer-lunarg offline about this, I think it makes sense to remove the incoherent entries from Test/hlsl.format.rwtexture.frag
in the short term and then have glslang output an error for these cases in the future. What do you think @arcady-lunarg?