summaryrefslogtreecommitdiffstats
path: root/tests/spirv/bool-vector.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-10-02 03:33:58 -0700
committerGitHub <noreply@github.com>2023-10-02 18:33:58 +0800
commitccf2611c024ab12dcccd978f3f501d4ee9fc52bc (patch)
treef4df843e3b46886005d6bfbae34dc3bcc6fb8321 /tests/spirv/bool-vector.slang
parent6138de5f084cafdc98381237c2d8bed7c8804f1c (diff)
Add SPIRV intrinsics for ShaderExecutionReordering and RW/Buffer. (#3252)
* Add SPIRV intrinsics for ShaderExecutionReordering. * Add intrinsics for `Buffer` and `RWBuffer`. * Various spirv fixes. * Marshal bool vector type. * Inline global constants + OpFOrdNotEqual->OpFUnordNotEqual. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/spirv/bool-vector.slang')
-rw-r--r--tests/spirv/bool-vector.slang25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/spirv/bool-vector.slang b/tests/spirv/bool-vector.slang
new file mode 100644
index 000000000..17c58a29a
--- /dev/null
+++ b/tests/spirv/bool-vector.slang
@@ -0,0 +1,25 @@
+// bool-vector.slang
+
+//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -output-using-type
+
+// Test direct SPIR-V emit on arrays in uniforms.
+
+//TEST_INPUT:set resultBuffer = out ubuffer(data=[0 0 0 0], stride=4)
+RWStructuredBuffer<uint> resultBuffer;
+
+struct Data
+{
+ bool4 bv;
+};
+
+//TEST_INPUT:set dataBuffer = ubuffer(data=[0 1 1 0], stride=4)
+RWStructuredBuffer<Data> dataBuffer;
+
+[numthreads(1, 1, 1)]
+void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID)
+{
+ // CHECK: 0
+ // CHECK: 100
+ resultBuffer[0] = dataBuffer[0].bv.x;
+ resultBuffer[1] = dataBuffer[0].bv.y ? 100 : 0;
+}