From 5c384721522d6a2f9a500e26f0805dda77a31126 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 10 Nov 2006 18:57:30 +0000 Subject: [PATCH] Refactor savageXMesaSet{Back,Front}ClipRects. Refactor savageXMesaSetBackClipRects and savageXMesaSetFrontClipRects into a single new routine called savageXMesaSetClipRects. This allows a few cleanups in the code. --- src/mesa/drivers/dri/savage/savage_init.h | 3 +- src/mesa/drivers/dri/savage/savage_xmesa.c | 33 +++------------------- src/mesa/drivers/dri/savage/savagestate.c | 11 +++----- 3 files changed, 9 insertions(+), 38 deletions(-) diff --git a/src/mesa/drivers/dri/savage/savage_init.h b/src/mesa/drivers/dri/savage/savage_init.h index 9cf8e66b7c2..43fb969c693 100644 --- a/src/mesa/drivers/dri/savage/savage_init.h +++ b/src/mesa/drivers/dri/savage/savage_init.h @@ -83,8 +83,7 @@ typedef struct { #include "savagecontext.h" extern void savageGetLock( savageContextPtr imesa, GLuint flags ); -extern void savageXMesaSetBackClipRects( savageContextPtr imesa ); -extern void savageXMesaSetFrontClipRects( savageContextPtr imesa ); +extern void savageXMesaSetClipRects(savageContextPtr imesa); #define GET_DISPATCH_AGE( imesa ) imesa->sarea->last_dispatch diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index f8d68d7874e..f51e321a4a6 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -724,34 +724,18 @@ void XMesaSwapBuffers(__DRIdrawablePrivate *driDrawPriv) } #endif -void savageXMesaSetFrontClipRects( savageContextPtr imesa ) -{ - __DRIdrawablePrivate *dPriv = imesa->driDrawable; - - imesa->numClipRects = dPriv->numClipRects; - imesa->pClipRects = dPriv->pClipRects; - imesa->drawX = dPriv->x; - imesa->drawY = dPriv->y; - - savageCalcViewport( imesa->glCtx ); -} - -void savageXMesaSetBackClipRects( savageContextPtr imesa ) +void savageXMesaSetClipRects(savageContextPtr imesa) { __DRIdrawablePrivate *dPriv = imesa->driDrawable; - if (dPriv->numBackClipRects == 0) - { - - + if ((dPriv->numBackClipRects == 0) + || (imesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT)) { imesa->numClipRects = dPriv->numClipRects; imesa->pClipRects = dPriv->pClipRects; imesa->drawX = dPriv->x; imesa->drawY = dPriv->y; } else { - - imesa->numClipRects = dPriv->numBackClipRects; imesa->pClipRects = dPriv->pBackClipRects; imesa->drawX = dPriv->backX; @@ -770,16 +754,7 @@ static void savageXMesaWindowMoved( savageContextPtr imesa ) if (0) fprintf(stderr, "savageXMesaWindowMoved\n\n"); - switch (imesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0]) { - case BUFFER_BIT_FRONT_LEFT: - savageXMesaSetFrontClipRects( imesa ); - break; - case BUFFER_BIT_BACK_LEFT: - savageXMesaSetBackClipRects( imesa ); - break; - default: - break; - } + savageXMesaSetClipRects(imesa); driUpdateFramebufferSize(imesa->glCtx, drawable); if (drawable != readable) { diff --git a/src/mesa/drivers/dri/savage/savagestate.c b/src/mesa/drivers/dri/savage/savagestate.c index e554afdbb7e..2f20dc23b6e 100644 --- a/src/mesa/drivers/dri/savage/savagestate.c +++ b/src/mesa/drivers/dri/savage/savagestate.c @@ -647,23 +647,20 @@ static void savageDDDrawBuffer(GLcontext *ctx, GLenum mode ) case BUFFER_BIT_FRONT_LEFT: imesa->IsDouble = GL_FALSE; imesa->regs.s4.destCtrl.ni.offset = imesa->savageScreen->frontOffset>>11; - - imesa->NotFirstFrame = GL_FALSE; - savageXMesaSetFrontClipRects( imesa ); - FALLBACK( ctx, SAVAGE_FALLBACK_DRAW_BUFFER, GL_FALSE ); break; case BUFFER_BIT_BACK_LEFT: imesa->IsDouble = GL_TRUE; imesa->regs.s4.destCtrl.ni.offset = imesa->savageScreen->backOffset>>11; - imesa->NotFirstFrame = GL_FALSE; - savageXMesaSetBackClipRects( imesa ); - FALLBACK( ctx, SAVAGE_FALLBACK_DRAW_BUFFER, GL_FALSE ); break; default: FALLBACK( ctx, SAVAGE_FALLBACK_DRAW_BUFFER, GL_TRUE ); return; } + imesa->NotFirstFrame = GL_FALSE; + savageXMesaSetClipRects(imesa); + FALLBACK(ctx, SAVAGE_FALLBACK_DRAW_BUFFER, GL_FALSE); + if (destCtrl != imesa->regs.s4.destCtrl.ui) imesa->dirty |= SAVAGE_UPLOAD_GLOBAL; } -- 2.30.2