[Piglit] [PATCH] attribs: new generic extendable test for immediate-mode style commands

Eric Anholt eric at anholt.net
Mon Nov 12 17:02:57 PST 2012


Marek Olšák <maraeo at gmail.com> writes:

> This covers some commands from GL2, GL3 (glVertexAttribI*)
> and GL_ARB_vertex_type_2_10_10_10_rev.
>
> Vertex arrays, immediate mode and display lists are tested.
>
> Adding test cases for GL_ARB_vertex_attrib_64bit should be easy.

I haven't actually reviewed all the code.  The DEFINE_TEST stuff looks
pretty messy, but I don't have any concrete suggestions for
improvements.

> +static GLboolean test(int x, int y, const char *shaderfunc,
> +		      unsigned mask, unsigned type, unsigned mode,
> +		      void (*attrib)(float x, float y, float z, float w),
> +		      const char *info)
> +{
> +	static const char *templ = {
> +		"%s \n"
> +		"#extension GL_ARB_explicit_attrib_location : require \n"
> +		"layout(location = 1) in %s attr; \n"
> +		"void main() { \n"
> +		"  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; \n"
> +		"  gl_FrontColor = (%s) * vec4(1.0, 1.0, 1.0, 0.5); \n"
> +		"} \n"
> +	};

For others reviewing this code, I was surprised to see this was how
integer was tested:

DEFINE_TEST(glVertexAttribI4ui,, (1, UI(x), UI(y), UI(z), UI(w)),
	    "vec4(attr) * vec4(1.0/4294967295.0)",		RGBA, UINT, "")

It looks reasonable to me, in the end.

> +	GLuint prog, vs;
> +	GLboolean pass = GL_TRUE;

Some day I'm going to just sed job to "bool pass = true;"

That's about it.  The test at least gets my acked-by.  We really need
this coverage.

-------------- 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/20121112/e2053a35/attachment.pgp>


More information about the Piglit mailing list