summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2024-05-30 16:47:39 -0700
committerGitHub <noreply@github.com>2024-05-30 16:47:39 -0700
commitfebbeb140bea65180ff4be9b164207c582235d4d (patch)
tree06a25bfdd3dc22c584d9bb9343bf979d5ee7a3dc /tests
parent66252cb316b26beb86b7c2b5fce2dacdcd2cf659 (diff)
Support SPIR-V DebugTypePointer (#4228)
Diffstat (limited to 'tests')
-rw-r--r--tests/spirv/debug-type-pointer.slang45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/spirv/debug-type-pointer.slang b/tests/spirv/debug-type-pointer.slang
new file mode 100644
index 000000000..505675089
--- /dev/null
+++ b/tests/spirv/debug-type-pointer.slang
@@ -0,0 +1,45 @@
+//TEST(compute, vulkan):SIMPLE(filecheck=SPV): -stage compute -entry computeMain -target spirv -emit-spirv-directly -g2
+
+// This test is to check if DebugTypePointer is emitted when "-g2" option is used
+
+//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer
+RWStructuredBuffer<float> outputBuffer;
+
+//SPV: [[STRING_float:%[1-9][0-9]*]] = OpString "float"
+//SPV: [[STRING_pValue:%[1-9][0-9]*]] = OpString "pValue"
+//SPV: [[STRING_uint64:%[1-9][0-9]*]] = OpString "uint64"
+//SPV: [[STRING_pNext:%[1-9][0-9]*]] = OpString "pNext"
+
+struct LinkedNode
+{
+ float value;
+
+ //SPV: [[TYPE_float:%[1-9][0-9]*]] = OpExtInst %void %{{[0-9]*}} DebugTypeBasic [[STRING_float]]
+ //SPV: [[TYPE_float_ptr:%[1-9][0-9]*]] = OpExtInst %void %{{[0-9]*}} DebugTypePointer [[TYPE_float]]
+ //SPV: DebugTypeMember [[STRING_pValue]] [[TYPE_float_ptr]]
+ float *pValue;
+
+ //SPV: [[TYPE_uint64:%[1-9][0-9]*]] = OpExtInst %void %{{[0-9]*}} DebugTypeBasic [[STRING_uint64]]
+ //SPV: DebugTypeMember [[STRING_pNext]] [[TYPE_uint64]]
+ LinkedNode *pNext;
+};
+
+float test(LinkedNode *pNode)
+{
+ //SPV: DebugValue %pNodeNext
+ LinkedNode *pNodeNext = pNode->pNext;
+ return *(pNode->pValue) + pNodeNext->value;
+}
+
+cbuffer Constants
+{
+ LinkedNode *head;
+};
+
+[numthreads(1,1,1)]
+void computeMain()
+{
+ LinkedNode node; // required to emit DebugTypeXXX
+ outputBuffer[0] = test(head);
+}
+