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
737 B29 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 function scope, 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
15StructuredBuffer<S> input;
16
17RWStructuredBuffer<int> output;
18
19[shader("compute")]
20void computeMain(uint3 id : SV_DispatchThreadID)
21{
22    S s;
23    s.a = input[0].a;
24
25    for (int i = 0; i < 1; i++)
26    {
27        output[i] = s.a[i];
28    }
29}