yum-mirror/slang

Making it easier to work with shaders

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

Ellie HermaszewskaAdd support for bitfields (#3639)d979b5048

master
568 B29 linesraw
1//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type
2
3// CHECK:      123
4// CHECK-NEXT: 4567
5// CHECK-NEXT: -10
6// CHECK-NEXT: 16772649
7
8//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
9RWStructuredBuffer<int> outputBuffer;
10
11struct S {
12    int foo : 8;
13    uint bar : 24;
14};
15
16[numthreads(1, 1, 1)]
17void computeMain()
18{
19    S s;
20    s.foo = 123;
21    s.bar = 4567;
22    outputBuffer[0] = s.foo;
23    outputBuffer[1] = s.bar;
24
25    s.foo *= 2;
26    s.bar *= 0xffffff;
27    outputBuffer[2] = s.foo;
28    outputBuffer[3] = s.bar;
29}