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 --- tests/glsl/layout-qualifier-exprs.slang | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/glsl/layout-qualifier-exprs.slang (limited to 'tests/glsl') 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 +} + -- cgit v1.2.3