yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

CopilotFix int16_t/uint16_t support for WGSL target (#7692)d0f342c92

master
1.0 KiB31 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -target wgsl -stage compute -entry computeMain
2
3// Test that int16_t and uint16_t types emit diagnostics only once per type to prevent duplicates
4
5//CHECK: error 56103
6//CHECK: 16-bit integer type 'uint16_t' is not supported by the WGSL backend
7
8//CHECK: error 56103
9//CHECK: 16-bit integer type 'int16_t' is not supported by the WGSL backend
10
11RWStructuredBuffer<int> buffer;
12
13[numthreads(1,1,1)]
14void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
15{
16    // Test uint16_t - should produce error (first occurrence)
17    uint16_t test_u16 = uint16_t(dispatchThreadID.x);
18    buffer[0] = test_u16;
19    
20    // Test int16_t - should produce error (first occurrence of int16_t)
21    int16_t test_i16 = int16_t(dispatchThreadID.y);
22    buffer[1] = test_i16;
23    
24    // Use uint16_t again - should not produce duplicate error
25    uint16_t another_u16 = uint16_t(42);
26    buffer[2] = another_u16;
27    
28    // Use int16_t again - should not produce duplicate error
29    int16_t another_i16 = int16_t(123);
30    buffer[3] = another_i16;
31}