[Piglit] [PATCH 3/4] arb_fragment_layer_viewport: Add tests for not-written cases
Chris Forbes
chrisf at ijw.co.nz
Sat Jun 21 22:25:53 PDT 2014
Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
tests/all.py | 6 +++
.../layer-gs-no-write.shader_test | 51 ++++++++++++++++++++++
.../layer-no-gs.shader_test | 37 ++++++++++++++++
.../viewport-gs-no-write.shader_test | 51 ++++++++++++++++++++++
.../viewport-no-gs.shader_test | 37 ++++++++++++++++
5 files changed, 182 insertions(+)
create mode 100644 tests/spec/arb_fragment_layer_viewport/layer-gs-no-write.shader_test
create mode 100644 tests/spec/arb_fragment_layer_viewport/layer-no-gs.shader_test
create mode 100644 tests/spec/arb_fragment_layer_viewport/viewport-gs-no-write.shader_test
create mode 100644 tests/spec/arb_fragment_layer_viewport/viewport-no-gs.shader_test
diff --git a/tests/all.py b/tests/all.py
index f9f1125..39fca0e 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1569,6 +1569,12 @@ import_glsl_parser_tests(arb_fragment_coord_conventions,
'arb_fragment_coord_conventions'),
['compiler'])
+arb_fragment_layer_viewport = {}
+spec['ARB_fragment_layer_viewport'] = arb_fragment_layer_viewport
+add_shader_test_dir(arb_fragment_layer_viewport,
+ os.path.join(testsDir, 'spec', 'arb_fragment_layer_viewport'),
+ recursive=True)
+
ati_fragment_shader = {}
spec['ATI_fragment_shader'] = ati_fragment_shader
add_plain_test(ati_fragment_shader, 'ati-fs-bad-delete')
diff --git a/tests/spec/arb_fragment_layer_viewport/layer-gs-no-write.shader_test b/tests/spec/arb_fragment_layer_viewport/layer-gs-no-write.shader_test
new file mode 100644
index 0000000..37de834
--- /dev/null
+++ b/tests/spec/arb_fragment_layer_viewport/layer-gs-no-write.shader_test
@@ -0,0 +1,51 @@
+[require]
+GLSL >= 1.50
+GL_ARB_fragment_layer_viewport
+
+#
+# If the geometry stage makes no static assignment to gl_Layer,
+# the fragment stage will read zero.
+#
+# This test covers the case where a GS is present, but does not write gl_Layer.
+#
+
+[vertex shader]
+#version 150
+in vec4 piglit_vertex;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices=3) out;
+
+void main()
+{
+ for (int i = 0; i < 3; i++) {
+ gl_Position = gl_in[i].gl_Position;
+ EmitVertex();
+ }
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_fragment_layer_viewport: require
+
+void main()
+{
+ if (gl_Layer == 0)
+ gl_FragColor = vec4(0,1,0,0);
+ else
+ gl_FragColor = vec4(1,0,0,0);
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+draw rect -1 -1 2 2
+probe all rgb 0.0 1.0 0.0
diff --git a/tests/spec/arb_fragment_layer_viewport/layer-no-gs.shader_test b/tests/spec/arb_fragment_layer_viewport/layer-no-gs.shader_test
new file mode 100644
index 0000000..504e954
--- /dev/null
+++ b/tests/spec/arb_fragment_layer_viewport/layer-no-gs.shader_test
@@ -0,0 +1,37 @@
+[require]
+GLSL >= 1.50
+GL_ARB_fragment_layer_viewport
+
+#
+# If the geometry stage makes no static assignment to gl_Layer,
+# the fragment stage will read zero.
+#
+# This test covers the case where there is no GS present at all.
+#
+
+[vertex shader]
+#version 150
+in vec4 piglit_vertex;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_fragment_layer_viewport: require
+
+void main()
+{
+ if (gl_Layer == 0)
+ gl_FragColor = vec4(0,1,0,0);
+ else
+ gl_FragColor = vec4(1,0,0,0);
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+draw rect -1 -1 2 2
+probe all rgb 0.0 1.0 0.0
diff --git a/tests/spec/arb_fragment_layer_viewport/viewport-gs-no-write.shader_test b/tests/spec/arb_fragment_layer_viewport/viewport-gs-no-write.shader_test
new file mode 100644
index 0000000..6902195
--- /dev/null
+++ b/tests/spec/arb_fragment_layer_viewport/viewport-gs-no-write.shader_test
@@ -0,0 +1,51 @@
+[require]
+GLSL >= 1.50
+GL_ARB_fragment_layer_viewport
+
+#
+# If the geometry stage makes no static assignment to gl_ViewportIndex,
+# the fragment stage will read zero.
+#
+# This test covers the case where a GS is present, but does not write gl_ViewportIndex.
+#
+
+[vertex shader]
+#version 150
+in vec4 piglit_vertex;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices=3) out;
+
+void main()
+{
+ for (int i = 0; i < 3; i++) {
+ gl_Position = gl_in[i].gl_Position;
+ EmitVertex();
+ }
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_fragment_layer_viewport: require
+
+void main()
+{
+ if (gl_ViewportIndex == 0)
+ gl_FragColor = vec4(0,1,0,0);
+ else
+ gl_FragColor = vec4(1,0,0,0);
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+draw rect -1 -1 2 2
+probe all rgb 0.0 1.0 0.0
diff --git a/tests/spec/arb_fragment_layer_viewport/viewport-no-gs.shader_test b/tests/spec/arb_fragment_layer_viewport/viewport-no-gs.shader_test
new file mode 100644
index 0000000..4ac5e09
--- /dev/null
+++ b/tests/spec/arb_fragment_layer_viewport/viewport-no-gs.shader_test
@@ -0,0 +1,37 @@
+[require]
+GLSL >= 1.50
+GL_ARB_fragment_layer_viewport
+
+#
+# If the geometry stage makes no static assignment to gl_ViewportIndex,
+# the fragment stage will read zero.
+#
+# This test covers the case where there is no GS present at all.
+#
+
+[vertex shader]
+#version 150
+in vec4 piglit_vertex;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_fragment_layer_viewport: require
+
+void main()
+{
+ if (gl_ViewportIndex == 0)
+ gl_FragColor = vec4(0,1,0,0);
+ else
+ gl_FragColor = vec4(1,0,0,0);
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+draw rect -1 -1 2 2
+probe all rgb 0.0 1.0 0.0
--
2.0.0
More information about the Piglit
mailing list