From 16e7aebfe39bdd9c9fecb03ca3b0b617c2b449c8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 4 Sep 2005 22:20:07 +0000 Subject: [PATCH] Simplify radeonSetCliprects(). Remove the 'mode' parameter. --- src/mesa/drivers/dri/radeon/radeon_lock.c | 5 +--- src/mesa/drivers/dri/radeon/radeon_state.c | 35 ++++++++++++---------- src/mesa/drivers/dri/radeon/radeon_state.h | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_lock.c b/src/mesa/drivers/dri/radeon/radeon_lock.c index 144e11d4910..591595e6321 100644 --- a/src/mesa/drivers/dri/radeon/radeon_lock.c +++ b/src/mesa/drivers/dri/radeon/radeon_lock.c @@ -89,10 +89,7 @@ void radeonGetLock( radeonContextPtr rmesa, GLuint flags ) if ( rmesa->lastStamp != dPriv->lastStamp ) { radeonUpdatePageFlipping( rmesa ); - if (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT) - radeonSetCliprects( rmesa, GL_BACK_LEFT ); - else - radeonSetCliprects( rmesa, GL_FRONT_LEFT ); + radeonSetCliprects( rmesa ); radeonUpdateViewportOffset( rmesa->glCtx ); rmesa->lastStamp = dPriv->lastStamp; } diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index e0e55461a2c..0503fff68cd 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -1468,6 +1468,11 @@ static void radeonClearStencil( GLcontext *ctx, GLint s ) #define SUBPIXEL_X 0.125 #define SUBPIXEL_Y 0.125 + +/** + * Called when window size or position changes or viewport or depth range + * state is changed. We update the hardware viewport state here. + */ void radeonUpdateWindow( GLcontext *ctx ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); @@ -1617,16 +1622,15 @@ static void radeonLogicOpCode( GLcontext *ctx, GLenum opcode ) } -void radeonSetCliprects( radeonContextPtr rmesa, GLenum mode ) +/** + * Set up the cliprects for either front or back-buffer drawing. + */ +void radeonSetCliprects( radeonContextPtr rmesa ) { __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; - switch ( mode ) { - case GL_FRONT_LEFT: - rmesa->numClipRects = dPriv->numClipRects; - rmesa->pClipRects = dPriv->pClipRects; - break; - case GL_BACK_LEFT: + if (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] + == BUFFER_BIT_BACK_LEFT) { /* Can't ignore 2d windows if we are page flipping. */ if ( dPriv->numBackClipRects == 0 || rmesa->doPageFlip ) { @@ -1637,10 +1641,11 @@ void radeonSetCliprects( radeonContextPtr rmesa, GLenum mode ) rmesa->numClipRects = dPriv->numBackClipRects; rmesa->pClipRects = dPriv->pBackClipRects; } - break; - default: - fprintf(stderr, "bad mode in radeonSetCliprects\n"); - return; + } + else { + /* front buffer (or none, or multiple buffers */ + rmesa->numClipRects = dPriv->numClipRects; + rmesa->pClipRects = dPriv->pClipRects; } if (rmesa->state.scissor.enabled) @@ -1667,19 +1672,17 @@ static void radeonDrawBuffer( GLcontext *ctx, GLenum mode ) */ switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) { case BUFFER_BIT_FRONT_LEFT: - FALLBACK( rmesa, RADEON_FALLBACK_DRAW_BUFFER, GL_FALSE ); - radeonSetCliprects( rmesa, GL_FRONT_LEFT ); - break; case BUFFER_BIT_BACK_LEFT: FALLBACK( rmesa, RADEON_FALLBACK_DRAW_BUFFER, GL_FALSE ); - radeonSetCliprects( rmesa, GL_BACK_LEFT ); break; default: - /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */ + /* 0 (GL_NONE) buffers or multiple color drawing buffers */ FALLBACK( rmesa, RADEON_FALLBACK_DRAW_BUFFER, GL_TRUE ); return; } + radeonSetCliprects( rmesa ); + /* We'll set the drawing engine's offset/pitch parameters later * when we update other state. */ diff --git a/src/mesa/drivers/dri/radeon/radeon_state.h b/src/mesa/drivers/dri/radeon/radeon_state.h index e9074f51e7d..c9f5c05cf4d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.h +++ b/src/mesa/drivers/dri/radeon/radeon_state.h @@ -45,7 +45,7 @@ extern void radeonInitStateFuncs( GLcontext *ctx ); extern void radeonUpdateMaterial( GLcontext *ctx ); -extern void radeonSetCliprects( radeonContextPtr rmesa, GLenum mode ); +extern void radeonSetCliprects( radeonContextPtr rmesa ); extern void radeonRecalcScissorRects( radeonContextPtr rmesa ); extern void radeonUpdateViewportOffset( GLcontext *ctx ); extern void radeonUpdateWindow( GLcontext *ctx ); -- 2.30.2