summaryrefslogtreecommitdiff
path: root/tests/wgsl
diff options
context:
space:
mode:
authorCopilot <198982749+Copilot@users.noreply.github.com>2025-07-11 03:22:59 +0000
committerGitHub <noreply@github.com>2025-07-11 03:22:59 +0000
commitd0f342c9263a0e47947ac3be9fa4d9f665831e63 (patch)
treead413058f5b635e60a57aba59870e344c5d847d4 /tests/wgsl
parent6f11c50ba101948b110aa7310fc4fb5732b2b708 (diff)
Fix int16_t/uint16_t support for WGSL target (#7692)
* Initial plan * Implement int16_t/uint16_t support for WGSL target Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Change int16_t/uint16_t to emit proper diagnostics instead of auto-promoting Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Implement diagnoseOnce to prevent duplicate diagnostics Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Optimize diagnoseOnce to use HashSet::add() return value Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Apply code formatting to slang-emit-c-like.h Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Fix diagnoseOnce to use all parameters instead of first parameter only Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
Diffstat (limited to 'tests/wgsl')
-rw-r--r--tests/wgsl/int16-uint16-error.slang31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/wgsl/int16-uint16-error.slang b/tests/wgsl/int16-uint16-error.slang
new file mode 100644
index 000000000..651fe8a63
--- /dev/null
+++ b/tests/wgsl/int16-uint16-error.slang
@@ -0,0 +1,31 @@
+//TEST:SIMPLE(filecheck=CHECK): -target wgsl -stage compute -entry computeMain
+
+// Test that int16_t and uint16_t types emit diagnostics only once per type to prevent duplicates
+
+//CHECK: error 56103
+//CHECK: 16-bit integer type 'uint16_t' is not supported by the WGSL backend
+
+//CHECK: error 56103
+//CHECK: 16-bit integer type 'int16_t' is not supported by the WGSL backend
+
+RWStructuredBuffer<int> buffer;
+
+[numthreads(1,1,1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ // Test uint16_t - should produce error (first occurrence)
+ uint16_t test_u16 = uint16_t(dispatchThreadID.x);
+ buffer[0] = test_u16;
+
+ // Test int16_t - should produce error (first occurrence of int16_t)
+ int16_t test_i16 = int16_t(dispatchThreadID.y);
+ buffer[1] = test_i16;
+
+ // Use uint16_t again - should not produce duplicate error
+ uint16_t another_u16 = uint16_t(42);
+ buffer[2] = another_u16;
+
+ // Use int16_t again - should not produce duplicate error
+ int16_t another_i16 = int16_t(123);
+ buffer[3] = another_i16;
+} \ No newline at end of file