summaryrefslogtreecommitdiffstats
path: root/tests/spirv
diff options
context:
space:
mode:
Diffstat (limited to 'tests/spirv')
-rw-r--r--tests/spirv/ref-this.slang30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/spirv/ref-this.slang b/tests/spirv/ref-this.slang
new file mode 100644
index 000000000..5eaa7f3a1
--- /dev/null
+++ b/tests/spirv/ref-this.slang
@@ -0,0 +1,30 @@
+//TEST:SIMPLE(filecheck=CHECK): -target spirv
+
+// CHECK: %[[PTR:[0-9a-zA-Z_]+]] = OpAccessChain %_ptr_PhysicalStorageBuffer_uint %{{.*}} %int_0
+// CHECK: %original = OpAtomicIAdd %uint %[[PTR]] %uint_1 %uint_0 %uint_1
+
+struct Buf
+{
+ uint t;
+
+ [__ref]
+ func tester()
+ {
+ uint prev;
+ InterlockedAdd(t, 1, prev);
+ }
+};
+
+struct Push
+{
+ Buf * b;
+};
+
+[[vk::push_constant]] Push push;
+
+[shader("compute")]
+[numthreads(1, 1, 1)]
+void main()
+{
+ push.b->tester();
+} \ No newline at end of file