yum-mirror/slang

Making it easier to work with shaders

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

Ellie HermaszewskaPrevent hoisting of non-hoistable instructions in non-function values with code (#4250)0bc89bc13

master
520 B33 linesraw
1//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu
2
3// CHECK:      1
4// CHECK-NEXT: 0
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 C<T>
12{
13    [ForceInline]
14    __init<U>(U value)
15    {
16        for (int i = 0; i < 1; ++i)
17        {}
18    }
19}
20
21static C<int> c = C<int>(1);
22
23int use<T>(T x)
24{
25    return 1;
26}
27
28[numthreads(1, 1, 1)]
29void computeMain(uint i : SV_GroupIndex)
30{
31    outputBuffer[0] = use(c);
32}
33