summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2025-02-14 01:55:28 +0800
committerGitHub <noreply@github.com>2025-02-13 09:55:28 -0800
commit1ea2ab1b638b0e6d2c385b2b06157e6109417e6b (patch)
tree438aede974cc87fffbe58e9c99d99719bb25680a /tests/diagnostics
parentccc75cdd9508a4e19efa22e7c911cc2013f514fa (diff)
Disallow only resources in constant buffers in parameterblocks on metal (#6342)
* Neaten metal parameter block checking * Disallow only resources in constant buffers in parameterblocks on metal closes https://github.com/shader-slang/slang/issues/6200 * add unit test for metal parameterblock cbuffer --------- Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests/diagnostics')
-rw-r--r--tests/diagnostics/nested-constant-buffer-in-parameter-block.slang27
1 files changed, 20 insertions, 7 deletions
diff --git a/tests/diagnostics/nested-constant-buffer-in-parameter-block.slang b/tests/diagnostics/nested-constant-buffer-in-parameter-block.slang
index eb9ecdd14..9fb83f034 100644
--- a/tests/diagnostics/nested-constant-buffer-in-parameter-block.slang
+++ b/tests/diagnostics/nested-constant-buffer-in-parameter-block.slang
@@ -1,20 +1,33 @@
//TEST:SIMPLE(filecheck=CHECK): -target metal
+struct T
+{
+ RWStructuredBuffer<int> buf;
+}
+
+struct U
+{
+ ConstantBuffer<T> t;
+}
+
struct S
{
- // CHECK-DAG: ([[# @LINE+1]]): error 56100:
- ConstantBuffer<int> cb;
+ ConstantBuffer<RWStructuredBuffer<int>> cb;
}
-ParameterBlock<S> s;
+// CHECK-DAG: ([[# @LINE+1]]): error 56101:
+ParameterBlock<S> s1;
+
+// CHECK-DAG: ([[# @LINE+1]]): error 56101:
+ParameterBlock<U> s2;
-// CHECK-DAG: ([[# @LINE+1]]): error 56100:
-ParameterBlock<ConstantBuffer<int>> s2;
+// CHECK-DAG: ([[# @LINE+1]]): error 56101:
+ParameterBlock<ConstantBuffer<RWStructuredBuffer<int>>> s3;
RWStructuredBuffer<int> outputBuffer;
[numthreads(1,1,1)]
void kernelMain()
{
- outputBuffer[0] = s.cb + s2;
-} \ No newline at end of file
+ outputBuffer[0] = s1.cb[0] + s2.t.buf[0] + s3[0];
+}