Module: Mesa Branch: r300-bufmgr Commit: 1ca0e2ac03b4fd95ee9cd2dbe82bb7a0e9c1614d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1ca0e2ac03b4fd95ee9cd2dbe82bb7a0e9c1614d
Author: Nicolai Haehnle <[EMAIL PROTECTED]> Date: Mon Sep 29 09:40:50 2008 +0200 r300: Fix crash in r300ClearBuffer That function can currently be called without a radeon_renderbuffer when only Z/stencil needs clearing. --- src/mesa/drivers/dri/r300/r300_ioctl.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c index 36a2736..c3d0d72 100644 --- a/src/mesa/drivers/dri/r300/r300_ioctl.c +++ b/src/mesa/drivers/dri/r300/r300_ioctl.c @@ -93,11 +93,16 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, cp_wait(r300, R300_WAIT_3D | R300_WAIT_3D_CLEAN); end_3d(rmesa); - BEGIN_BATCH(19); - OUT_BATCH_REGSEQ(R300_RB3D_COLOROFFSET0, 1); - OUT_BATCH_RELOC(0, rrb->bo, 0, DRM_RELOC_TXOFFSET); - OUT_BATCH_REGVAL(R300_RB3D_COLORPITCH0, cbpitch); + if (flags & CLEARBUFFER_COLOR) { + assert(rrb != 0); + BEGIN_BATCH(4); + OUT_BATCH_REGSEQ(R300_RB3D_COLOROFFSET0, 1); + OUT_BATCH_RELOC(0, rrb->bo, 0, DRM_RELOC_TXOFFSET); + OUT_BATCH_REGVAL(R300_RB3D_COLORPITCH0, cbpitch); + END_BATCH(); + } + BEGIN_BATCH(15); OUT_BATCH_REGSEQ(RB3D_COLOR_CHANNEL_MASK, 1); if (flags & CLEARBUFFER_COLOR) { OUT_BATCH((ctx->Color.ColorMask[BCOMP] ? RB3D_COLOR_CHANNEL_MASK_BLUE_MASK0 : 0) | _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit