]> git.tdb.fi Git - libs/gl.git/blobdiff - tests/glsl/geometry_interface_block.glsl
Add a unit test framework and some tests for the GLSL compiler
[libs/gl.git] / tests / glsl / geometry_interface_block.glsl
diff --git a/tests/glsl/geometry_interface_block.glsl b/tests/glsl/geometry_interface_block.glsl
new file mode 100644 (file)
index 0000000..3934dd1
--- /dev/null
@@ -0,0 +1,85 @@
+uniform sampler2D tex;
+
+#pragma MSP stage(vertex)
+layout(location=0) in vec4 position;
+out VertexOut
+{
+       vec2 texcoord;
+} vs_out;
+void main()
+{
+       vs_out.texcoord = position.xy*0.5+0.5;
+       gl_Position = position;
+}
+
+#pragma MSP stage(geometry)
+layout(triangles) in;
+layout(triangles, max_vertices=3) out;
+out GeometryOut
+{
+       vec2 texcoord;
+} gs_out;
+void main()
+{
+       for(int i=0; i<3; ++i)
+       {
+               gs_out.texcoord = vs_out[i].texcoord;
+               passthrough[i];
+               EmitVertex();
+       }
+}
+
+#pragma MSP stage(fragment)
+layout(location=0) out vec4 frag_color;
+void main()
+{
+       frag_color = texture(tex, gs_out.texcoord);
+}
+
+/* Expected output: vertex
+layout(location=0) in vec4 position;
+out VertexOut
+{
+       vec2 texcoord;
+} vs_out;
+void main()
+{
+       vs_out.texcoord = position.xy*0.5+0.5;
+       gl_Position = position;
+}
+*/
+
+/* Expected output: geometry
+layout(triangles) in;
+layout(triangles, max_vertices=3) out;
+out GeometryOut
+{
+       vec2 texcoord;
+} gs_out;
+in VertexOut
+{
+       vec2 texcoord;
+} vs_out[];
+void main()
+{
+       for(int i = 0; i<3; ++i)
+       {
+               gs_out.texcoord = vs_out[i].texcoord;
+               gl_Position = gl_in[i].gl_Position;
+               EmitVertex();
+       }
+}
+*/
+
+/* Expected output: fragment
+uniform sampler2D tex;
+layout(location=0) out vec4 frag_color;
+in GeometryOut
+{
+       vec2 texcoord;
+} gs_out;
+void main()
+{
+       frag_color = texture(tex, gs_out.texcoord);
+}
+*/