yum-mirror/slang

Making it easier to work with shaders

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

Mukund KeshavaAdd debug information for slang inling (#6621)083eecee3

master
1.2 KiB37 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target spirv -O0 -g3
2RWStructuredBuffer<int> outputBuffer;
3
4[ForceInline]
5int inlineSingleBasicBlock1(int value1, int value2)
6{
7    // Simple operation that should be inlined
8    return value1 * 2 + value2;
9}
10
11[ForceInline]
12int inlineSingleBasicBlock2(int value1, int value2)
13{
14    int result1 = inlineSingleBasicBlock1(10, 20);
15    // Simple operation that should be inlined
16    return value1 * 2 + value2 + result1;
17}
18
19
20[numthreads(4, 1, 1)]
21void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
22{
23    int i = dispatchThreadID.x;
24    
25    // Call the forceinline function
26    int result = inlineSingleBasicBlock2(16, 10);
27    
28    outputBuffer[i] = result;
29}
30
31
32// CHECK-COUNT-2: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugInlinedAt %uint_{{[0-9]+}} %{{[0-9]+}}
33// CHECK-NOT:  %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugInlinedAt %uint_{{[0-9]+}} %{{[0-9]+}}
34// CHECK-COUNT-3: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugScope %{{[0-9]+}} %{{[0-9]+}}
35// CHECK-NOT: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugScope %{{[0-9]+}} %{{[0-9]+}}
36// CHECK-COUNT-1: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugNoScope
37// CHECK-NOT: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugNoScope