From: Mikko Rasa Date: Sat, 6 Mar 2021 00:51:04 +0000 (+0200) Subject: Add some test cases for unused interface blocks X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=64b321995acbc4dee1f1be9e17ea161efa0b6bc9;p=libs%2Fgl.git Add some test cases for unused interface blocks --- 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; +} +*/