[Piglit] [PATCH 2/2] nv_fill_rectangle: add test

Ilia Mirkin imirkin at alum.mit.edu
Thu Mar 23 16:44:39 UTC 2017


On Thu, Mar 23, 2017 at 11:46 AM, Lyude <lyude at redhat.com> wrote:
> This adds a basic shader test for the GL_NV_fill_rectangle extension.
> The test simply draws a single prim with the polygon mode set to
> GL_FILL_RECTANGLE_NV and checks that the prim was rasterized as a full
> rectangle, along with checking that the rectangle only occupies the
> space we gave it in it's vertex data.
>
> Signed-off-by: Lyude <lyude at redhat.com>
> ---
>  .../rectangle-from-triangular-prim.shader_test     | 24 ++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>  create mode 100644 tests/spec/nv_fill_rectangle/execution/rectangle-from-triangular-prim.shader_test
>
> diff --git a/tests/spec/nv_fill_rectangle/execution/rectangle-from-triangular-prim.shader_test b/tests/spec/nv_fill_rectangle/execution/rectangle-from-triangular-prim.shader_test
> new file mode 100644
> index 0000000..24e330a
> --- /dev/null
> +++ b/tests/spec/nv_fill_rectangle/execution/rectangle-from-triangular-prim.shader_test
> @@ -0,0 +1,24 @@
> +[require]
> +GLSL >= 1.10
> +GL_NV_fill_rectangle
> +
> +[vertex shader passthrough]
> +
> +[fragment shader]
> +void main() { gl_FragColor = vec4(1.0); }

I think we usually format this as

void main() {
  gl_FragColor = vec4(0, 1, 0, 1);
}

That way the output is green (i.e. good).

> +
> +[vertex data]
> +piglit_vertex/float/3
> + 0.0  0.5  0.0
> + 0.5 -0.5  0.0
> +-0.5 -0.5  0.0
> +
> +[test]
> +clear color 0.0 0.0 0.0 0.0

Usually use a clear color of 0.2 for all channels to distinguish
between black coming in some other weird way.

> +clear
> +
> +polygon mode GL_FRONT_AND_BACK GL_FILL_RECTANGLE_NV
> +draw arrays GL_TRIANGLE_FAN 0 3

GL_TRIANGLES is probably good enough here.

Also please add a separate test for points and lines. Aaaand... sorry
to do this to you, but please also add a test with a geometry shader
that outputs triangles, points, and lines (i.e. 3 in addition to the 2
additional ones from before). Aaaaand three with tessellation, with
both point mode and without, and also isolines (i.e. where the tess
stage outputs points and connected primitives which are triangles and
lines).

So that's 9 piglits in total, counting this one. All can be done with
shader_tests.

It should mostly be easy, just a little tedious. On the bright side,
you'll learn a lot about the various shader stages.

> +
> +relative probe rect rgb (0.25, 0.26, 0.50, 0.49) (1.0, 1.0, 1.0, 1.0)

I'd recommend making the X also 0.26, and make the width/height 0.48
to give some rasterization margin on both sides. Don't want this to
all of a sudden fail with a weird window size.

> +probe rgb 0 0 0.0 0.0 0.0
> --
> 2.9.3
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list