From 21d17abb0e511806b7c93effc58f37169d837766 Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Fri, 15 Dec 2023 23:41:27 +0800 Subject: GLSL SSBO Support (#3400) * Squash warnings and fix build with SLANG_EMBED_STDLIB * Add GLSLShaderStorageBuffer magic wrapper * Make GLSLSSBO not a uniform type * Buffers are global variables * Allow creating ssbo aggregate types * Allow reading from RWSB using builder * Nicer debug printing for ssbos * Lower SSBO to RWSB * Parse interface blocks into wrapped structs * Lower Interface Block Decls to structs * remove comment * Two simple ssbo tests * Move ssbo pass earlier * Correct mutable buffer detection * Do not replace ssbo usages outside of blocks * Treat GLSLSSBO as a mutable buffer for type layouts * regenerate vs projects * Correctly detect ssbo types * Diagnose illegal ssbo * remove unreachable code * neaten * ci wobble * Make GLSLSSBO ast handling more uniform * Add modifier cases for glsl * Use empty val info for unhandled interface blocks necessary for ./tests/glsl/out-binding-redeclaration.slang * more sophisticated modifier check * Correct ssbo wrapper name --- tests/glsl/ssbo-2.slang | 20 ++++++++++++++++++++ tests/glsl/ssbo.slang | 16 ++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 tests/glsl/ssbo-2.slang create mode 100644 tests/glsl/ssbo.slang (limited to 'tests') diff --git a/tests/glsl/ssbo-2.slang b/tests/glsl/ssbo-2.slang new file mode 100644 index 000000000..11542a539 --- /dev/null +++ b/tests/glsl/ssbo-2.slang @@ -0,0 +1,20 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry main -allow-glsl +#version 430 +precision highp float; +precision highp int; + +layout(binding = 0) buffer MyBlockName +{ + vec4 a; + float b; + int c; +} output_data; + +layout(local_size_x = 4) in; +void main() +{ + output_data.a = vec4(gl_GlobalInvocationID, 1); + output_data.b = 10; + output_data.c = 20; + // CHECK: OpEntryPoint +} diff --git a/tests/glsl/ssbo.slang b/tests/glsl/ssbo.slang new file mode 100644 index 000000000..47084a823 --- /dev/null +++ b/tests/glsl/ssbo.slang @@ -0,0 +1,16 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry main -allow-glsl +#version 430 +precision highp float; +precision highp int; + +layout(binding = 0) buffer MyBlockName +{ + vec4 data[]; +} output_data; + +layout(local_size_x = 4) in; +void main() +{ + output_data.data[gl_GlobalInvocationID.x] = vec4(gl_GlobalInvocationID, 1); + // CHECK: OpEntryPoint +} -- cgit v1.2.3