From 53f82c5aadbb15585754bfacf3237093eccdb2ce Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 2 Oct 2004 16:39:09 +0000 Subject: added support for GL_ARB_draw_buffers --- src/mesa/swrast/s_buffers.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'src/mesa/swrast/s_buffers.c') diff --git a/src/mesa/swrast/s_buffers.c b/src/mesa/swrast/s_buffers.c index 26b4f902e1..d05c8dfbf9 100644 --- a/src/mesa/swrast/s_buffers.c +++ b/src/mesa/swrast/s_buffers.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.1 + * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * @@ -147,7 +147,7 @@ clear_color_buffers(GLcontext *ctx) /* loop over four possible dest color buffers */ for (bufferBit = 1; bufferBit <= DD_AUX3_BIT; bufferBit <<= 1) { - if (bufferBit & ctx->Color._DrawDestMask) { + if (bufferBit & ctx->Color._DrawDestMask[0]) { (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, bufferBit); if (colorMask != 0xffffffff) { @@ -199,7 +199,7 @@ _swrast_Clear( GLcontext *ctx, GLbitfield mask, /* do software clearing here */ if (mask) { - if (mask & ctx->Color._DrawDestMask) { + if (mask & ctx->Color._DrawDestMask[0]) { clear_color_buffers(ctx); /* clear software-based alpha buffer(s) */ if (ctx->DrawBuffer->UseSoftwareAlphaBuffers @@ -260,6 +260,16 @@ _swrast_DrawBuffer( GLcontext *ctx, GLenum mode ) } +/* + * 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 @@ -297,21 +307,21 @@ _swrast_use_draw_buffer( GLcontext *ctx ) * we loop over multiple color buffers when needed. */ - if (ctx->Color._DrawDestMask & DD_FRONT_LEFT_BIT) + if (ctx->Color._DrawDestMask[0] & DD_FRONT_LEFT_BIT) swrast->CurrentBufferBit = DD_FRONT_LEFT_BIT; - else if (ctx->Color._DrawDestMask & DD_BACK_LEFT_BIT) + else if (ctx->Color._DrawDestMask[0] & DD_BACK_LEFT_BIT) swrast->CurrentBufferBit = DD_BACK_LEFT_BIT; - else if (ctx->Color._DrawDestMask & DD_FRONT_RIGHT_BIT) + else if (ctx->Color._DrawDestMask[0] & DD_FRONT_RIGHT_BIT) swrast->CurrentBufferBit = DD_FRONT_RIGHT_BIT; - else if (ctx->Color._DrawDestMask & DD_BACK_RIGHT_BIT) + else if (ctx->Color._DrawDestMask[0] & DD_BACK_RIGHT_BIT) swrast->CurrentBufferBit = DD_BACK_RIGHT_BIT; - else if (ctx->Color._DrawDestMask & DD_AUX0_BIT) + else if (ctx->Color._DrawDestMask[0] & DD_AUX0_BIT) swrast->CurrentBufferBit = DD_AUX0_BIT; - else if (ctx->Color._DrawDestMask & DD_AUX1_BIT) + else if (ctx->Color._DrawDestMask[0] & DD_AUX1_BIT) swrast->CurrentBufferBit = DD_AUX1_BIT; - else if (ctx->Color._DrawDestMask & DD_AUX2_BIT) + else if (ctx->Color._DrawDestMask[0] & DD_AUX2_BIT) swrast->CurrentBufferBit = DD_AUX2_BIT; - else if (ctx->Color._DrawDestMask & DD_AUX3_BIT) + else if (ctx->Color._DrawDestMask[0] & DD_AUX3_BIT) swrast->CurrentBufferBit = DD_AUX3_BIT; else /* glDrawBuffer(GL_NONE) */ -- cgit v1.2.3