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
830 B19 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -allow-glsl -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_NumWorkGroups
6// CHECK: OpDecorate %gl_NumWorkGroups BuiltIn NumWorkgroups
7// CHECK: %gl_NumWorkGroups = OpVariable {{.*}} Input
8// CHECK: %[[NUM_WORK_GROUP_LOAD:[A-Za-z0-9_]+]] = OpLoad %v3uint %gl_NumWorkGroups
9// CHECK: OpCompositeExtract %uint %[[NUM_WORK_GROUP_LOAD]] 0
10
11RWStructuredBuffer<uint> outputBuffer;
12
13layout(local_size_x = 32, local_size_y = 1, local_size_z = 1) in;
14void computeMain()
15{
16    outputBuffer[0] = gl_NumWorkGroups.x;
17    outputBuffer[1] = gl_NumWorkGroups.y;
18    outputBuffer[2] = gl_NumWorkGroups.z;
19}