[Piglit] [PATCH 9/9] etc1: Remove texturing test from 'basic' test file

Chad Versace chad.versace at linux.intel.com
Mon Jul 9 10:43:37 PDT 2012


Now that oes_compressed_etc1_rgb8_texture-miptree, a test for realworld
ETC1 data, has been added to Piglit, the minimal, artificial texturing test
in oes_compressed_etc1_rgb8_texture-basic is unneeded. This patch removes
the texturing test from that file, and only api tests remain.

Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 .../oes_compressed_etc1_rgb8_texture-basic.c       | 152 +--------------------
 1 file changed, 5 insertions(+), 147 deletions(-)

diff --git a/tests/spec/oes_compressed_etc1_rgb8_texture/oes_compressed_etc1_rgb8_texture-basic.c b/tests/spec/oes_compressed_etc1_rgb8_texture/oes_compressed_etc1_rgb8_texture-basic.c
index 58d8d04..fbebce2 100644
--- a/tests/spec/oes_compressed_etc1_rgb8_texture/oes_compressed_etc1_rgb8_texture-basic.c
+++ b/tests/spec/oes_compressed_etc1_rgb8_texture/oes_compressed_etc1_rgb8_texture-basic.c
@@ -32,149 +32,12 @@ PIGLIT_GL_TEST_MAIN(
     100 /*window_height*/,
     GLUT_RGB | GLUT_DOUBLE)
 
-struct etc1_rgb8_texture_8x8 {
-    GLubyte data[32];
-    GLubyte rgb[64][3];
-};
-
-static void
-make_etc1_rgb8_texture_8x8(struct etc1_rgb8_texture_8x8 *tex)
-{
-    const GLubyte base_colors[4][3] = {
-        { 0xff, 0x00, 0x00 }, /* red */
-        { 0x00, 0xff, 0x00 }, /* green */
-        { 0x10, 0x00, 0x00 }, /* R=16 */
-        { 0x00, 0x00, 0x00 }  /* black */
-    };
-    const int modifiers[4] = {
-          2, /* modifier table 0, pixel index 0 */
-         17, /* modifier table 1, pixel index 1 */
-         -9, /* modifier table 2, pixel index 2 */
-        -42  /* modifier table 3, pixel index 3 */
-    };
-    GLubyte blocks[4][8];
-    unsigned i;
-
-    /* block 0: red and green, individual, modifier table 0, not flipped */
-    blocks[0][0] = 0xf0;
-    blocks[0][1] = 0x0f;
-    blocks[0][2] = 0x0;
-    blocks[0][3] = 0x0;
-    /* set all pixel indices to 0 */
-    blocks[0][4] = 0x0;
-    blocks[0][5] = 0x0;
-    blocks[0][6] = 0x0;
-    blocks[0][7] = 0x0;
-
-    /* block 1: red and green, individual, modifier table 1, flipped */
-    blocks[1][0] = blocks[0][0];
-    blocks[1][1] = blocks[0][1];
-    blocks[1][2] = blocks[0][2];
-    blocks[1][3] = 0x25;
-    /* set all pixel indices to 1 */
-    blocks[1][4] = 0x0;
-    blocks[1][5] = 0x0;
-    blocks[1][6] = 0xff;
-    blocks[1][7] = 0xff;
-
-    /* block 2: R=16 and black, differential, modifier table 2, not flipped */
-    blocks[2][0] = 0x16;
-    blocks[2][1] = 0x0;
-    blocks[2][2] = 0x0;
-    blocks[2][3] = 0x4a;
-    /* set all pixel indices to 2 */
-    blocks[2][4] = 0xff;
-    blocks[2][5] = 0xff;
-    blocks[2][6] = 0x0;
-    blocks[2][7] = 0x0;
-
-    /* block 3: R=16 and black, differential, modifier table 3, flipped */
-    blocks[3][0] = blocks[2][0];
-    blocks[3][1] = blocks[2][1];
-    blocks[3][2] = blocks[2][2];
-    blocks[3][3] = 0x6f;
-    /* set all pixel indices to 3 */
-    blocks[3][4] = 0xff;
-    blocks[3][5] = 0xff;
-    blocks[3][6] = 0xff;
-    blocks[3][7] = 0xff;
-
-    memcpy(tex->data, blocks, sizeof(blocks));
-
-    /* decode */
-    for (i = 0; i < 64; i++) {
-        unsigned x, y, b, bx, by, sub;
-        const GLubyte *base_color;
-        int modifier;
-
-        x = i % 8;
-        y = i / 8;
-
-        /* block number */
-        b = (x < 4) ? 0 : 1;
-        if (y >= 4)
-            b += 2;
-
-        /* block coordinates */
-        bx = x % 4;
-        by = y % 4;
-
-        /* subblock number */
-        sub = (blocks[b][3] & 0x1) ? (by >= 2) : (bx >= 2);
-
-        if (b < 2)
-            base_color = base_colors[sub];
-        else
-            base_color = base_colors[2 + sub];
-
-        modifier = modifiers[b];
-
-        tex->rgb[i][0] = CLAMP((int) base_color[0] + modifier, 0, 255);
-        tex->rgb[i][1] = CLAMP((int) base_color[1] + modifier, 0, 255);
-        tex->rgb[i][2] = CLAMP((int) base_color[2] + modifier, 0, 255);
-    }
-}
-
-static int
-test_etc1_rgb8_texture_8x8(const struct etc1_rgb8_texture_8x8 *tex)
-{
-    const GLenum format = GL_ETC1_RGB8_OES;
-    const GLsizei width = 8, height = 8;
-    unsigned x, y;
-    int pass = GL_TRUE;
-
-    glCompressedTexImage2D(GL_TEXTURE_2D, 0,
-            format, width, height, 0, sizeof(tex->data), tex->data);
-    pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
-
-    glEnable(GL_TEXTURE_2D);
-
-    piglit_draw_rect_tex(0, 0, width, height, 0.0f, 0.0f, 1.0f, 1.0f);
-
-    glDisable(GL_TEXTURE_2D);
-
-    for (y = 0; y < height; y++) {
-        for (x = 0; x < width; x++) {
-            const GLubyte *rgb = tex->rgb[y * width + x];
-            float expected[3] = {
-                rgb[0] / 255.0f,
-                rgb[1] / 255.0f,
-                rgb[2] / 255.0f
-            };
-
-            pass = piglit_probe_pixel_rgb(x, y, expected) && pass;
-        }
-    }
-
-    return pass;
-}
-
 enum piglit_result
 piglit_display(void)
 {
     const GLenum format = GL_ETC1_RGB8_OES;
     const GLsizei width = 8, height = 8;
-    struct etc1_rgb8_texture_8x8 tex;
+    const GLubyte fake_tex_data[4096];
     GLuint t;
     int pass = GL_TRUE;
 
@@ -183,30 +46,26 @@ piglit_display(void)
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
 
-    make_etc1_rgb8_texture_8x8(&tex);
-
     glClear(GL_COLOR_BUFFER_BIT);
 
     /* no compression support */
     glTexImage2D(GL_TEXTURE_2D, 0, format,
-            width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, tex.rgb);
+            width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, fake_tex_data);
     pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
 
     glCopyTexImage2D(GL_TEXTURE_2D, 0, format, 0, 0, width, height, 0);
     pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
 
-    /* test the texture */
-    pass = test_etc1_rgb8_texture_8x8(&tex) && pass;
-
     /* no subimage support */
     glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
-            width, height, GL_RGB, GL_UNSIGNED_BYTE, tex.rgb);
+            width, height, GL_RGB, GL_UNSIGNED_BYTE, fake_tex_data);
     pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
 
     glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, width, height);
     pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
 
-    glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, format, sizeof(tex.data), tex.data);
+    glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, format,
+                              sizeof(fake_tex_data), fake_tex_data);
     pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
 
     glDeleteTextures(1, &t);
@@ -218,5 +77,4 @@ void
 piglit_init(int argc, char **argv)
 {
     piglit_require_extension("GL_OES_compressed_ETC1_RGB8_texture");
-    piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 }
-- 
1.7.11.1



More information about the Piglit mailing list