summaryrefslogtreecommitdiff
path: root/tests/language-feature/spirv-asm/assignment-syntax.slang
diff options
context:
space:
mode:
Diffstat (limited to 'tests/language-feature/spirv-asm/assignment-syntax.slang')
-rw-r--r--tests/language-feature/spirv-asm/assignment-syntax.slang25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/language-feature/spirv-asm/assignment-syntax.slang b/tests/language-feature/spirv-asm/assignment-syntax.slang
new file mode 100644
index 000000000..a511cd92a
--- /dev/null
+++ b/tests/language-feature/spirv-asm/assignment-syntax.slang
@@ -0,0 +1,25 @@
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -shaderobj -emit-spirv-directly
+
+//TEST_INPUT:ubuffer(data=[1 2 3 4], stride=4):out,name=outputBuffer
+RWStructuredBuffer<int> outputBuffer;
+
+// CHECK: 2
+// CHECK-NEXT: 4
+// CHECK-NEXT: 6
+// CHECK-NEXT: 8
+
+//
+// This test tests a basic application of the spirv_asm block's assignment syntax
+//
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ int i = dispatchThreadID.x;
+ int n = outputBuffer[i];
+ int r = spirv_asm
+ {
+ %two = OpConstant $$int 2;
+ result = OpIMul $$int $n %two;
+ };
+ outputBuffer[i] = r;
+}