[Piglit] [PATCH v2] arb_fragment_layer_viewport: simple write tests
Ilia Mirkin
imirkin at alum.mit.edu
Tue Jun 24 17:08:38 PDT 2014
With no layered fb and unconfigured viewports, the values of
gl_Layer/gl_ViewportIndex shouldn't matter for rendering. Make sure that
they're being passed through correctly from GS to FS.
Similarly add a test that writes layer in VS and checks it in FS.
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
v1 -> v2:
- use passthrough vertex shader
- changed tests to be 4 draws instead of 5, drawing each into separate
quadrants and doing one check at the end. should make it easier to identify
issues
- added a vs test that uses AMD_vertex_shader_layer (tested using softpipe)
I didn't maintain the R-b's on the v1 due to the various changes.
.../layer-gs-write-simple.shader_test | 53 +++++++++++++++++++++
.../layer-vs-write-simple.shader_test | 48 +++++++++++++++++++
.../viewport-gs-write-simple.shader_test | 55 ++++++++++++++++++++++
3 files changed, 156 insertions(+)
create mode 100644 tests/spec/arb_fragment_layer_viewport/layer-gs-write-simple.shader_test
create mode 100644 tests/spec/arb_fragment_layer_viewport/layer-vs-write-simple.shader_test
create mode 100644 tests/spec/arb_fragment_layer_viewport/viewport-gs-write-simple.shader_test
diff --git a/tests/spec/arb_fragment_layer_viewport/layer-gs-write-simple.shader_test b/tests/spec/arb_fragment_layer_viewport/layer-gs-write-simple.shader_test
new file mode 100644
index 0000000..bfafcb1
--- /dev/null
+++ b/tests/spec/arb_fragment_layer_viewport/layer-gs-write-simple.shader_test
@@ -0,0 +1,53 @@
+[require]
+GLSL >= 1.50
+GL_ARB_fragment_layer_viewport
+
+[vertex shader passthrough]
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices=3) out;
+uniform int layer;
+
+void main()
+{
+ for (int i = 0; i < 3; i++) {
+ gl_Position = gl_in[i].gl_Position;
+ gl_Layer = layer;
+ EmitVertex();
+ }
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_fragment_layer_viewport: require
+
+uniform int layer;
+
+void main()
+{
+ if (gl_Layer == layer)
+ 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
+
+uniform int layer 0
+draw rect -1 -1 1 1
+
+uniform int layer 1
+draw rect 0 -1 1 1
+
+uniform int layer 10000
+draw rect -1 0 1 1
+
+uniform int layer -10000
+draw rect 0 0 1 1
+
+probe all rgb 0.0 1.0 0.0
diff --git a/tests/spec/arb_fragment_layer_viewport/layer-vs-write-simple.shader_test b/tests/spec/arb_fragment_layer_viewport/layer-vs-write-simple.shader_test
new file mode 100644
index 0000000..fe453fb
--- /dev/null
+++ b/tests/spec/arb_fragment_layer_viewport/layer-vs-write-simple.shader_test
@@ -0,0 +1,48 @@
+[require]
+GLSL >= 1.40
+GL_ARB_fragment_layer_viewport
+GL_AMD_vertex_shader_layer
+
+[vertex shader]
+#version 140
+#extension GL_AMD_vertex_shader_layer: enable
+in vec4 piglit_vertex;
+uniform int layer;
+
+void main()
+{
+ gl_Position = piglit_vertex;
+ gl_Layer = layer;
+}
+
+[fragment shader]
+#version 140
+#extension GL_ARB_fragment_layer_viewport: require
+
+uniform int layer;
+
+void main()
+{
+ if (gl_Layer == layer)
+ 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
+
+uniform int layer 0
+draw rect -1 -1 1 1
+
+uniform int layer 1
+draw rect 0 -1 1 1
+
+uniform int layer 10000
+draw rect -1 0 1 1
+
+uniform int layer -10000
+draw rect 0 0 1 1
+
+probe all rgb 0.0 1.0 0.0
diff --git a/tests/spec/arb_fragment_layer_viewport/viewport-gs-write-simple.shader_test b/tests/spec/arb_fragment_layer_viewport/viewport-gs-write-simple.shader_test
new file mode 100644
index 0000000..fd0ac4b
--- /dev/null
+++ b/tests/spec/arb_fragment_layer_viewport/viewport-gs-write-simple.shader_test
@@ -0,0 +1,55 @@
+[require]
+GLSL >= 1.50
+GL_ARB_fragment_layer_viewport
+GL_ARB_viewport_array
+
+[vertex shader passthrough]
+
+[geometry shader]
+#version 150
+#extension GL_ARB_viewport_array: enable
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices=3) out;
+uniform int viewport;
+
+void main()
+{
+ for (int i = 0; i < 3; i++) {
+ gl_Position = gl_in[i].gl_Position;
+ gl_ViewportIndex = viewport;
+ EmitVertex();
+ }
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_fragment_layer_viewport: require
+
+uniform int viewport;
+
+void main()
+{
+ if (gl_ViewportIndex == viewport)
+ 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
+
+uniform int viewport 0
+draw rect -1 -1 1 1
+
+uniform int viewport 1
+draw rect 0 -1 1 1
+
+uniform int viewport 10000
+draw rect -1 0 1 1
+
+uniform int viewport -10000
+draw rect 0 0 1 1
+
+probe all rgb 0.0 1.0 0.0
--
1.8.5.5
More information about the Piglit
mailing list