[Piglit] [PATCH v3] arb_fragment_layer_viewport: simple write tests
Chris Forbes
chrisf at ijw.co.nz
Tue Jun 24 20:52:23 PDT 2014
Reviewed-by: Chris Forbes <chrisf at ijw.co.nz>
On Wed, Jun 25, 2014 at 2:32 PM, Ilia Mirkin <imirkin at alum.mit.edu> 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. (Out-of-range
> values may have undefined results for viewports, so only test with valid
> values.)
>
> Similarly add tests that write layer/viewport in VS to make sure it
> appears properly in FS (as well as what happens when there's an
> intervening GS).
>
> 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)
>
> v2 -> v3:
> - only use valid viewport ids (even though all the hw appears to render with
> it properly, it's undefined in opengl)
> - add AMD_vertex_shader_viewport_index tests (totally untested, no mesa
> support at all)
> - add versions of AMD_vertex_shader_* where there's an intervening GS which
> is specified to just throw away the VS values (but softpipe asserts)
>
> .../layer-gs-write-simple.shader_test | 53 +++++++++++++++++
> .../layer-vs-gs-write-simple.shader_test | 64 +++++++++++++++++++++
> .../layer-vs-write-gs-no-write-simple.shader_test | 63 +++++++++++++++++++++
> .../layer-vs-write-simple.shader_test | 48 ++++++++++++++++
> .../viewport-gs-write-simple.shader_test | 55 ++++++++++++++++++
> .../viewport-vs-gs-write-simple.shader_test | 66 ++++++++++++++++++++++
> ...iewport-vs-write-gs-no-write-simple.shader_test | 62 ++++++++++++++++++++
> .../viewport-vs-write-simple.shader_test | 48 ++++++++++++++++
> 8 files changed, 459 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-gs-write-simple.shader_test
> create mode 100644 tests/spec/arb_fragment_layer_viewport/layer-vs-write-gs-no-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
> create mode 100644 tests/spec/arb_fragment_layer_viewport/viewport-vs-gs-write-simple.shader_test
> create mode 100644 tests/spec/arb_fragment_layer_viewport/viewport-vs-write-gs-no-write-simple.shader_test
> create mode 100644 tests/spec/arb_fragment_layer_viewport/viewport-vs-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-gs-write-simple.shader_test b/tests/spec/arb_fragment_layer_viewport/layer-vs-gs-write-simple.shader_test
> new file mode 100644
> index 0000000..aab8a5b
> --- /dev/null
> +++ b/tests/spec/arb_fragment_layer_viewport/layer-vs-gs-write-simple.shader_test
> @@ -0,0 +1,64 @@
> +[require]
> +GLSL >= 1.50
> +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 + 1;
> +}
> +
> +[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-gs-no-write-simple.shader_test b/tests/spec/arb_fragment_layer_viewport/layer-vs-write-gs-no-write-simple.shader_test
> new file mode 100644
> index 0000000..3dfc2c4
> --- /dev/null
> +++ b/tests/spec/arb_fragment_layer_viewport/layer-vs-write-gs-no-write-simple.shader_test
> @@ -0,0 +1,63 @@
> +[require]
> +GLSL >= 1.50
> +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;
> +}
> +
> +[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;
> + EmitVertex();
> + }
> +}
> +
> +[fragment shader]
> +#version 150
> +#extension GL_ARB_fragment_layer_viewport: require
> +
> +uniform int layer;
> +
> +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
> +
> +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..a1248a9
> --- /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 14
> +draw rect -1 0 1 1
> +
> +uniform int viewport 15
> +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-vs-gs-write-simple.shader_test b/tests/spec/arb_fragment_layer_viewport/viewport-vs-gs-write-simple.shader_test
> new file mode 100644
> index 0000000..53612f1
> --- /dev/null
> +++ b/tests/spec/arb_fragment_layer_viewport/viewport-vs-gs-write-simple.shader_test
> @@ -0,0 +1,66 @@
> +[require]
> +GLSL >= 1.50
> +GL_ARB_fragment_layer_viewport
> +GL_ARB_viewport_array
> +GL_AMD_vertex_shader_viewport_index
> +
> +[vertex shader]
> +#version 140
> +#extension GL_AMD_vertex_shader_viewport_index: enable
> +in vec4 piglit_vertex;
> +uniform int viewport;
> +
> +void main()
> +{
> + gl_Position = piglit_vertex;
> + gl_ViewportIndex = viewport + 1;
> +}
> +
> +[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 14
> +draw rect -1 0 1 1
> +
> +uniform int viewport 15
> +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-vs-write-gs-no-write-simple.shader_test b/tests/spec/arb_fragment_layer_viewport/viewport-vs-write-gs-no-write-simple.shader_test
> new file mode 100644
> index 0000000..faec9f0
> --- /dev/null
> +++ b/tests/spec/arb_fragment_layer_viewport/viewport-vs-write-gs-no-write-simple.shader_test
> @@ -0,0 +1,62 @@
> +[require]
> +GLSL >= 1.50
> +GL_ARB_fragment_layer_viewport
> +GL_AMD_vertex_shader_viewport_index
> +
> +[vertex shader]
> +#version 140
> +#extension GL_AMD_vertex_shader_viewport_index: enable
> +in vec4 piglit_vertex;
> +uniform int viewport;
> +
> +void main()
> +{
> + gl_Position = piglit_vertex;
> + gl_ViewportIndex = viewport;
> +}
> +
> +[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
> +
> +uniform int viewport;
> +
> +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
> +
> +uniform int viewport 0
> +draw rect -1 -1 1 1
> +
> +uniform int viewport 1
> +draw rect 0 -1 1 1
> +
> +uniform int viewport 14
> +draw rect -1 0 1 1
> +
> +uniform int viewport 15
> +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-vs-write-simple.shader_test b/tests/spec/arb_fragment_layer_viewport/viewport-vs-write-simple.shader_test
> new file mode 100644
> index 0000000..d0a3c7c
> --- /dev/null
> +++ b/tests/spec/arb_fragment_layer_viewport/viewport-vs-write-simple.shader_test
> @@ -0,0 +1,48 @@
> +[require]
> +GLSL >= 1.40
> +GL_ARB_fragment_layer_viewport
> +GL_AMD_vertex_shader_viewport_index
> +
> +[vertex shader]
> +#version 140
> +#extension GL_AMD_vertex_shader_viewport_index: enable
> +in vec4 piglit_vertex;
> +uniform int viewport;
> +
> +void main()
> +{
> + gl_Position = piglit_vertex;
> + gl_ViewportIndex = viewport;
> +}
> +
> +[fragment shader]
> +#version 140
> +#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 14
> +draw rect -1 0 1 1
> +
> +uniform int viewport 15
> +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