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
755 B31 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 parameter, 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_0 ArrayStride
10struct S
11{
12    int[2] a;
13}
14
15ParameterBlock<S> input;
16
17RWStructuredBuffer<int> output;
18
19void myfunc(int[2] a)
20{
21    for (int i = 0; i < 2; i++)
22    {
23        output[i] = a[i];
24    }
25}
26
27[shader("compute")]
28void computeMain(uint3 id : SV_DispatchThreadID)
29{
30    myfunc(input.a);
31}