yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
1e7f5418c
master
1// groupshared-ref-param.slang 2 3//TEST:SIMPLE(filecheck=CHECK): -target wgsl -entry computeMain -stage compute 4 5 6//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 7RWStructuredBuffer<int> outputBuffer; 8 9groupshared uint sharedVal; 10 11// Expect sharedVal to be passed by reference. 12// 13// CHECK: fn computeMain({{.*}}({{.*}}) 14// CHECK: {{.*}}workgroupUniformLoad(&((sharedVal_{{[a-zA-Z0-9_]*}}))){{.*}}; 15// CHECK: } 16 17 18[numthreads(1, 1, 1)] 19void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) 20{ 21 int idx = dispatchThreadID.x; 22 23 sharedVal = 1; 24 outputBuffer[0] = workgroupUniformLoad(sharedVal); 25}