Mesa (master): mesa/main: Never return NULL in _mesa_get_texstore_func.

Brian Paul brianp at kemper.freedesktop.org
Thu Oct 29 13:54:50 UTC 2009


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

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Thu Oct 29 15:19:59 2009 +0800

mesa/main: Never return NULL in _mesa_get_texstore_func.

Signed-off-by: Chia-I Wu <olvaffe at gmail.com>

---

 src/mesa/main/texstore.c |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 36228e6..01fea47 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -3083,6 +3083,26 @@ texstore_funcs[MESA_FORMAT_COUNT] =
 };
 
 
+static GLboolean
+_mesa_texstore_null(TEXSTORE_PARAMS)
+{
+   (void) ctx; (void) dims;
+   (void) baseInternalFormat;
+   (void) dstFormat;
+   (void) dstAddr;
+   (void) dstXoffset; (void) dstYoffset; (void) dstZoffset;
+   (void) dstRowStride; (void) dstImageOffsets;
+   (void) srcWidth; (void) srcHeight; (void) srcDepth;
+   (void) srcFormat; (void) srcType;
+   (void) srcAddr;
+   (void) srcPacking;
+
+   /* should never happen */
+   _mesa_problem(NULL, "_mesa_texstore_null() is called");
+   return GL_FALSE;
+}
+
+
 /**
  * Return the StoreTexImageFunc pointer to store an image in the given format.
  */
@@ -3096,7 +3116,11 @@ _mesa_get_texstore_func(gl_format format)
    }
 #endif
    ASSERT(texstore_funcs[format].Name == format);
-   return texstore_funcs[format].Store;
+
+   if (texstore_funcs[format].Store)
+      return texstore_funcs[format].Store;
+   else
+      return _mesa_texstore_null;
 }
 
 
@@ -3112,8 +3136,6 @@ _mesa_texstore(TEXSTORE_PARAMS)
 
    storeImage = _mesa_get_texstore_func(dstFormat);
 
-   assert(storeImage);
-
    success = storeImage(ctx, dims, baseInternalFormat,
                         dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
                         dstRowStride, dstImageOffsets,




More information about the mesa-commit mailing list