[Mesa-dev] [PATCH] mesa: fix error check for zero-sized compressed subtexture

Brian Paul brianp at vmware.com
Fri Oct 5 16:00:57 PDT 2012


For glCompressedTexSubImage, width or height = 0 is legal.
Fixes a failure in piglit's s3tc-errors test.

This is for the 9.0 and 8.0 branches.  Already fixed on master.
---
 src/mesa/main/teximage.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 8004876..38fa9fa 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -3598,10 +3598,10 @@ compressed_subtexture_error_check(struct gl_context *ctx, GLint dimensions,
    if (!_mesa_is_compressed_format(ctx, format))
       return GL_INVALID_ENUM;
 
-   if (width < 1 || width > maxTextureSize)
+   if (width < 0 || width > maxTextureSize)
       return GL_INVALID_VALUE;
 
-   if ((height < 1 || height > maxTextureSize)
+   if ((height < 0 || height > maxTextureSize)
        && dimensions > 1)
       return GL_INVALID_VALUE;
 
-- 
1.7.3.4



More information about the mesa-dev mailing list