summaryrefslogtreecommitdiffstats
path: root/tests/spirv
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-09-05 11:24:43 -0700
committerGitHub <noreply@github.com>2024-09-05 11:24:43 -0700
commit77ecad28cfb0d17b8d3a93fb7c08be4217eb2433 (patch)
tree62fe3426356eb913dfa7b0c3d8ffdf10cbc4ac47 /tests/spirv
parentd655302465457c5d3285ae5339201a0769cc38dc (diff)
Fix spirv emit for global pointer variable. (#5009)
Diffstat (limited to 'tests/spirv')
-rw-r--r--tests/spirv/global-pointer.slang14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/spirv/global-pointer.slang b/tests/spirv/global-pointer.slang
new file mode 100644
index 000000000..e373920eb
--- /dev/null
+++ b/tests/spirv/global-pointer.slang
@@ -0,0 +1,14 @@
+//TEST:SIMPLE(filecheck=CHECK): -target spirv
+
+// CHECK: OpDecorate %g_Instance AliasedPointer
+
+static int* g_Instance = nullptr;
+
+[vk::push_constant] int* dest;
+
+[numthreads(1)]
+void ComputeMain(int tid : SV_DispatchThreadID) {
+ // int* g_Instance = nullptr;
+ if (tid % 2 == 0) g_Instance = dest;
+ if (g_Instance) g_Instance[tid] = 123;
+} \ No newline at end of file