[Piglit] [PATCH 3/3] ARB_copy_image: Test different combinations of texture formats

Jason Ekstrand jason at jlekstrand.net
Mon Jun 30 09:52:43 PDT 2014


On Sat, Jun 28, 2014 at 6:28 AM, Brian Paul <brianp at vmware.com> wrote:

> On 06/27/2014 05:31 PM, Jason Ekstrand wrote:
>
>> This tests glCopyTexSubImage on all of the allowed combinations of
>> internal
>> texture formats.
>>
>> Signed-off-by: Jason Ekstrand <jason.ekstrand at intel.com>
>> ---
>>   tests/all.py                                |  77 +++++++
>>   tests/spec/arb_copy_image/CMakeLists.gl.txt |   1 +
>>   tests/spec/arb_copy_image/formats.c         | 334
>> ++++++++++++++++++++++++++++
>>   3 files changed, 412 insertions(+)
>>   create mode 100644 tests/spec/arb_copy_image/formats.c
>>
>> diff --git a/tests/all.py b/tests/all.py
>> index 8235e6e..02fc9d2 100644
>> --- a/tests/all.py
>> +++ b/tests/all.py
>> @@ -3188,6 +3188,83 @@ add_concurrent_test(arb_copy_image,
>> 'arb_copy_image-targets GL_TEXTURE_3D 32 32
>>   add_concurrent_test(arb_copy_image, 'arb_copy_image-targets
>> GL_TEXTURE_3D 32 32 17 GL_TEXTURE_CUBE_MAP_ARRAY 16 16 18 11 5 2 5 9 7 5 7
>> 11')
>>   add_concurrent_test(arb_copy_image, 'arb_copy_image-targets
>> GL_TEXTURE_3D 32 32 17 GL_TEXTURE_3D 32 16 18 11 5 2 5 9 7 14 7 11')
>>
>> +def arb_copy_image_add_format_tests(formats):
>> +    for src_format in formats:
>> +        for dst_format in formats:
>> +            add_concurrent_test(arb_copy_image,'arb_copy_image-formats
>> ' +
>> +                                src_format + ' ' + dst_format)
>> +
>> +arb_copy_image_add_format_tests([
>> +    'GL_R8UI',
>> +    'GL_R8I',
>> +    'GL_R8',
>> +    'GL_R8_SNORM',
>> +])
>> +arb_copy_image_add_format_tests([
>> +    'GL_RG8UI',
>> +    'GL_RG8I',
>> +    'GL_RG8',
>> +    'GL_RG8_SNORM',
>> +    'GL_R16UI',
>> +    'GL_R16I',
>> +    'GL_R16',
>> +    'GL_R16_SNORM',
>> +])
>> +arb_copy_image_add_format_tests([
>> +    'GL_RGB8UI',
>> +    'GL_RGB8I',
>> +    'GL_RGB8',
>> +    'GL_RGB8_SNORM',
>> +])
>> +arb_copy_image_add_format_tests([
>> +    'GL_RGBA8UI',
>> +    'GL_RGBA8I',
>> +    'GL_RGBA8',
>> +    'GL_RGBA8_SNORM',
>> +    'GL_RG16UI',
>> +    'GL_RG16I',
>> +    'GL_RG16',
>> +    'GL_RG16_SNORM',
>> +    'GL_R32F',
>> +])
>> +arb_copy_image_add_format_tests([
>> +    'GL_RGB16UI',
>> +    'GL_RGB16I',
>> +    'GL_RGB16',
>> +    'GL_RGB16_SNORM',
>> +])
>> +arb_copy_image_add_format_tests([
>> +    'GL_RGBA16UI',
>> +    'GL_RGBA16I',
>> +    'GL_RGBA16',
>> +    'GL_RGBA16_SNORM',
>> +    'GL_RG32UI',
>> +    'GL_RG32I',
>> +    'GL_RG32F',
>> +    'GL_COMPRESSED_RGB_S3TC_DXT1_EXT',
>> +    'GL_COMPRESSED_SRGB_S3TC_DXT1_EXT',
>> +    'GL_COMPRESSED_RGBA_S3TC_DXT1_EXT',
>> +    'GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT',
>> +    'GL_COMPRESSED_RED_RGTC1',
>> +    'GL_COMPRESSED_SIGNED_RED_RGTC1',
>> +])
>> +arb_copy_image_add_format_tests([
>> +    'GL_RGB32UI',
>> +    'GL_RGB32I',
>> +    'GL_RGB32F',
>> +])
>> +arb_copy_image_add_format_tests([
>> +    'GL_RGBA32UI',
>> +    'GL_RGBA32I',
>> +    'GL_RGBA32F',
>> +    'GL_COMPRESSED_RGBA_S3TC_DXT3_EXT',
>> +    'GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT',
>> +    'GL_COMPRESSED_RGBA_S3TC_DXT5_EXT',
>> +    'GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT',
>> +    'GL_COMPRESSED_RG_RGTC2',
>> +    'GL_COMPRESSED_SIGNED_RG_RGTC2',
>> +])
>> +
>>   arb_half_float_vertex = {}
>>   spec['ARB_half_float_vertex'] = arb_half_float_vertex
>>   add_plain_test(arb_half_float_vertex, 'draw-vertices-half-float')
>> diff --git a/tests/spec/arb_copy_image/CMakeLists.gl.txt
>> b/tests/spec/arb_copy_image/CMakeLists.gl.txt
>> index f0d631a..c8b0406 100644
>> --- a/tests/spec/arb_copy_image/CMakeLists.gl.txt
>> +++ b/tests/spec/arb_copy_image/CMakeLists.gl.txt
>> @@ -10,5 +10,6 @@ link_libraries (
>>
>>   piglit_add_executable (arb_copy_image-simple simple.c)
>>   piglit_add_executable (arb_copy_image-targets targets.c)
>> +piglit_add_executable (arb_copy_image-formats formats.c)
>>
>>   # vim: ft=cmake:
>> diff --git a/tests/spec/arb_copy_image/formats.c
>> b/tests/spec/arb_copy_image/formats.c
>> new file mode 100644
>> index 0000000..fdc4584
>> --- /dev/null
>> +++ b/tests/spec/arb_copy_image/formats.c
>> @@ -0,0 +1,334 @@
>> +/*
>> + * Copyright 2014 Intel Corporation
>> + *
>> + * Permission is hereby granted, free of charge, to any person obtaining
>> a
>> + * copy of this software and associated documentation files (the
>> "Software"),
>> + * to deal in the Software without restriction, including without
>> limitation
>> + * the rights to use, copy, modify, merge, publish, distribute,
>> sublicense,
>> + * and/or sell copies of the Software, and to permit persons to whom the
>> + * Software is furnished to do so, subject to the following conditions:
>> + *
>> + * The above copyright notice and this permission notice (including the
>> next
>> + * paragraph) shall be included in all copies or substantial portions of
>> the
>> + * Software.
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
>> EXPRESS OR
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
>> MERCHANTABILITY,
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
>> SHALL
>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
>> OTHER
>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
>> ARISING
>> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
>> DEALINGS
>> + * IN THE SOFTWARE.
>> + */
>> +
>> +/*
>> + * This tests glCopySubImageData on different (possibly compressed)
>> texture
>> + * formats.  One texture is created and filled with random data.  The
>> + * texture is then copied to a second texture, the texture is downloaded,
>> + * and the data verified.  Because glCopySubImageData is supposed to be a
>> + * direct memcpy, the copy is verified to be bit-for-bit copy of the
>> + * original.
>> + */
>> +
>> +#include "piglit-util-gl-common.h"
>> +
>> +#define TEX_SIZE 32
>> +
>> +PIGLIT_GL_TEST_CONFIG_BEGIN
>> +
>> +       config.supports_gl_compat_version = 13;
>> +
>> +       config.window_width = TEX_SIZE * 12;
>> +       config.window_height = TEX_SIZE * 4;
>> +       config.window_visual = PIGLIT_GL_VISUAL_RGB |
>> PIGLIT_GL_VISUAL_DOUBLE;
>> +
>> +PIGLIT_GL_TEST_CONFIG_END
>> +
>> +struct texture_format {
>> +       GLenum internal_format;
>> +       const char *name;
>> +       GLenum format;
>> +       GLenum data_type;
>> +       GLuint bytes;
>> +       GLuint block_width;
>> +       GLuint block_height;
>> +};
>> +
>> +#define FORMAT(IF, F, D, B, W, H) { IF, #IF, F, D, B, W, H }
>> +
>> +struct texture_format formats[] = {
>> +       FORMAT(GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, 1, 1, 1),
>> +       FORMAT(GL_R8I, GL_RED_INTEGER, GL_BYTE, 1, 1, 1),
>> +       FORMAT(GL_R8, GL_RED, GL_UNSIGNED_BYTE, 1, 1, 1),
>> +       FORMAT(GL_R8_SNORM, GL_RED, GL_BYTE, 1, 1, 1),
>> +
>> +       FORMAT(GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_BYTE, 2, 1, 1),
>> +       FORMAT(GL_RG8I, GL_RG_INTEGER, GL_BYTE, 2, 1, 1),
>> +       FORMAT(GL_RG8, GL_RG, GL_UNSIGNED_BYTE, 2, 1, 1),
>> +       FORMAT(GL_RG8_SNORM, GL_RG, GL_BYTE, 2, 1, 1),
>> +       FORMAT(GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT, 2, 1, 1),
>> +       FORMAT(GL_R16I, GL_RED_INTEGER, GL_SHORT, 2, 1, 1),
>> +       FORMAT(GL_R16, GL_RED, GL_UNSIGNED_SHORT, 2, 1, 1),
>> +       FORMAT(GL_R16_SNORM, GL_RED, GL_SHORT, 2, 1, 1),
>> +
>> +       FORMAT(GL_RGB8UI, GL_RGB_INTEGER, GL_UNSIGNED_BYTE, 3, 1, 1),
>> +       FORMAT(GL_RGB8I, GL_RGB_INTEGER, GL_BYTE, 3, 1, 1),
>> +       FORMAT(GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, 3, 1, 1),
>> +       FORMAT(GL_RGB8_SNORM, GL_RGB, GL_BYTE, 3, 1, 1),
>> +
>> +       FORMAT(GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, 4, 1, 1),
>> +       FORMAT(GL_RGBA8I, GL_RGBA_INTEGER, GL_BYTE, 4, 1, 1),
>> +       FORMAT(GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, 4, 1, 1),
>> +       FORMAT(GL_RGBA8_SNORM, GL_RGBA, GL_BYTE, 4, 1, 1),
>> +       FORMAT(GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT, 4, 1, 1),
>> +       FORMAT(GL_RG16I, GL_RG_INTEGER, GL_SHORT, 4, 1, 1),
>> +       FORMAT(GL_RG16, GL_RG, GL_UNSIGNED_SHORT, 4, 1, 1),
>> +       FORMAT(GL_RG16_SNORM, GL_RG, GL_SHORT, 4, 1, 1),
>> +       FORMAT(GL_R32F, GL_RED, GL_FLOAT, 4, 1, 1),
>> +
>> +       FORMAT(GL_RGB16UI, GL_RGB_INTEGER, GL_UNSIGNED_SHORT, 6, 1, 1),
>> +       FORMAT(GL_RGB16I, GL_RGB_INTEGER, GL_SHORT, 6, 1, 1),
>> +       FORMAT(GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT, 6, 1, 1),
>> +       FORMAT(GL_RGB16_SNORM, GL_RGB, GL_SHORT, 6, 1, 1),
>> +
>> +       FORMAT(GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, 8, 1, 1),
>> +       FORMAT(GL_RGBA16I, GL_RGBA_INTEGER, GL_SHORT, 8, 1, 1),
>> +       FORMAT(GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT, 8, 1, 1),
>> +       FORMAT(GL_RGBA16_SNORM, GL_RGBA, GL_SHORT, 8, 1, 1),
>> +       FORMAT(GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT, 8, 1, 1),
>> +       FORMAT(GL_RG32I, GL_RG_INTEGER, GL_INT, 8, 1, 1),
>> +       FORMAT(GL_RG32F, GL_RG, GL_FLOAT, 8, 1, 1),
>> +
>> +       FORMAT(GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_RED, GL_BYTE, 8, 4,
>> 4),
>> +       FORMAT(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT, GL_RED, GL_BYTE, 8, 4,
>> 4),
>> +       FORMAT(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_RED, GL_BYTE, 8, 4,
>> 4),
>> +       FORMAT(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, GL_RED, GL_BYTE,
>> 8, 4, 4),
>> +       FORMAT(GL_COMPRESSED_RED_RGTC1, GL_RED, GL_BYTE, 8, 4, 4),
>> +       FORMAT(GL_COMPRESSED_SIGNED_RED_RGTC1, GL_RED, GL_BYTE, 8, 4, 4),
>> +
>> +       FORMAT(GL_RGB32UI, GL_RGB_INTEGER, GL_UNSIGNED_INT, 12, 1, 1),
>> +       FORMAT(GL_RGB32I, GL_RGB_INTEGER, GL_INT, 12, 1, 1),
>> +       FORMAT(GL_RGB32F, GL_RGB, GL_FLOAT, 12, 1, 1),
>> +
>> +       FORMAT(GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT, 16, 1, 1),
>> +       FORMAT(GL_RGBA32I, GL_RGBA_INTEGER, GL_INT, 16, 1, 1),
>> +       FORMAT(GL_RGBA32F, GL_RGBA, GL_FLOAT, 16, 1, 1),
>> +
>> +       FORMAT(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_RED, GL_BYTE, 16, 4,
>> 4),
>> +       FORMAT(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, GL_RED, GL_BYTE,
>> 16, 4, 4),
>> +       FORMAT(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_RED, GL_BYTE, 16, 4,
>> 4),
>> +       FORMAT(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, GL_RED, GL_BYTE,
>> 16, 4, 4),
>> +       FORMAT(GL_COMPRESSED_RG_RGTC2, GL_RED, GL_BYTE, 16, 4, 4),
>> +       FORMAT(GL_COMPRESSED_SIGNED_RG_RGTC2, GL_RED, GL_BYTE, 16, 4, 4),
>> +
>> +#ifdef GL_COMPRESSED_RGBA_BPTC_UNORM
>> +       FORMAT(GL_COMPRESSED_RGBA_BPTC_UNORM, GL_RGBA, GL_BYTE, 16, 4,
>> 4),
>> +       FORMAT(GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, GL_RGB, GL_BYTE, 16,
>> 4, 4),
>> +       FORMAT(GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT, GL_RGB, GL_BYTE, 16,
>> 4, 4),
>> +       FORMAT(GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, GL_RGB, GL_BYTE,
>> 16, 4, 4),
>> +#endif
>> +};
>> +
>> +#undef FORMAT
>> +
>> +struct texture_format *
>> +find_format(const char *str)
>> +{
>> +       int i;
>> +
>> +       for (i = 0; i < sizeof(formats) / sizeof(*formats); ++i)
>> +               if (strcmp(str, formats[i].name) == 0)
>> +                       return &formats[i];
>> +
>> +       return NULL;
>> +}
>> +
>> +struct texture_format *src_format, *dst_format;
>> +unsigned char *src_data, *dst_data, *result;
>> +
>> +void
>> +piglit_init(int argc, char **argv)
>> +{
>> +       int i, seed;
>> +
>> +       if (sscanf(argv[1], "--seed=%d", &seed) > 0) {
>> +               srand(seed);
>> +               --argc;
>> +               ++argv;
>> +       } else {
>> +               srand(0);
>> +       }
>> +
>> +       if (argc < 2) {
>> +               printf("usage: [--seed=seed] arb_copy_image-formats
>> src_format dst_format");
>> +               exit(1);
>> +       }
>> +
>> +       piglit_require_extension("GL_ARB_copy_image");
>> +
>> +       src_format = find_format(argv[1]);
>> +       assert(src_format != NULL);
>> +
>> +       dst_format = find_format(argv[2]);
>> +       assert(dst_format != NULL);
>> +
>> +       assert(dst_format->bytes == src_format->bytes);
>> +
>> +       src_data = malloc(TEX_SIZE * TEX_SIZE * src_format->bytes);
>> +       dst_data = malloc(TEX_SIZE * TEX_SIZE * dst_format->bytes);
>> +       result = malloc(TEX_SIZE * TEX_SIZE * dst_format->bytes);
>> +
>> +       if (src_format->data_type == GL_FLOAT ||
>> +           dst_format->data_type == GL_FLOAT) {
>> +               /* If it's a floating-point type, let's avoid using
>> invalid
>> +                * floating-point values.  That might throw things off */
>> +
>> +               for (i = 0; i < TEX_SIZE * TEX_SIZE * src_format->bytes /
>> sizeof(float); ++i)
>> +                       ((float *)src_data)[i] = rand() / (float)RAND_MAX;
>> +
>> +               for (i = 0; i < TEX_SIZE * TEX_SIZE * src_format->bytes /
>> sizeof(float); ++i)
>> +                       ((float *)dst_data)[i] = rand() / (float)RAND_MAX;
>> +       } else {
>> +               for (i = 0; i < TEX_SIZE * TEX_SIZE * src_format->bytes;
>> ++i)
>> +                       src_data[i] = rand();
>> +
>> +               for (i = 0; i < TEX_SIZE * TEX_SIZE * src_format->bytes;
>> ++i)
>> +                       dst_data[i] = rand();
>> +       }
>> +
>>
>
> Some comments about what's being done here would help.
>
>
Done.  Also made it more clear in general.


>
>  +       memcpy(result,
>> +              dst_data,
>> +              (TEX_SIZE / 4) * TEX_SIZE * src_format->bytes);
>> +       for (i = TEX_SIZE / 4; i < (TEX_SIZE / 4) * 3; ++i) {
>> +               memcpy(result + (i * TEX_SIZE) * src_format->bytes,
>> +                      dst_data + (i * TEX_SIZE) * src_format->bytes,
>> +                      (TEX_SIZE / 4) * src_format->bytes);
>> +
>> +               memcpy(result + (i * TEX_SIZE + TEX_SIZE / 4) *
>> src_format->bytes,
>> +                      src_data + (i * TEX_SIZE + TEX_SIZE / 4) *
>> src_format->bytes,
>> +                      (TEX_SIZE / 2) * src_format->bytes);
>> +
>> +               memcpy(result + (i * TEX_SIZE + (TEX_SIZE / 4) * 3) *
>> src_format->bytes,
>> +                      dst_data + (i * TEX_SIZE + (TEX_SIZE / 4) * 3) *
>> src_format->bytes,
>> +                      (TEX_SIZE / 4) * src_format->bytes);
>> +       }
>> +       memcpy(result + ((TEX_SIZE / 4) * 3) * TEX_SIZE *
>> src_format->bytes,
>> +              dst_data + ((TEX_SIZE / 4) * 3) * TEX_SIZE *
>> src_format->bytes,
>> +              (TEX_SIZE / 4) * TEX_SIZE * src_format->bytes);
>> +}
>> +
>> +bool
>> +check_texture(GLuint texture, struct texture_format *format,
>>
>
> const struct texture_format ?
>
>
Yup.  I made the data parameter const as well.


>
>
>  +             unsigned char *data)
>> +{
>> +       int i, j, k;
>> +       bool pass = true;
>> +       unsigned char *tex_data;
>> +       float passrate;
>> +
>> +       tex_data = malloc(TEX_SIZE * TEX_SIZE * format->bytes);
>> +
>> +       glBindTexture(GL_TEXTURE_2D, texture);
>> +       if (format->block_width != 1 || format->block_height != 1) {
>> +               /* Compressed */
>> +               glGetCompressedTexImage(GL_TEXTURE_2D, 0, tex_data);
>> +       } else {
>> +               glGetTexImage(GL_TEXTURE_2D, 0, format->format,
>> +                             format->data_type, tex_data);
>> +       }
>> +
>> +       passrate = 0;
>> +       for (j = 0; j < TEX_SIZE; ++j) {
>> +               for (i = 0; i < TEX_SIZE; ++i) {
>> +                       if (memcmp(tex_data + ((j * TEX_SIZE) + i) *
>> format->bytes,
>> +                                  data + ((j * TEX_SIZE) + i) *
>> format->bytes,
>> +                                  format->bytes) == 0) {
>> +                               passrate += 1;
>> +                       } else {
>> +                               fprintf(stdout, "texel mismatch at (%d,
>> %d); expected 0x",
>> +                                       i, j);
>> +                               for (k = format->bytes - 1; k >= 0; --k)
>> +                                       fprintf(stdout, "%02x", data[((j
>> * TEX_SIZE) + i) * format->bytes + k]);
>> +
>> +                               fprintf(stdout, ", received 0x");
>> +                               for (k = format->bytes - 1; k >= 0; --k)
>> +                                       fprintf(stdout, "%02x",
>> tex_data[((j * TEX_SIZE) + i) * format->bytes + k]);
>> +                               fprintf(stdout, ".\n");
>> +
>> +                               pass = false;
>> +                       }
>> +               }
>> +       }
>> +       passrate /= TEX_SIZE * TEX_SIZE;
>> +       printf("%0.1f%% of pixels match\n", passrate * 100);
>> +
>>
>
> free(tex_data);
>
>
Thanks, fixed.


>
>
>  +       return pass;
>> +}
>> +
>> +enum piglit_result
>> +piglit_display(void)
>> +{
>> +       bool pass = true;
>> +       GLuint texture[2];
>> +       GLuint src_width, src_height, dst_width, dst_height;
>> +
>> +       glEnable(GL_TEXTURE_2D);
>> +
>> +       glGenTextures(2, texture);
>> +
>> +       src_width = TEX_SIZE * src_format->block_width;
>> +       src_height = TEX_SIZE * src_format->block_height;
>> +
>> +       glBindTexture(GL_TEXTURE_2D, texture[0]);
>> +       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
>> +       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
>> +       if (src_format->block_width != 1 || src_format->block_height !=
>> 1) {
>> +               /* Compressed */
>> +               glCompressedTexImage2D(GL_TEXTURE_2D, 0,
>> +                                      src_format->internal_format,
>> +                                      src_width, src_height, 0,
>> +                                      TEX_SIZE * TEX_SIZE *
>> src_format->bytes,
>> +                                      src_data);
>> +       } else {
>> +               glTexImage2D(GL_TEXTURE_2D, 0,
>> src_format->internal_format,
>> +                            src_width, src_height, 0, src_format->format,
>> +                            src_format->data_type, src_data);
>> +       }
>> +       pass &= piglit_check_gl_error(GL_NO_ERROR);
>> +       pass &= check_texture(texture[0], src_format, src_data);
>> +
>> +       dst_width = TEX_SIZE * dst_format->block_width;
>> +       dst_height = TEX_SIZE * dst_format->block_height;
>> +
>> +       glBindTexture(GL_TEXTURE_2D, texture[1]);
>> +       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
>> +       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
>> +       if (dst_format->block_width != 1 || dst_format->block_height !=
>> 1) {
>> +               /* Compressed */
>> +               glCompressedTexImage2D(GL_TEXTURE_2D, 0,
>> +                                      dst_format->internal_format,
>> +                                      dst_width, dst_height, 0,
>> +                                      TEX_SIZE * TEX_SIZE *
>> dst_format->bytes,
>> +                                      dst_data);
>> +       } else {
>> +               glTexImage2D(GL_TEXTURE_2D, 0,
>> dst_format->internal_format,
>> +                            dst_width, dst_height, 0, dst_format->format,
>> +                            dst_format->data_type, dst_data);
>> +       }
>> +       pass &= piglit_check_gl_error(GL_NO_ERROR);
>> +       pass &= check_texture(texture[1], dst_format, dst_data);
>> +
>> +       glCopyImageSubData(texture[0], GL_TEXTURE_2D, 0,
>> +                          src_width / 4, src_height / 4, 0,
>> +                          texture[1], GL_TEXTURE_2D, 0,
>> +                          dst_width / 4, dst_height / 4, 0,
>> +                          src_width / 2, src_height / 2, 1);
>> +       pass &= piglit_check_gl_error(GL_NO_ERROR);
>> +       pass &= check_texture(texture[1], dst_format, result);
>> +
>> +       glDeleteTextures(2, texture);
>> +
>> +       glDisable(GL_TEXTURE_2D);
>> +
>> +       return pass ? PIGLIT_PASS : PIGLIT_FAIL;
>> +}
>>
>>
> Same comments about extension/version requirements and static functions.
>
> Looks pretty good otherwise!
>

Thanks for the review.


>
> -Brian
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140630/95a1fa86/attachment-0001.html>


More information about the Piglit mailing list