yum-mirror/slang

Making it easier to work with shaders

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

ArielG-NVMove SPIRV global variables into a context variable (#4741)04e7327a2

master
758 B16 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -target spirv -emit-spirv-directly -stage compute -entry computeMain -enable-experimental-passes
2
3// Check to ensure builtin is not moved into a kernelContext (part of entry-point). Ensure builtin is referenced directly.
4
5// CHECK: OpEntryPoint {{.*}} %gl_GlobalInvocationID
6// CHECK: OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
7// CHECK: %gl_GlobalInvocationID = OpVariable {{.*}} Input
8// CHECK: %[[NUM_WORK_GROUP_LOAD:[A-Za-z0-9_]+]] = OpLoad %v3uint %gl_GlobalInvocationID
9// CHECK: OpCompositeExtract %uint %[[NUM_WORK_GROUP_LOAD]] 0
10
11RWStructuredBuffer<uint> outputBuffer;
12[numthreads(1, 1, 1)]
13void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
14{
15    outputBuffer[dispatchThreadID.x] = 1;
16}