summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics/structuredbuffer-resource.slang
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2025-09-04 04:05:26 +0800
committerGitHub <noreply@github.com>2025-09-03 20:05:26 +0000
commita766d27447aa0fcf69334c0467d9b1124892e180 (patch)
tree67ca5615e4a8c94d7454ee43375eeffc8c8a7d4c /tests/diagnostics/structuredbuffer-resource.slang
parentbf607e2f3fa183e9a2b18c7a98438a05247d6ed3 (diff)
Diagnose on structured buffers containing resources (#8222)
closes https://github.com/shader-slang/slang/issues/3313
Diffstat (limited to 'tests/diagnostics/structuredbuffer-resource.slang')
-rw-r--r--tests/diagnostics/structuredbuffer-resource.slang28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/diagnostics/structuredbuffer-resource.slang b/tests/diagnostics/structuredbuffer-resource.slang
new file mode 100644
index 000000000..3f30f0102
--- /dev/null
+++ b/tests/diagnostics/structuredbuffer-resource.slang
@@ -0,0 +1,28 @@
+//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target spirv
+
+// Direct resource types as StructuredBuffer elements
+
+//CHECK-DAG: ([[# @LINE+1]]): error 38204
+StructuredBuffer<Texture2D<float>> textureBuffer;
+
+//CHECK-DAG: ([[# @LINE+1]]): error 38204
+StructuredBuffer<SamplerState> samplerBuffer;
+
+//CHECK-DAG: ([[# @LINE+1]]): error 38204
+StructuredBuffer<StructuredBuffer<float>> nestedBuffer;
+
+//CHECK-DAG: ([[# @LINE+1]]): error 38204
+RWStructuredBuffer<Texture2D<float>> rwTextureBuffer;
+
+RWStructuredBuffer<float> output;
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ uint i = dispatchThreadID.x;
+ float result = textureBuffer[i].Sample(samplerBuffer[i], float2(0, 0)).x
+ + nestedBuffer[i][0];
+
+ rwTextureBuffer[i] = textureBuffer[i];
+ output[i] = result;
+}