From 64b321995acbc4dee1f1be9e17ea161efa0b6bc9 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 6 Mar 2021 02:51:04 +0200 Subject: [PATCH] Add some test cases for unused interface blocks --- .../partially_unused_interface_block.glsl | 50 +++++++++++++++++++ .../glsl/unused_interface_block_removal.glsl | 30 +++++++++++ 2 files changed, 80 insertions(+) create mode 100644 tests/glsl/partially_unused_interface_block.glsl create mode 100644 tests/glsl/unused_interface_block_removal.glsl diff --git a/tests/glsl/partially_unused_interface_block.glsl b/tests/glsl/partially_unused_interface_block.glsl new file mode 100644 index 00000000..82b8b1da --- /dev/null +++ b/tests/glsl/partially_unused_interface_block.glsl @@ -0,0 +1,50 @@ +#pragma MSP stage(vertex) +layout(location=0) in vec4 position; +layout(location=1) in vec4 color; +out VertexOut +{ + vec2 texcoord; + vec4 color; +} vs_out; +void main() +{ + vs_out.texcoord = position.xy*0.5+0.5; + vs_out.color = color; + gl_Position = position; +} + +#pragma MSP stage(fragment) +layout(location=0) out vec4 frag_color; +void main() +{ + frag_color = vs_out.color; +} + +/* Expected output: vertex +layout(location=0) in vec4 position; +layout(location=1) in vec4 color; +out VertexOut +{ + vec2 texcoord; + vec4 color; +} vs_out; +void main() +{ + vs_out.texcoord = position.xy*0.5+0.5; + vs_out.color = color; + gl_Position = position; +} +*/ + +/* Expected output: fragment +layout(location=0) out vec4 frag_color; +in VertexOut +{ + vec2 texcoord; + vec4 color; +} vs_out; +void main() +{ + frag_color = vs_out.color; +} +*/ diff --git a/tests/glsl/unused_interface_block_removal.glsl b/tests/glsl/unused_interface_block_removal.glsl new file mode 100644 index 00000000..bc3307c3 --- /dev/null +++ b/tests/glsl/unused_interface_block_removal.glsl @@ -0,0 +1,30 @@ +uniform Color +{ + vec4 tint; +} global_color; + +#pragma MSP stage(vertex) +layout(location=0) in vec4 position; +layout(location=1) in vec4 color; +out VertexOut +{ + vec2 texcoord; +}; +out VertexOut2 +{ + vec4 color; +} vs_out; +void main() +{ + texcoord = position.xy*0.5+0.5; + vs_out.color = color*global_color.tint; + gl_Position = position; +} + +/* Expected output: vertex +layout(location=0) in vec4 position; +void main() +{ + gl_Position = position; +} +*/ -- 2.43.0