glslang icon indicating copy to clipboard operation
glslang copied to clipboard

HLSL Format RWTexture mismatching Int and Float types

Open spencer-lunarg opened this issue 1 year ago • 3 comments

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

spencer-lunarg avatar Oct 30 '23 09:10 spencer-lunarg

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;

arcady-lunarg avatar Oct 31 '23 19:10 arcady-lunarg

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

spencer-lunarg avatar Nov 01 '23 05:11 spencer-lunarg

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?

ncesario-lunarg avatar Nov 08 '23 00:11 ncesario-lunarg