]> git.tdb.fi Git - libs/gl.git/commitdiff
Add some test cases for unused interface blocks
authorMikko Rasa <tdb@tdb.fi>
Sat, 6 Mar 2021 00:51:04 +0000 (02:51 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sat, 6 Mar 2021 00:51:04 +0000 (02:51 +0200)
tests/glsl/partially_unused_interface_block.glsl [new file with mode: 0644]
tests/glsl/unused_interface_block_removal.glsl [new file with mode: 0644]

diff --git a/tests/glsl/partially_unused_interface_block.glsl b/tests/glsl/partially_unused_interface_block.glsl
new file mode 100644 (file)
index 0000000..82b8b1d
--- /dev/null
@@ -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 (file)
index 0000000..bc3307c
--- /dev/null
@@ -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;
+}
+*/