On 07/27/2015 03:13 PM, Nanley Chery wrote:
From: Nanley Chery <[email protected]>

Use the piglit utility function for determining format block dimensions
instead of using a test-specific function. This requires adding some formats
not originally in the piglit-util function.

Signed-off-by: Nanley Chery <[email protected]>
Cc: Brian Paul <[email protected]>
---
  tests/texturing/texsubimage.c | 47 ++-----------------------------------------
  tests/util/piglit-util-gl.c   |  2 ++
  2 files changed, 4 insertions(+), 45 deletions(-)

diff --git a/tests/texturing/texsubimage.c b/tests/texturing/texsubimage.c
index 56387c6..c66f93c 100644
--- a/tests/texturing/texsubimage.c
+++ b/tests/texturing/texsubimage.c
@@ -267,49 +267,6 @@ equal_images(GLenum target,
  }

  /**
- * Get block size for compressed format.
- * \return GL_TRUE if format is compressed, GL_FALSE otherwise
- * XXX this could be a piglit util function if useful elsewhere.
- */
-static GLboolean
-get_format_block_size(GLenum format, GLuint *bw, GLuint *bh)
-{
-       switch (format) {
-       case GL_COMPRESSED_RGB_FXT1_3DFX:
-       case GL_COMPRESSED_RGBA_FXT1_3DFX:
-               *bw = 8;
-               *bh = 4;
-               return GL_TRUE;
-       case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-       case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-       case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
-       case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
-       case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
-       case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
-       case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
-       case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
-               *bw = 4;
-               *bh = 4;
-               return GL_TRUE;
-       case GL_COMPRESSED_RED:
-       case GL_COMPRESSED_RED_RGTC1_EXT:
-       case GL_COMPRESSED_RG:
-       case GL_COMPRESSED_RED_GREEN_RGTC2_EXT:
-               *bw = 4;
-               *bh = 4;
-               return GL_TRUE;
-       case GL_COMPRESSED_LUMINANCE_LATC1_EXT:
-       case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
-               *bw = 4;
-               *bh = 4;
-               return GL_TRUE;
-       default:
-               *bw = *bh = 1;
-               return GL_FALSE;
-       }
-}
-
-/**
   * Draw each image of the texture to the framebuffer and then save the
   * entire thing to a buffer with glReadPixels().
   */
@@ -402,9 +359,9 @@ test_format(GLenum target, GLenum intFormat)
        GLubyte *updated_img, *updated_ref;
        GLubyte *testImg;
        GLboolean pass = GL_TRUE;
-       GLuint bw, bh, wMask, hMask, dMask;
+       GLuint bw, bh, bb, wMask, hMask, dMask;
        GLuint pbo = 0;
-       get_format_block_size(intFormat, &bw, &bh);
+       piglit_get_compressed_block_size(intFormat, &bw, &bh, &bb);
        wMask = ~(bw-1);
        hMask = ~(bh-1);
        dMask = ~0;
diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 1a24067..db17b83 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -445,6 +445,7 @@ piglit_get_compressed_block_size(GLenum format,
                return true;
        case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
        case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
+       case GL_COMPRESSED_RED:
        case GL_COMPRESSED_RED_RGTC1:
        case GL_COMPRESSED_SIGNED_RED_RGTC1:
        case GL_COMPRESSED_LUMINANCE_LATC1_EXT:
@@ -456,6 +457,7 @@ piglit_get_compressed_block_size(GLenum format,
        case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
        case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
        case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
+       case GL_COMPRESSED_RG:
        case GL_COMPRESSED_RG_RGTC2:
        case GL_COMPRESSED_SIGNED_RG_RGTC2:
        case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:


Reviewed-by: Brian Paul <[email protected]>

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to