Mesa (master): mesa: Fix error reporting in _mesa_invalidate_pbo_{compressed_,}teximage.

Paul Berry stereotype441 at kemper.freedesktop.org
Wed Jan 2 18:43:09 UTC 2013


Module: Mesa
Branch: master
Commit: 261ee4d907cc2e06a578e1597f6a55f1997ab52c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=261ee4d907cc2e06a578e1597f6a55f1997ab52c

Author: Paul Berry <stereotype441 at gmail.com>
Date:   Mon Dec 31 09:00:41 2012 -0800

mesa: Fix error reporting in _mesa_invalidate_pbo_{compressed_,}teximage.

The old error reporting was completely bogus, passing _mesa_error() a
format string that didn't even match the remaining arguments.  Also,
in many cases the number of dimensions in the TexImage call was not
preserved in the error message (e.g. an error in glTexImage2D was
reported simply as an error in glTexImage).

Reviewed-by: Matt Turner <mattst88 at gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>

---

 src/mesa/drivers/dri/nouveau/nouveau_texture.c |    4 ++--
 src/mesa/main/pbo.c                            |   15 ++++++++++-----
 src/mesa/main/pbo.h                            |    3 ++-
 src/mesa/main/texstore.c                       |    4 ++--
 4 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index 288b510..64cd23b 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -501,7 +501,7 @@ nouveau_teximage(struct gl_context *ctx, GLint dims,
 
 	if (compressed)
 		pixels = _mesa_validate_pbo_compressed_teximage(ctx,
-			imageSize,
+			dims, imageSize,
 			pixels, packing, "glCompressedTexImage");
 	else
 		pixels = _mesa_validate_pbo_teximage(ctx,
@@ -576,7 +576,7 @@ nouveau_texsubimage(struct gl_context *ctx, GLint dims,
 
 	if (compressed)
 		pixels = _mesa_validate_pbo_compressed_teximage(ctx,
-				imageSize,
+				dims, imageSize,
 				pixels, packing, "glCompressedTexSubImage");
 	else
 		pixels = _mesa_validate_pbo_teximage(ctx,
diff --git a/src/mesa/main/pbo.c b/src/mesa/main/pbo.c
index c73d749..0dc4c04 100644
--- a/src/mesa/main/pbo.c
+++ b/src/mesa/main/pbo.c
@@ -342,7 +342,8 @@ _mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions,
    }
    if (!_mesa_validate_pbo_access(dimensions, unpack, width, height, depth,
                                   format, type, INT_MAX, pixels)) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(invalid PBO access)");
+      _mesa_error(ctx, GL_INVALID_OPERATION, "%s%uD(invalid PBO access)",
+                  funcName, dimensions);
       return NULL;
    }
 
@@ -351,7 +352,8 @@ _mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions,
 						GL_MAP_READ_BIT,
 						unpack->BufferObj);
    if (!buf) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(PBO is mapped)");
+      _mesa_error(ctx, GL_INVALID_OPERATION, "%s%uD(PBO is mapped)", funcName,
+                  dimensions);
       return NULL;
    }
 
@@ -368,7 +370,8 @@ _mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions,
  */
 const GLvoid *
 _mesa_validate_pbo_compressed_teximage(struct gl_context *ctx,
-                                 GLsizei imageSize, const GLvoid *pixels,
+                                 GLuint dimensions, GLsizei imageSize,
+                                 const GLvoid *pixels,
                                  const struct gl_pixelstore_attrib *packing,
                                  const char *funcName)
 {
@@ -381,7 +384,8 @@ _mesa_validate_pbo_compressed_teximage(struct gl_context *ctx,
    if ((const GLubyte *) pixels + imageSize >
        ((const GLubyte *) 0) + packing->BufferObj->Size) {
       /* out of bounds read! */
-      _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(invalid PBO access)");
+      _mesa_error(ctx, GL_INVALID_OPERATION, "%s%uD(invalid PBO access)",
+                  funcName, dimensions);
       return NULL;
    }
 
@@ -390,7 +394,8 @@ _mesa_validate_pbo_compressed_teximage(struct gl_context *ctx,
 					       GL_MAP_READ_BIT,
 					       packing->BufferObj);
    if (!buf) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(PBO is mapped");
+      _mesa_error(ctx, GL_INVALID_OPERATION, "%s%uD(PBO is mapped)", funcName,
+                  dimensions);
       return NULL;
    }
 
diff --git a/src/mesa/main/pbo.h b/src/mesa/main/pbo.h
index 00a6e61..9eba335 100644
--- a/src/mesa/main/pbo.h
+++ b/src/mesa/main/pbo.h
@@ -81,7 +81,8 @@ _mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions,
 
 extern const GLvoid *
 _mesa_validate_pbo_compressed_teximage(struct gl_context *ctx,
-                                    GLsizei imageSize, const GLvoid *pixels,
+                                    GLuint dimensions, GLsizei imageSize,
+                                    const GLvoid *pixels,
                                     const struct gl_pixelstore_attrib *packing,
                                     const char *funcName);
 
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 26c5b67..8669898 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -4496,9 +4496,9 @@ _mesa_store_compressed_texsubimage(struct gl_context *ctx, GLuint dims,
    _mesa_get_format_block_size(texFormat, &bw, &bh);
 
    /* get pointer to src pixels (may be in a pbo which we'll map here) */
-   data = _mesa_validate_pbo_compressed_teximage(ctx, imageSize, data,
+   data = _mesa_validate_pbo_compressed_teximage(ctx, dims, imageSize, data,
                                                  &ctx->Unpack,
-                                                 "glCompressedTexSubImage2D");
+                                                 "glCompressedTexSubImage");
    if (!data)
       return;
 




More information about the mesa-commit mailing list