[Piglit] [PATCH] arb_texture_buffer_range: add initial tests (dlist, errors, ranges)

Eric Anholt eric at anholt.net
Sat Jan 12 14:00:43 PST 2013


christoph.bumiller at speed.at writes:
> diff --git a/tests/spec/arb_texture_buffer_range/errors.c b/tests/spec/arb_texture_buffer_range/errors.c
> new file mode 100644
> index 0000000..2c0d5ce
> --- /dev/null
> +++ b/tests/spec/arb_texture_buffer_range/errors.c
> @@ -0,0 +1,136 @@

> +	/* If <offset> is negative or if <size> is
> +	 * less than or equal to zero or if <offset> + <size> is greater than
> +	 * the value of BUFFER_SIZE for the buffer bound to <target>, of if
> +	 * <offset> is not an integer multiple of
> +	 * TEXTURE_BUFFER_OFFSET_ALIGNMENT, then the error INVALID_VALUE
> +	 * is generated.
> +	 */

I don't see testing of a positive non-aligned offset, or of a negative
size.  Both seem like easy bugs to have.

> +	glTexBufferRange(GL_TEXTURE_BUFFER, GL_RGBA8, bo, 0, 4);
> +	if (!piglit_check_gl_error(GL_INVALID_VALUE))
> +		piglit_report_result(PIGLIT_FAIL);
> +
> +	glBufferData(GL_TEXTURE_BUFFER, TBO_SIZE, NULL, GL_STATIC_DRAW);
> +
> +	glTexBufferRange(GL_TEXTURE_BUFFER, GL_RGBA8, bo, -align, 4);
> +	if (!piglit_check_gl_error(GL_INVALID_VALUE))
> +		piglit_report_result(PIGLIT_FAIL);
> +
> +	glTexBufferRange(GL_TEXTURE_BUFFER, GL_RGBA8, bo, 0, 0);
> +	if (!piglit_check_gl_error(GL_INVALID_VALUE))
> +		piglit_report_result(PIGLIT_FAIL);
> +
> +	glTexBufferRange(GL_TEXTURE_BUFFER, GL_RGBA8, bo,
> +	                 align, TBO_SIZE - align);
> +	if (!piglit_check_gl_error(GL_NO_ERROR)) {
> +		fprintf(stderr, "glTexBufferRange failed\n");
> +		piglit_report_result(PIGLIT_FAIL);
> +	}
> +	glGetTexLevelParameteriv(GL_TEXTURE_BUFFER, 0, GL_TEXTURE_BUFFER_OFFSET,
> +	                         &value[0]);
> +	glGetTexLevelParameteriv(GL_TEXTURE_BUFFER, 0, GL_TEXTURE_BUFFER_SIZE,
> +	                         &value[1]);
> +	if (value[0] != align || value[1] != TBO_SIZE - align) {
> +		fprintf(stderr, "GL_TEXTURE_BUFFER_OFFSET/SIZE returned %i/%i, "
> +		        "expected %i/%i\n",
> +		        value[0], value[1], align, TBO_SIZE - align);
> +		piglit_report_result(PIGLIT_FAIL);
> +	}

> diff --git a/tests/spec/arb_texture_buffer_range/not-supported.c b/tests/spec/arb_texture_buffer_range/not-supported.c
> new file mode 100644
> index 0000000..9ad0b1f
> --- /dev/null
> +++ b/tests/spec/arb_texture_buffer_range/not-supported.c
> +/**
> + * @file not-supported.c
> + *
> + * Check that glTexBufferRange generates GL_INVALID_OPERATION if the extension
> + * is not supported.
> + */

I'm pretty sure that calling something you glXGetProcAddressed that
isn't supported can just crash on you.  Regardless, piglit-dispatch is
going to get in your way here I think.

> diff --git a/tests/spec/arb_texture_buffer_range/ranges.c b/tests/spec/arb_texture_buffer_range/ranges.c
> new file mode 100644
> index 0000000..e982efd
> --- /dev/null
> +++ b/tests/spec/arb_texture_buffer_range/ranges.c

> +	"  int pos = int(gl_FragCoord.x) + int(gl_FragCoord.y) * 64;\n"

Was this intended to be "* 64", or "* 32" (i.e. WIN_WIDTH)

> +	"  bool ok = texelFetch(buf, pos).r == expected;\n"
> +	"  gl_FragColor = ok ?\n"
> +	"     vec4(0.0, 1.0, 0.0, 0.0) : vec4(1.0, 0.0, 0.0, 0.0);\n"

That's a pretty convoluted way to avoid an if statement :P

> +int
> +main(int argc, char *argv[])
> +{
> +	struct piglit_gl_test_config config;
> +
> +	piglit_gl_test_config_init(&config);
> +
> +	config.init = piglit_init;
> +	config.display = piglit_display;
> +
> +	config.supports_gl_compat_version = 10;

supports_gl_core_version, too?

I think you could use the usual macros to generate the main() function,
since you don't have anything special here that I can see.

> +	config.window_width = WIN_WIDTH;
> +	config.window_height = WIN_HEIGHT;
> +	config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_ALPHA;
> +
> +	piglit_gl_test_run(argc, argv, &config);
> +
> +	assert(0);
> +	return 0;
> +}
-------------- 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/20130112/f0baa1fe/attachment.pgp>


More information about the Piglit mailing list