yum-mirror/slang

Making it easier to work with shaders

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

kaizhangNVFix the invalid SPIRV decoration issue (#7527)bf94fc3f5

master
821 B34 linesraw
1//TEST:SIMPLE(filecheck=CHECK):-target spirv -entry computeMain -stage compute -emit-spirv-directly
2
3// The test check that if an array is used in workgroup, we don't decorate it with array stride decoration.
4
5// The reason we have to check the SPIRV instead of using spirv-val is because slang uses spv1.6 as the target_env,
6// but the issue only occurs when the target_env is vulkan1.2+
7
8// CHECK: OpEntryPoint
9// CHECK-NOT: OpDecorate %_arr_int_int_2 ArrayStride
10struct S
11{
12    int[2] a;
13}
14
15ParameterBlock<S> input;
16
17RWStructuredBuffer<int> output;
18
19groupshared S s;
20
21
22[shader("compute")]
23void computeMain(uint3 id : SV_DispatchThreadID)
24{
25    if (id.x == 0)
26    {
27        for (int i = 0; i < 2; ++i)
28        {
29            s.a[i] = input.a[i];
30        }
31    }
32    GroupMemoryBarrier();
33    output[id.x] = s.a[id.x];
34}