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@vmware.com>
This commit is contained in:
Brian Paul
2014-01-20 08:06:35 -08:00
parent 3ede8dd5f1
commit 799abb271a

View File

@@ -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]);
}
}
}