[Piglit] [PATCH 1/2] Add a test of tessellation of transform feedback primitives.
Eric Anholt
eric at anholt.net
Wed Nov 9 17:38:39 PST 2011
On Tue, 8 Nov 2011 16:03:39 -0800, Paul Berry <stereotype441 at gmail.com> wrote:
> According to the OpenGL 3.0 spec (section 2.15: Transform Feedback):
>
> "When quads and polygons are provided to transform feedback with a
> primitive mode of TRIANGLES, they will be tessellated and recorded
> as triangles (the order of tessellation within a primitive is
> undefined). Individual lines or triangles of a strip or fan
> primitive will be extracted and recorded separately."
>
> This test verifies the correctness of the tessellation and extraction
> from strips and fans. It does so by feeding the output of transform
> feedback back into the GL pipeline and verifying that the rendered
> image is the same.
>
> Verified using the nVidia proprietary driver for Linux. The nVidia
> driver passes all tests except "tessellation polygon flat_last",
> "tessellation quad_strip flat_last", and "tessellation quads
> flat_last". These tests fail because the order in which the driver
> tessellates polygons and quads fails to preserve the correct provoking
> vertex, leading to different results from flatshading.
Ensuring that provoking vertex is respected seems like a reasonable
requirement, and at least our hardware is built to support it it looks
like.
I like the test idea, and have just a few little style comments. I find
the vertex transformations a bit unintuitive compared to most of our
tests, but I'm not really worried.
> +#include "piglit-util.h"
> +
> +#ifndef M_PI
> +#define M_PI 3.141592653589793
> +#endif
M_PI?
> +#define BUFFER_SIZE 20
> +
> +#define Elements(array) (sizeof(array)/sizeof(array[0]))
There's ARRAY_SIZE available so you don't have to redefine this.
> +/**
> + * Check that two strips of the window match. Strips are numbered
> + * from the top from 0 to 3.
> + */
> +static GLboolean
> +match_strips(int reference, int compare)
> +{
> + int reference_offset = (3 - reference) * (piglit_height / 4);
> + int compare_offset = (3 - compare) * (piglit_height / 4);
> + int x, y;
> + for (x = 0; x < piglit_width; ++x) {
> + for (y = 0; y < piglit_height/4; ++y) {
> + float probed[4];
> + glReadPixels(x, y + reference_offset, 1, 1,
> + GL_RGBA, GL_FLOAT, &probed);
> + if (!piglit_probe_pixel_rgba(x, y + compare_offset,
> + probed))
> + return GL_FALSE;
> + }
> + }
> + return GL_TRUE;
> +}
It would be nice if you could use piglit_probe_rect_halves_equal_rgba()
or a derivative here. glReadPixels()ing each pixel one by one sucks for
performance.
> + printf("Test requires GL_EXT_provoking_vertex "
> + "or GL_ARB_provoking_vertex\n");
> + piglit_report_result(PIGLIT_SKIP);
> + exit(1);
piglit_report_result() implies exit()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20111109/1db1d646/attachment.pgp>
More information about the Piglit
mailing list