summaryrefslogtreecommitdiffstats
path: root/tests/spirv/array-resource.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-11-16 21:23:13 -0800
committerGitHub <noreply@github.com>2023-11-16 21:23:13 -0800
commit240aa243527eabcf87c30aabf9749396de47b1b2 (patch)
tree00fd10c993aba5a5efee8e3bb698914efc6afe5a /tests/spirv/array-resource.slang
parent6732f571e301754f6edc799b871f5e443eb9a9b8 (diff)
GLSL/SPIRV Fixes. (#3337)
Diffstat (limited to 'tests/spirv/array-resource.slang')
-rw-r--r--tests/spirv/array-resource.slang25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/spirv/array-resource.slang b/tests/spirv/array-resource.slang
new file mode 100644
index 000000000..b6edf9b27
--- /dev/null
+++ b/tests/spirv/array-resource.slang
@@ -0,0 +1,25 @@
+// array-resource.slang
+
+// Test direct SPIR-V emit on arrays of buffers.
+
+//TEST:SIMPLE(filecheck=CHECK):-target spirv -entry computeMain -stage compute -emit-spirv-directly
+//TEST_INPUT:set resultBuffer = out ubuffer(data=[0 0 0 0], stride=4)
+
+// Note: we can't run this test at the moment because gfx doesn't support allocating shader objects with unsized arrays.
+//TEST_DISABLED(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUFFER):-vk -compute -output-using-type
+
+RWStructuredBuffer<uint> inputBuffers[];
+
+RWStructuredBuffer<uint> resultBuffer;
+
+//TEST_INPUT: set inputBuffers = {ubuffer(data=[1 0 0 0], stride=4), ubuffer(data=[2 0 0 0], stride=4)}
+
+[numthreads(4,1,1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ uint threadId = dispatchThreadID.x;
+ resultBuffer[threadId] = inputBuffers[0][threadId] + inputBuffers[1][threadId];
+ // CHECK: OpCapability RuntimeDescriptorArray
+ // CHECK: OpExtension "SPV_EXT_descriptor_indexing"
+ // BUFFER: 3
+}