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