[Piglit] [PATCH 1/2] getteximage-targets: test glGetTexImage with all texture targets
Marek Olšák
maraeo at gmail.com
Sat Dec 22 04:42:31 PST 2012
On Sat, Dec 22, 2012 at 9:25 AM, Eric Anholt <eric at anholt.net> wrote:
> 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)
Ah, I forgot about texture rectangles.
>
>
>> +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.
Yes, it's for S3TC.
>
>> + 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?
Yes, that's the reason.
>
>> +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.
Will do.
>
>> + 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?
You're right. It doesn't.
I'll send a new patch.
Marek
More information about the Piglit
mailing list