Module: Mesa Branch: 7.9 Commit: 48d44713f91e2a601747a868ca59e5fca4f313a2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=48d44713f91e2a601747a868ca59e5fca4f313a2
Author: Marek Olšák <[email protected]> Date: Sun Feb 20 16:50:48 2011 +0100 st/mesa: fix crash when DrawBuffer->_ColorDrawBuffers[0] is NULL This fixes the game Tiny and Big. (cherry picked from commit 7942e6a5ae0113f1cbdf62b772849cf6cdd4eca1) --- src/mesa/state_tracker/st_cb_clear.c | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index fd7bfc4..c2a006f 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -297,9 +297,11 @@ clear_with_quad(GLcontext *ctx, cso_set_fragment_shader_handle(st->cso_context, st->clear.fs); cso_set_vertex_shader_handle(st->cso_context, st->clear.vs); - st_translate_color(ctx->Color.ClearColor, - ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat, - clearColor); + if (ctx->DrawBuffer->_ColorDrawBuffers[0]) { + st_translate_color(ctx->Color.ClearColor, + ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat, + clearColor); + } /* draw quad matching scissor rect */ draw_quad(st, x0, y0, x1, y1, (GLfloat) ctx->Depth.Clear, clearColor); @@ -551,9 +553,11 @@ st_Clear(GLcontext *ctx, GLbitfield mask) ctx->DrawBuffer->Visual.stencilBits == 0)) clear_buffers |= PIPE_CLEAR_DEPTHSTENCIL; - st_translate_color(ctx->Color.ClearColor, - ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat, - clearColor); + if (ctx->DrawBuffer->_ColorDrawBuffers[0]) { + st_translate_color(ctx->Color.ClearColor, + ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat, + clearColor); + } st->pipe->clear(st->pipe, clear_buffers, ctx->Color.ClearColor, ctx->Depth.Clear, ctx->Stencil.Clear); _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
