[Piglit] [PATCH 2/4] glsl-1.50: Flat shading with undefined but ignored colors in gs.
Fabian Bieler
fabianbieler at fastmail.fm
Mon Mar 3 00:38:25 PST 2014
In this test the geometry shader emits two flat shaded triangles and only
writes the color for the provoking vertex.
In this case the undefined values should be ignored and thus should
not affect the fragment stage.
Signed-off-by: Fabian Bieler <fabianbieler at fastmail.fm>
---
.../geometry/undefined-ignored-color.shader_test | 64 ++++++++++++++++++++++
1 file changed, 64 insertions(+)
create mode 100644 tests/spec/glsl-1.50/execution/geometry/undefined-ignored-color.shader_test
diff --git a/tests/spec/glsl-1.50/execution/geometry/undefined-ignored-color.shader_test b/tests/spec/glsl-1.50/execution/geometry/undefined-ignored-color.shader_test
new file mode 100644
index 0000000..e0acffa
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/geometry/undefined-ignored-color.shader_test
@@ -0,0 +1,64 @@
+# Draw two flat shaded triangles and only write the color for the provoking
+# vertex.
+#
+# In this case the undefined values should be ignored and thus should
+# not affect the fragment stage.
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+in vec4 vertex;
+
+void main()
+{
+ gl_Position = vertex;
+}
+
+[geometry shader]
+layout(lines_adjacency) in;
+layout(triangle_strip, max_vertices = 6) out;
+
+flat out vec4 color;
+
+void main()
+{
+ gl_Position = gl_in[0].gl_Position;
+ /* no color write */
+ EmitVertex();
+ gl_Position = gl_in[1].gl_Position;
+ /* no color write */
+ EmitVertex();
+ gl_Position = gl_in[2].gl_Position;
+ color = vec4(0, 1, 0, 1);
+ EmitVertex();
+ EndPrimitive();
+
+ gl_Position = gl_in[2].gl_Position;
+ /* no color write */
+ EmitVertex();
+ gl_Position = gl_in[1].gl_Position;
+ /* no color write */
+ EmitVertex();
+ gl_Position = gl_in[3].gl_Position;
+ color = vec4(0, 1, 0, 1);
+ EmitVertex();
+}
+
+[fragment shader]
+flat in vec4 color;
+
+void main()
+{
+ gl_FragColor = color;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+-1.0 1.0
+ 1.0 1.0
+
+[test]
+draw arrays GL_LINES_ADJACENCY 0 4
+probe all rgb 0.0 1.0 0.0
--
1.8.3.2
More information about the Piglit
mailing list