From 523e9f012e42608df1f7dd91f5625f8171b6ca3d Mon Sep 17 00:00:00 2001 From: Darren <65404740+fairywreath@users.noreply.github.com> Date: Tue, 10 Dec 2024 13:12:19 -0500 Subject: 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 --- .../unrecognized-glsl-layout-modifiers.slang | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/diagnostics/unrecognized-glsl-layout-modifiers.slang (limited to 'tests/diagnostics') diff --git a/tests/diagnostics/unrecognized-glsl-layout-modifiers.slang b/tests/diagnostics/unrecognized-glsl-layout-modifiers.slang new file mode 100644 index 000000000..3012a8828 --- /dev/null +++ b/tests/diagnostics/unrecognized-glsl-layout-modifiers.slang @@ -0,0 +1,23 @@ +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target spirv -stage vertex -entry main -allow-glsl +#version 310 es +layout(location = 0) in highp vec4 a_position; +layout(location = 1) in highp vec4 a_coords; +layout(location = 0) out mediump vec3 v_color; + + +// CHECK: error 31216 +layout(std140, not_a_set = 0, binding = 0) uniform buff0 { + mediump int ui_zero; +}; + +void main() +{ + gl_Position = a_position; + mediump vec4 coords = a_coords; + mediump vec4 res = coords; + mediump int i = 0; + for (;;) { res = res.yzwx + vec4(1.0); if (i == 1) break; i++; } + res -= vec4(2); + v_color = res.rgb; +} + -- cgit v1.2.3