summaryrefslogtreecommitdiffstats
path: root/tests/glsl
diff options
context:
space:
mode:
authorDarren <65404740+fairywreath@users.noreply.github.com>2024-12-15 13:43:19 -0500
committerGitHub <noreply@github.com>2024-12-15 10:43:19 -0800
commit83f4bd5dcd7480fd4339b2b08dc23ab0763b2ffe (patch)
treeff34f1de08d21fcf94e666e6c6d4cca2d7eaf7aa /tests/glsl
parent9d608b959c0ae6ebf556a2dce6ec384451ddc519 (diff)
Enable exprs for all supported GLSL layout qualifiers (#5857)
Diffstat (limited to 'tests/glsl')
-rw-r--r--tests/glsl/layout-qualifier-exprs.slang42
1 files changed, 31 insertions, 11 deletions
diff --git a/tests/glsl/layout-qualifier-exprs.slang b/tests/glsl/layout-qualifier-exprs.slang
index 442497261..29d385e0f 100644
--- a/tests/glsl/layout-qualifier-exprs.slang
+++ b/tests/glsl/layout-qualifier-exprs.slang
@@ -1,34 +1,54 @@
-//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry computeMain -allow-glsl
+//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage fragment -entry fragmentMain -allow-glsl
+//TEST:SIMPLE(filecheck=CHECK_GLSL): -target glsl -stage fragment -entry fragmentMain -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;
+static const uint BASE_IN_LOC = 3;
+static const uint BASE_IN_INDEX = 24;
+static const uint BASE_OUT_LOC = 2;
+static const uint INPUT_ATT_BASE = 16;
+
+// CHECK_GLSL: binding = 18
+// CHECK_GLSL: set = 9
+layout(set = SET_BASE + SET_STRIDE * 2, binding = BINDING_BASE * BINDING_STRIDE * 3) buffer Output {
+ float result[];
+};
-//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[];
-};
+// CHECK_GLSL: binding = 3
+// CHECK_GLSL: set = 6
+// CHECK_GLSL: input_attachment_index = 10
+layout(input_attachment_index = (INPUT_ATT_BASE + 4) / 2, set = SET_BASE + 5, binding = BINDING_BASE) uniform subpassInput inputAttachment0;
-void computeMain() {
- uint index = gl_GlobalInvocationID.x;
+// CHECK_GLSL: constant_id = 27
+layout(constant_id = 3 * 9) const float specConst = 0.2;
+// CHECK_GLSL: location = 6
+[vk_location(BASE_OUT_LOC + 4)]
+out vec4 fragColor;
+
+// CHECK_GLSL: location = 7
+layout(location = (BASE_IN_LOC * 2) + 1, index = BASE_IN_INDEX / 3 ) in float inParam;
+
+void fragmentMain() {
+ uint index = gl_FragCoord.x;
result[index] = a[index] * b[index];
+ vec4 attachmentData = subpassLoad(inputAttachment0);
+ fragColor = vec4(attachmentData.rgb, 1.0) * specConst * inParam;
+
// CHECK: OpEntryPoint
+ // CHECK_GLSL: main
}