Mesa (master): swrast: replace assertion with conditional in _swrast_map_teximage()

Brian Paul brianp at kemper.freedesktop.org
Mon Dec 26 23:06:37 UTC 2011


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

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Dec 26 14:49:57 2011 -0700

swrast: replace assertion with conditional in _swrast_map_teximage()

Just in case we ran out of memory when trying to allocate the texture
memory.

---

 src/mesa/swrast/s_texture.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c
index 76a31ee..e31cd62 100644
--- a/src/mesa/swrast/s_texture.c
+++ b/src/mesa/swrast/s_texture.c
@@ -189,8 +189,12 @@ _swrast_map_teximage(struct gl_context *ctx,
    stride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width);
    _mesa_get_format_block_size(texImage->TexFormat, &bw, &bh);
 
-   assert(swImage->Buffer);
-
+   if (!swImage->Buffer) {
+      /* probably ran out of memory when allocating tex mem */
+      *mapOut = NULL;
+      return;
+   }
+      
    map = swImage->Buffer;
 
    if (texImage->TexObject->Target == GL_TEXTURE_3D ||




More information about the mesa-commit mailing list