summaryrefslogtreecommitdiff
path: root/tests/metal/system-val-conversion.slang
blob: dd8e103aed36332c2d18963f2f77958a7bf49ee4 (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
//TEST:SIMPLE(filecheck=CHECK-ASM): -target metallib
//TEST:SIMPLE(filecheck=CHECK): -target metal

// Test that we always emit correct type for system value and insert conversion logic
// if the declared type of the SV is different from the spec-defined type.

uniform RWStructuredBuffer<float> outputBuffer;

RWByteAddressBuffer buffer;

// CHECK-ASM: define void @main_kernel

struct TestStruct
{
    uint8_t a;
    float16_t h;
    float b;
    float4 c;
    float4x3 d;
}

// CHECK: void main_kernel(uint3 tid{{.*}}
// CHECK: uint(int(tid{{.*}}.x))

[numthreads(1,1,1)]
void main_kernel(int tid: SV_DispatchThreadID)
{
    buffer.Store(128, buffer.Load<TestStruct>(tid));
}