summaryrefslogtreecommitdiffstats
path: root/tests/compute
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2024-01-05 17:26:36 +0800
committerGitHub <noreply@github.com>2024-01-05 01:26:36 -0800
commit1abc67c4404f0db10f5f6ff4150c574b2664cb1e (patch)
treec20e77fe84bcbae77eabbfa00a7fc061d6095a1a /tests/compute
parentecfd9da2e564596c127c20b7d376da4b89441372 (diff)
Add test for glsl groupshared init (#3433)
Diffstat (limited to 'tests/compute')
-rw-r--r--tests/compute/groupshared-init.slang28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/compute/groupshared-init.slang b/tests/compute/groupshared-init.slang
new file mode 100644
index 000000000..5a9758826
--- /dev/null
+++ b/tests/compute/groupshared-init.slang
@@ -0,0 +1,28 @@
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -output-using-type -use-dxil
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -emit-spirv-directly
+
+// CHECK: type: uint32_t
+// CHECK-NEXT: 1231
+// CHECK-NEXT: 1232
+// CHECK-NEXT: 1233
+// CHECK-NEXT: 1234
+
+// This is a basic test for Slang compute shader.
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
+RWStructuredBuffer<uint> outputBuffer;
+
+groupshared uint myGroupSharedValue = foo();
+
+uint foo()
+{
+ return 1231;
+}
+
+[numthreads(4, 1, 1)]
+void computeMain(uint i : SV_GroupIndex)
+{
+ outputBuffer[i] = i + myGroupSharedValue;
+}