- RENDER_FINISH(swrast,ctx);
-}
-
-
-/*
- * Fallback for ctx->Driver.DrawBuffer()
- */
-void
-_swrast_DrawBuffer( GLcontext *ctx, GLenum mode )
-{
- (void) mode;
- _swrast_use_draw_buffer(ctx);
-}
-
-
-/*
- * Fallback for ctx->Driver.DrawBuffers()
- */
-void
-_swrast_DrawBuffers( GLcontext *ctx, GLsizei n, const GLenum *buffers )
-{
- _swrast_use_draw_buffer(ctx);
-}
-
-
-/*
- * Setup things so that we read/write spans from the user-designated
- * read buffer (set via glReadPixels). We usually just have to call
- * this for glReadPixels, glCopyPixels, etc.
- *
- * XXX this will go away when the last OLD_RENDERBUFFER code is removed.
- * The swrast->CurrentBufferBit var can be totally removed then too.
- */
-void
-_swrast_use_read_buffer( GLcontext *ctx )
-{
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
-
- /* Do this so the software-emulated alpha plane span functions work! */
- swrast->CurrentBufferBit = ctx->ReadBuffer->_ColorReadBufferMask;
- /* Tell the device driver where to read/write spans */
- if (swrast->Driver.SetBuffer)
- swrast->Driver.SetBuffer(ctx, ctx->ReadBuffer, swrast->CurrentBufferBit);
-}
-
-
-/*
- * Setup things so that we read/write spans from the default draw buffer.
- * This is the usual mode that Mesa's software rasterizer operates in.
- *
- * XXX this will go away when the last OLD_RENDERBUFFER code is removed.
- * The swrast->CurrentBufferBit var can be totally removed then too.
- */
-void
-_swrast_use_draw_buffer( GLcontext *ctx )
-{
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
-
- /* The user can specify rendering to zero, one, two, or four color
- * buffers simultaneously with glDrawBuffer()!
- * We don't expect the span/point/line/triangle functions to deal with
- * that mess so we'll iterate over the multiple buffers as needed.
- * But usually we only render to one color buffer at a time.
- * We set ctx->Color._DriverDrawBuffer to that buffer and tell the
- * device driver to use that buffer.
- * Look in s_span.c's multi_write_rgba_span() function to see how
- * we loop over multiple color buffers when needed.
- */
-
- if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_FRONT_LEFT)
- swrast->CurrentBufferBit = BUFFER_BIT_FRONT_LEFT;
- else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_BACK_LEFT)
- swrast->CurrentBufferBit = BUFFER_BIT_BACK_LEFT;
- else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_FRONT_RIGHT)
- swrast->CurrentBufferBit = BUFFER_BIT_FRONT_RIGHT;
- else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_BACK_RIGHT)
- swrast->CurrentBufferBit = BUFFER_BIT_BACK_RIGHT;
- else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_AUX0)
- swrast->CurrentBufferBit = BUFFER_BIT_AUX0;
- else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_AUX1)
- swrast->CurrentBufferBit = BUFFER_BIT_AUX1;
- else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_AUX2)
- swrast->CurrentBufferBit = BUFFER_BIT_AUX2;
- else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_AUX3)
- swrast->CurrentBufferBit = BUFFER_BIT_AUX3;
- else
- /* glDrawBuffer(GL_NONE) */
- swrast->CurrentBufferBit = BUFFER_BIT_FRONT_LEFT; /* we always have this buffer */
-
- if (swrast->Driver.SetBuffer)
- swrast->Driver.SetBuffer(ctx, ctx->DrawBuffer, swrast->CurrentBufferBit);