[Piglit] [PATCH 1/2] getteximage-targets: test glGetTexImage with all texture targets

Eric Anholt eric at anholt.net
Sat Dec 22 00:25:45 PST 2012


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

The subject says all texture targets, but how about texture rectangles?

(Not that they're really different from the getteximage implementation
perspective)


> +enum piglit_result
> +piglit_display(void)
> +{
> +	puts("got into unreachable code");

Everywhere else we've just been putting /* UNREACHABLE */ instead of the
puts.

> +static void init_layer_data(GLubyte *data)
> +{
> +	int x, y, i, j;
> +
> +	for (x = 0; x < 32; x += 4) {
> +		for (y = 0; y < 32; y += 4) {
> +			int r = rand() & 0xff;
> +			int g = rand() & 0xff;
> +			int b = rand() & 0xff;
> +			int a = rand() & 0xff;

Please pick a simple function of x and y instead of rand.

> +			/* each 4x4 block constains only one color */

Is this for S3TC blocksize?  FXT1 is 8x4 blocksize, which might be worth
testing.  I don't really care much though.

> +	for (i = 0; i < num_elements; ++i) {
> +		if (abs((int)data[i] - (int)expected[i]) > 8) {
> +			printf("GetTexImage() returns incorrect data in byte %i for layer %i\n",

Tolerance of 8?  I guess this is for DXT1 where things are getting
packed to 565?

> +void piglit_init(int argc, char **argv)
> +{
> +	int i;
> +	GLenum target = GL_TEXTURE_2D;
> +	GLenum internalformat = GL_RGBA8;
> +	GLubyte data[18][4096], data2[18][4096];

It would be nice to have a tex_width/height/depth #define or variables
used throughout this test.  I know I often want to tweak those values
when investigating tests.

> +	piglit_require_extension("GL_EXT_texture_compression_s3tc");

Even if s3tc isn't being tested?

> +	piglit_gen_ortho_projection(0.0, 1.0, 0.0, 1.0, -2.0, 6.0, GL_FALSE);

Does this ever get used?

-------------- 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/20121222/416ec083/attachment.pgp>


More information about the Piglit mailing list