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
569 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: 0
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<T> {
12    int foo : 8;
13    uint bar : 24;
14    T baz;
15};
16
17[numthreads(1, 1, 1)]
18void computeMain()
19{
20    S<int> s;
21    s.foo = 123;
22    s.bar = 4567;
23    outputBuffer[0] = s.foo;
24    outputBuffer[1] = s.bar;
25    s.foo = 0;
26    s.bar = 0;
27    outputBuffer[2] = s.foo;
28    outputBuffer[3] = s.bar;
29}