Mesa (master): swrast: check for null/-1 when mapping renderbuffers

Brian Paul brianp at kemper.freedesktop.org
Mon Jan 20 16:19:09 UTC 2014


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

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Jan 20 08:06:35 2014 -0800

swrast: check for null/-1 when mapping renderbuffers

Fixes fbo-drawbuffers-none crash (but test still fails).
https://bugs.freedesktop.org/show_bug.cgi?id=73757

Reviewed-by: Roland Scheidegger <sroland at vmware.com>

---

 src/mesa/swrast/s_renderbuffer.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/mesa/swrast/s_renderbuffer.c b/src/mesa/swrast/s_renderbuffer.c
index e3f33de..a19d02a 100644
--- a/src/mesa/swrast/s_renderbuffer.c
+++ b/src/mesa/swrast/s_renderbuffer.c
@@ -659,8 +659,10 @@ _swrast_map_renderbuffers(struct gl_context *ctx)
    }
 
    for (buf = 0; buf < fb->_NumColorDrawBuffers; buf++) {
-      map_attachment(ctx, fb, fb->_ColorDrawBufferIndexes[buf]);
-      find_renderbuffer_colortype(fb->_ColorDrawBuffers[buf]);
+      if (fb->_ColorDrawBufferIndexes[buf] >= 0) {
+         map_attachment(ctx, fb, fb->_ColorDrawBufferIndexes[buf]);
+         find_renderbuffer_colortype(fb->_ColorDrawBuffers[buf]);
+      }
    }
 }
  
@@ -688,6 +690,8 @@ _swrast_unmap_renderbuffers(struct gl_context *ctx)
    }
 
    for (buf = 0; buf < fb->_NumColorDrawBuffers; buf++) {
-      unmap_attachment(ctx, fb, fb->_ColorDrawBufferIndexes[buf]);
+      if (fb->_ColorDrawBufferIndexes[buf] >= 0) {
+         unmap_attachment(ctx, fb, fb->_ColorDrawBufferIndexes[buf]);
+      }
    }
 }




More information about the mesa-commit mailing list