summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/bitfield/type-alias.slang
blob: 7a33e2c507280bf4d4dcc03c5943dc0382f5b14b (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
32
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type

// CHECK:      123
// CHECK-NEXT: 4567
// CHECK-NEXT: 0
// CHECK-NEXT: 0

//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<uint> outputBuffer;

typedef uint MyUInt;

struct S {
    MyInt foo : 8;
    MyUInt bar : 24;
};

typealias MyInt = int;

[numthreads(1, 1, 1)]
void computeMain()
{
    S s;
    s.foo = 123;
    s.bar = 4567;
    outputBuffer[0] = s.foo;
    outputBuffer[1] = s.bar;
    s.foo = 0;
    s.bar = 0;
    outputBuffer[2] = s.foo;
    outputBuffer[3] = s.bar;
}