[Piglit] [PATCH] Add test case to verify glDrawBuffer with different color buffer modes

Eric Anholt eric at anholt.net
Wed Jan 11 12:46:37 PST 2012


On Tue, 10 Jan 2012 11:48:13 -0800, Anuj Phogat <anuj.phogat at gmail.com> wrote:
> +enum piglit_result
> +piglit_display(void)
> +{
> +	bool pass = true;
> +	int i;
> +	GLfloat probe[4];
> +	for ( i = 0; i < sizeof(bufferlist)/sizeof(bufferlist[0]); i++) {

	for (i = 0; i < ARRAY_SIZE(bufferlist); i++) {

> +		/* Set current color */
> +		glColor4f(color[i][0], color[i][1], color[i][2], color[i][3]);

		glColor4fv(color[i]);

(that comment is useless)

> +		pass = piglit_check_gl_error(GL_NO_ERROR)
> +		       && pass;

Drop the extra newline.

> +		switch (bufferlist[i]) {
> +			case GL_FRONT_AND_BACK:

case statements are indented in line with the switch statement.

> +			case GL_BACK:
> +			case GL_FRONT:
> +			case GL_BACK_LEFT:
> +			case GL_FRONT_LEFT:
> +				glReadBuffer(bufferlist[i]);
> +				pass = piglit_probe_rect_rgba(20, 20, 50, 50,
> +							      color[i])
> +				       && pass;
> +				break;

These should probably verify that the other buffers are unmodified,
like how you handle GL_NONE.

> +			case GL_NONE:
> +				/* Drawing to a buffer GL_NONE should not
> +				 * modify any existing buffers
> +				 */
> +				glReadBuffer(GL_BACK_LEFT);
> +				pass = !piglit_probe_pixel_rgba_silent(25, 25,
> +								      color[i],
> +								      probe)
> +					&& pass;
> +				if (probe[0] == color[i][0] &&
> +				    probe[1] == color[i][1] &&
> +				    probe[2] == color[i][2] &&
> +				    probe[3] == color[i][3])

piglit_probe_pixel_rgba_silent() already did this comparison for you,
but better.  Use its result.
-------------- 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/20120111/cd0f7839/attachment.pgp>


More information about the Piglit mailing list