diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2005-09-01 04:03:44 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2005-09-01 04:03:44 +0000 |
commit | fcbfeb5d28aea87c60f2d02daa213d0c0c2516e8 (patch) | |
tree | 783872f7936fc274c1786dd8a06e227494939c7a /src/mesa/drivers/dri/r200/r200_state.c | |
parent | 982e8e4d5c95e9e9040b4b70d7322a2a8a9396d9 (diff) |
Finish up some of the gl_renderbuffer work.
Use driRenderbuffer's offset, pitch fields in the span routines.
Remove the SetBuffer driver function.
Consolidate the code for setting CTX_RB3D_COLOROFFSET and CTX_RB3D_COLORPITCH
state in new radeonUpdateDrawBuffer() function.
Old code is surrounded by #if 000 / #endif, temporarily.
Diffstat (limited to 'src/mesa/drivers/dri/r200/r200_state.c')
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_state.c | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 93f6dfc6d7..36dd9ca887 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -48,7 +48,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tnl/t_pipeline.h" #include "swrast_setup/swrast_setup.h" - #include "r200_context.h" #include "r200_ioctl.h" #include "r200_state.h" @@ -57,6 +56,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r200_swtcl.h" #include "r200_vtxfmt.h" +#include "drirenderbuffer.h" + /* ============================================================= * Alpha blending @@ -1794,7 +1795,8 @@ static void r200DrawBuffer( GLcontext *ctx, GLenum mode ) R200_FIREVERTICES(rmesa); /* don't pipeline cliprect changes */ /* - * _DrawDestMask is easier to cope with than <mode>. + * _ColorDrawBufferMask is easier to cope with than <mode>. + * Check for software fallback, update cliprects. */ switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) { case BUFFER_BIT_FRONT_LEFT: @@ -1811,6 +1813,7 @@ static void r200DrawBuffer( GLcontext *ctx, GLenum mode ) return; } +#if 000 /* We want to update the s/w rast state too so that r200SetBuffer() * gets called. */ @@ -1824,6 +1827,11 @@ static void r200DrawBuffer( GLcontext *ctx, GLenum mode ) if (rmesa->sarea->tiling_enabled) { rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= R200_COLOR_TILE_ENABLE; } +#else + /* We'll set the drawing engine's offset/pitch parameters later + * when we update other state. + */ +#endif } @@ -2218,11 +2226,56 @@ static void update_texturematrix( GLcontext *ctx ) +/** + * Tell the card where to render (offset, pitch). + * Effected by glDrawBuffer, etc + */ +void +r200UpdateDrawBuffer(GLcontext *ctx) +{ + r200ContextPtr rmesa = R200_CONTEXT(ctx); + struct gl_framebuffer *fb = ctx->DrawBuffer; + driRenderbuffer *drb; + + if (fb->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT) { + /* draw to front */ + drb = (driRenderbuffer *) fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer; + } + else if (fb->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT) { + /* draw to back */ + drb = (driRenderbuffer *) fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer; + } + else { + /* drawing to multiple buffers, or none */ + return; + } + + assert(drb); + assert(drb->flippedPitch); + + R200_STATECHANGE( rmesa, ctx ); + + /* Note: we used the (possibly) page-flipped values */ + rmesa->hw.ctx.cmd[CTX_RB3D_COLOROFFSET] + = ((drb->flippedOffset + rmesa->r200Screen->fbLocation) + & R200_COLOROFFSET_MASK); + rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] = drb->flippedPitch; + if (rmesa->sarea->tiling_enabled) { + rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= R200_COLOR_TILE_ENABLE; + } +} + + + void r200ValidateState( GLcontext *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint new_state = rmesa->NewGLState; + if (new_state & (_NEW_BUFFERS | _NEW_COLOR | _NEW_PIXEL)) { + r200UpdateDrawBuffer(ctx); + } + if (new_state & _NEW_TEXTURE) { r200UpdateTextureState( ctx ); new_state |= rmesa->NewGLState; /* may add TEXTURE_MATRIX */ |