[Piglit] [PATCH] arb_fragment_layer_viewport: simple write tests
Ian Romanick
idr at freedesktop.org
Mon Jun 23 12:02:07 PDT 2014
On 06/23/2014 06:52 AM, Ilia Mirkin wrote:
> 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.
This test is
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
It would be really good to have a separate shader objects version of the
test too. I suspect Mesa may have some additional difficulties with
that case...
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>
> These apply on top of ChrisF's series.
>
> .../layer-gs-write-simple.shader_test | 70 +++++++++++++++++++++
> .../viewport-gs-write-simple.shader_test | 72 ++++++++++++++++++++++
> 2 files changed, 142 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/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..1d27dde
> --- /dev/null
> +++ b/tests/spec/arb_fragment_layer_viewport/layer-gs-write-simple.shader_test
> @@ -0,0 +1,70 @@
> +[require]
> +GLSL >= 1.50
> +GL_ARB_fragment_layer_viewport
> +
> +[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;
> +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 2 2
> +probe all rgb 0.0 1.0 0.0
> +
> +clear
> +uniform int layer 1
> +draw rect -1 -1 2 2
> +probe all rgb 0.0 1.0 0.0
> +
> +clear
> +uniform int layer 10
> +draw rect -1 -1 2 2
> +probe all rgb 0.0 1.0 0.0
> +
> +clear
> +uniform int layer 100
> +draw rect -1 -1 2 2
> +probe all rgb 0.0 1.0 0.0
> +
> +clear
> +uniform int layer -1
> +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-write-simple.shader_test b/tests/spec/arb_fragment_layer_viewport/viewport-gs-write-simple.shader_test
> new file mode 100644
> index 0000000..06abd96
> --- /dev/null
> +++ b/tests/spec/arb_fragment_layer_viewport/viewport-gs-write-simple.shader_test
> @@ -0,0 +1,72 @@
> +[require]
> +GLSL >= 1.50
> +GL_ARB_fragment_layer_viewport
> +GL_ARB_viewport_array
> +
> +[vertex shader]
> +#version 150
> +in vec4 piglit_vertex;
> +
> +void main()
> +{
> + gl_Position = piglit_vertex;
> +}
> +
> +[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 2 2
> +probe all rgb 0.0 1.0 0.0
> +
> +clear
> +uniform int viewport 1
> +draw rect -1 -1 2 2
> +probe all rgb 0.0 1.0 0.0
> +
> +clear
> +uniform int viewport 10
> +draw rect -1 -1 2 2
> +probe all rgb 0.0 1.0 0.0
> +
> +clear
> +uniform int viewport 100
> +draw rect -1 -1 2 2
> +probe all rgb 0.0 1.0 0.0
> +
> +clear
> +uniform int viewport -1
> +draw rect -1 -1 2 2
> +probe all rgb 0.0 1.0 0.0
>
More information about the Piglit
mailing list