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_alphabuf.c | 2 +- src/mesa/swrast/s_buffers.c | 32 +++++++++++++++++++++----------- src/mesa/swrast/s_context.c | 4 ++-- src/mesa/swrast/s_copypix.c | 6 +++--- src/mesa/swrast/s_span.c | 4 ++-- src/mesa/swrast/swrast.h | 6 +++++- 6 files changed, 34 insertions(+), 20 deletions(-) (limited to 'src/mesa/swrast') diff --git a/src/mesa/swrast/s_alphabuf.c b/src/mesa/swrast/s_alphabuf.c index b563baf39a..736ff2d739 100644 --- a/src/mesa/swrast/s_alphabuf.c +++ b/src/mesa/swrast/s_alphabuf.c @@ -112,7 +112,7 @@ _swrast_clear_alpha_buffers( GLcontext *ctx ) /* loop over four possible alpha buffers */ for (bufferBit = 1; bufferBit <= 8; bufferBit = bufferBit << 1) { - if (bufferBit & ctx->Color._DrawDestMask) { + if (bufferBit & ctx->Color._DrawDestMask[0]) { GLchan *buffer; if (bufferBit == DD_FRONT_LEFT_BIT) { buffer = ctx->DrawBuffer->FrontLeftAlpha; 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) */ diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index a678e0b55b..87d4bf8cdf 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.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. * @@ -93,7 +93,7 @@ _swrast_update_rasterflags( GLcontext *ctx ) * MULTI_DRAW_BIT flag. Also set it if we're drawing to no * buffers or the RGBA or CI mask disables all writes. */ - if (_mesa_bitcount(ctx->Color._DrawDestMask) != 1) { + if (_mesa_bitcount(ctx->Color._DrawDestMask[0]) != 1) { /* more than one color buffer designated for writing (or zero buffers) */ rasterMask |= MULTI_DRAW_BIT; } diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c index f715e5a626..bfcd9cb8f7 100644 --- a/src/mesa/swrast/s_copypix.c +++ b/src/mesa/swrast/s_copypix.c @@ -158,7 +158,7 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, } /* If read and draw buffer are different we must do buffer switching */ - changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer + changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer[0] || ctx->DrawBuffer != ctx->ReadBuffer; @@ -326,7 +326,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, } /* If read and draw buffer are different we must do buffer switching */ - changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer + changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer[0] || ctx->DrawBuffer != ctx->ReadBuffer; if (overlapping) { @@ -466,7 +466,7 @@ copy_ci_pixels( GLcontext *ctx, GLint srcx, GLint srcy, _swrast_span_default_fog(ctx, &span); /* If read and draw buffer are different we must do buffer switching */ - changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer + changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer[0] || ctx->DrawBuffer != ctx->ReadBuffer; if (overlapping) { diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 46f59ef3c0..c4a86f141c 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -749,7 +749,7 @@ multi_write_index_span( GLcontext *ctx, struct sw_span *span ) /* loop over four possible dest color buffers */ for (bufferBit = 1; bufferBit <= 8; bufferBit <<= 1) { - if (bufferBit & ctx->Color._DrawDestMask) { + if (bufferBit & ctx->Color._DrawDestMask[0]) { GLuint indexTmp[MAX_WIDTH]; ASSERT(span->end < MAX_WIDTH); @@ -806,7 +806,7 @@ multi_write_rgba_span( GLcontext *ctx, struct sw_span *span ) /* loop over four possible dest color buffers */ for (bufferBit = 1; bufferBit <= 8; bufferBit <<= 1) { - if (bufferBit & ctx->Color._DrawDestMask) { + if (bufferBit & ctx->Color._DrawDestMask[0]) { GLchan rgbaTmp[MAX_WIDTH][4]; ASSERT(span->end < MAX_WIDTH); diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h index 7fb0d2a389..7d8cf8c7a8 100644 --- a/src/mesa/swrast/swrast.h +++ b/src/mesa/swrast/swrast.h @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.1 + * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * @@ -141,6 +141,10 @@ extern void _swrast_DrawBuffer( GLcontext *ctx, GLenum mode ); +extern void +_swrast_DrawBuffers( GLcontext *ctx, GLsizei n, const GLenum *buffers ); + + /* Reset the stipple counter */ extern void -- cgit v1.2.3