diff options
author | Nicolai Haehnle <nhaehnle@gmail.com> | 2008-09-29 09:40:50 +0200 |
---|---|---|
committer | Nicolai Haehnle <nhaehnle@gmail.com> | 2008-09-29 09:40:50 +0200 |
commit | 1ca0e2ac03b4fd95ee9cd2dbe82bb7a0e9c1614d (patch) | |
tree | 6013eed6a6f23191c20668f663ee4b0b4da311e0 | |
parent | 4d19a9b9ac84a972d0807ff931df596418d9a7f4 (diff) |
r300: Fix crash in r300ClearBuffer
That function can currently be called without a radeon_renderbuffer
when only Z/stencil needs clearing.
-rw-r--r-- | 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 36a273638a..c3d0d727ee 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) | |