summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-11-19 14:43:15 -0800
committerGitHub <noreply@github.com>2024-11-19 14:43:15 -0800
commit1e7f5418c293d3a9ca91ae4648ca2d522ec2ebe7 (patch)
tree54b916dcd790740d9a74900f1f3c917d73bfdee9 /tests
parenta63f065c03182f0dbfbcd2fb4264b0fe98fd344d (diff)
Fix wgsl legalization around __ref parameter. (#5597)
* Fix wgsl legalization around __ref parameter. * Add intrinsic and test case.
Diffstat (limited to 'tests')
-rw-r--r--tests/wgsl/workgroup-uniform-load.slang25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/wgsl/workgroup-uniform-load.slang b/tests/wgsl/workgroup-uniform-load.slang
new file mode 100644
index 000000000..3ace37826
--- /dev/null
+++ b/tests/wgsl/workgroup-uniform-load.slang
@@ -0,0 +1,25 @@
+// groupshared-ref-param.slang
+
+//TEST:SIMPLE(filecheck=CHECK): -target wgsl -entry computeMain -stage compute
+
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
+RWStructuredBuffer<int> outputBuffer;
+
+groupshared uint sharedVal;
+
+// Expect sharedVal to be passed by reference.
+//
+// CHECK: fn computeMain({{.*}}({{.*}})
+// CHECK: {{.*}}workgroupUniformLoad(&((sharedVal_{{[a-zA-Z0-9_]*}}))){{.*}};
+// CHECK: }
+
+
+[numthreads(1, 1, 1)]
+void computeMain(int3 dispatchThreadID: SV_DispatchThreadID)
+{
+ int idx = dispatchThreadID.x;
+
+ sharedVal = 1;
+ outputBuffer[0] = workgroupUniformLoad(sharedVal);
+} \ No newline at end of file