summaryrefslogtreecommitdiffstats
path: root/tests/wgsl/int16-uint16-error.slang
blob: 651fe8a635d16a0b2ffc2d8ba6f8abdd52731d85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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;
}