summaryrefslogtreecommitdiff
path: root/tests/spirv/ptr-member-func.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-12-09 04:48:03 -0800
committerGitHub <noreply@github.com>2024-12-09 20:48:03 +0800
commit09a9d673322ebf4ca2fcb7d48f13a44e015ea33f (patch)
tree8bae8fa5718669dcbff98b8bcb29784483905f34 /tests/spirv/ptr-member-func.slang
parent051ae8acec0a641bcaf86e7eeff35eff29e8922d (diff)
Allow pointers to existential values. (#5793)
* Fix pointer offset logic and add executable tests. * Fix. * Fix test. * Add existential ptr test. * Allow pointers to existential values. * Fix. * Fix. --------- Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
Diffstat (limited to 'tests/spirv/ptr-member-func.slang')
-rw-r--r--tests/spirv/ptr-member-func.slang29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/spirv/ptr-member-func.slang b/tests/spirv/ptr-member-func.slang
new file mode 100644
index 000000000..0dcf572ee
--- /dev/null
+++ b/tests/spirv/ptr-member-func.slang
@@ -0,0 +1,29 @@
+//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK): -vk -emit-spirv-directly
+//DISABLED_TEST: COMPARE_COMPUTE(filecheck-buffer=CHECK): -wgpu
+//DISABLED_TEST: COMPARE_COMPUTE(filecheck-buffer=CHECK): -d3d11
+//DISABLED_TEST: COMPARE_COMPUTE(filecheck-buffer=CHECK): -d3d12
+//DISABLED_TEST: COMPARE_COMPUTE(filecheck-buffer=CHECK): -metal
+
+struct Obj
+{
+ int val;
+
+ [mutating]
+ void addOne() { val++; }
+
+ int getValPlusOne() { return val + 1; }
+}
+
+//TEST_INPUT: set pObj = ubuffer(data=[2 0 0 0], stride=4);
+uniform Obj* pObj;
+
+//TEST_INPUT: set outputBuffer = out ubuffer(data=[0 0 0 0],stride=4);
+uniform RWStructuredBuffer<uint> outputBuffer;
+
+[numthreads(1,1,1)]
+void computeMain()
+{
+ pObj->addOne();
+ // CHECK: 4
+ outputBuffer[0] = pObj->getValPlusOne();
+} \ No newline at end of file