[Piglit] [PATCH 1/5] gles2: add sanity test

Eric Anholt eric at anholt.net
Wed Dec 19 10:56:31 PST 2012


Tom Gall <tom.gall at linaro.org> writes:

> new tests/spec/gles-2.0 directory and infrastructure to build
>   initial testcase and add gles-2.0 as part of all.tests
>
> new gles2 sanity test which very simply renders a triangle fan and
>   validates it was rendered correctly via
>   piglit_probe_rect_rgba

Given that there will be many tests that happen to just render a solid
color with a vertex array (lots of the shader_runner tests that test
simple math on uniforms will do so), I don't really see the point of
this test.  I'll still throw in some style comments so that future tests
can need less review.

> +    config.requires_displayed_window = true;

Huh?  Why?

> +char fragment_shader [] =
> +"precision mediump float;\n"
> +"void main()\n"
> +"{\n"
> +"	gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n"
> +"}";

Piglit test convention is to draw green for things that should be seen
(or blue as a second color) while red is for things that shouldn't be
seen.

> +	/* check that the square was rendered correctly */
> +	if (!piglit_probe_rect_rgba(80,50,159,97, red))
> +		return PIGLIT_FAIL;
> +
> +	/* check that the remaining area is black */
> +	if (!piglit_probe_rect_rgba(0,0,320,49, black))
> +		return PIGLIT_FAIL;
> +	if (!piglit_probe_rect_rgba(0,50,79,98, black))
> +		return PIGLIT_FAIL;
> +	if (!piglit_probe_rect_rgba(240,50,80,98, black))
> +		return PIGLIT_FAIL;
> +	if (!piglit_probe_rect_rgba(0,150,320,49, black))
> +		return PIGLIT_FAIL;

Please use math on piglit_width/piglit_height instead of magic numbers.

> +	vert=piglit_compile_shader_text(GL_VERTEX_SHADER,vertex_shader);
> +	frag=piglit_compile_shader_text(GL_FRAGMENT_SHADER,fragment_shader);

Whitespace around '=', and a space after ','

> +enum piglit_result
> +piglit_display(void)
> +{
> +	enum piglit_result result;
> +	GLfloat vVertices[] = { 0.5, -0.5, 0.0,
> +							0.5, 0.5, 0.0,
> +							-0.5, 0.5, 0.0,
> +							-0.5, -0.5, 0.0 };

Something terrible happened to your indentation here.  Also, generally
use words_with_underscores for identifiers as opposed to camelCase.
-------------- 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/20121219/ebd8ee4f/attachment.pgp>


More information about the Piglit mailing list