Mesa (master): mesa: Skip texstore for 0-sized texture data.

Eric Anholt anholt at kemper.freedesktop.org
Wed Oct 26 12:44:13 PDT 2011


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

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Oct 25 14:38:39 2011 -0700

mesa: Skip texstore for 0-sized texture data.

The intel driver (and gallium, it looks like, though it doesn't use
these texstore functions at this point) doesn't bother making storage
for textures with 0 width, height, or depth.  This avoids them having
to deal with returning a mapping for that nonexistent data.

Fixes assertion failures with an upcoming intel driver change.

Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/mesa/main/texstore.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index cd92496..05c1964 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -4499,6 +4499,9 @@ _mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level,
 
    (void) border;
 
+   if (width == 0)
+      return;
+
    /* allocate storage for texture data */
    if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat,
                                             width, 1, 1)) {
@@ -4560,6 +4563,9 @@ _mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level,
 
    (void) border;
 
+   if (width == 0 || height == 0)
+      return;
+
    /* allocate storage for texture data */
    if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat,
                                             width, height, 1)) {
@@ -4651,6 +4657,9 @@ _mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level,
 
    (void) border;
 
+   if (width == 0 || height == 0 || depth == 0)
+      return;
+
    /* allocate storage for texture data */
    if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat,
                                             width, height, depth)) {



More information about the mesa-commit mailing list