From 83c7b7c7716c31596d9e2829d4afa708ce23a182 Mon Sep 17 00:00:00 2001 From: Jerran Schmidt Date: Fri, 27 Jun 2025 02:33:16 +1000 Subject: Fix for OpUConvert producing invalid opcode when to/from signs differ (#7398) * Fix for OpUConvert outputting scalar type for mixed sign vector type conversions * Fix compiler warning * Added regression test for UConvert vector fix * Formatting * getUnsignedType helper * Formatting * Fix for addtional int types * Helper function to convert signed type to unsigned type --- tests/spirv/uconvert-vector-typecheck.slang | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/spirv/uconvert-vector-typecheck.slang (limited to 'tests') diff --git a/tests/spirv/uconvert-vector-typecheck.slang b/tests/spirv/uconvert-vector-typecheck.slang new file mode 100644 index 000000000..f4671c89f --- /dev/null +++ b/tests/spirv/uconvert-vector-typecheck.slang @@ -0,0 +1,20 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv + +// CHECK: %[[PTR:[0-9a-zA-Z_]+]] = OpVectorShuffle %v2uint %{{.*}} %{{.*}} 0 1 +// CHECK: %{{.*}} = OpUConvert %v2ushort %[[PTR]] + +RWTexture2D tex; + +void writeFlags(int2 position, RWTexture2D flagsTexture, uint flags) +{ + flagsTexture[position] = flags; +} + +[shader("compute")] +[numthreads(1,1,1)] +void main(uint3 threadId : SV_DispatchThreadID) +{ + uint16_t2 position = uint16_t2(threadId.xy); + uint flags = 1; + writeFlags(position, tex, flags); +} -- cgit v1.2.3