summaryrefslogtreecommitdiff
path: root/tests/glsl
diff options
context:
space:
mode:
authorDarren <65404740+fairywreath@users.noreply.github.com>2024-12-10 13:12:19 -0500
committerGitHub <noreply@github.com>2024-12-10 10:12:19 -0800
commit523e9f012e42608df1f7dd91f5625f8171b6ca3d (patch)
treef0ba1940c442ae85e03769047125a1fe73900fb7 /tests/glsl
parent34497ae6d779b16b75003c7d9b6ca04e58b4dc70 (diff)
Enable exprs for GLSL binding layout qualifiers (#5807)
* Allow glsl set and binding layout qualifiers to be compile time integer exprs * add new tests * add comments * cleanup on asserts * addressed review comments and cleanup * fix missing set expr in test * fixed tests and cleanup --------- Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests/glsl')
-rw-r--r--tests/glsl/layout-qualifier-exprs.slang34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/glsl/layout-qualifier-exprs.slang b/tests/glsl/layout-qualifier-exprs.slang
new file mode 100644
index 000000000..442497261
--- /dev/null
+++ b/tests/glsl/layout-qualifier-exprs.slang
@@ -0,0 +1,34 @@
+//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry computeMain -allow-glsl
+
+#version 450
+
+layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in;
+
+static const uint BINDING_BASE = 3;
+static const uint BINDING_STRIDE = 2;
+
+static const uint SET_BASE = 1;
+static const uint SET_STRIDE = 4;
+
+//TEST_INPUT:ubuffer(data=[2 2 2 2], stride=4):name=a
+layout(set = SET_BASE, binding = BINDING_BASE * BINDING_STRIDE) buffer InputA {
+ float a[];
+};
+
+//TEST_INPUT:ubuffer(data=[2 2 2 2], stride=4):name=b
+layout(set = SET_BASE + SET_STRIDE, binding = BINDING_BASE * BINDING_STRIDE * 2) buffer InputB {
+ float b[];
+};
+
+layout(set = SET_BASE + SET_STRIDE * 2, binding = BINDING_BASE * BINDING_STRIDE * 3) buffer Output {
+ float result[];
+};
+
+void computeMain() {
+ uint index = gl_GlobalInvocationID.x;
+
+ result[index] = a[index] * b[index];
+
+ // CHECK: OpEntryPoint
+}
+