summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2004-10-02 16:39:09 +0000
committerBrian Paul <[email protected]>2004-10-02 16:39:09 +0000
commit53f82c5aadbb15585754bfacf3237093eccdb2ce (patch)
tree93c013f62d99caf8581c774f768cb7f365350095 /src/mesa/swrast
parent289ffee2a017308a9a97689662293613dc62d9e9 (diff)
added support for GL_ARB_draw_buffers
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_alphabuf.c2
-rw-r--r--src/mesa/swrast/s_buffers.c32
-rw-r--r--src/mesa/swrast/s_context.c4
-rw-r--r--src/mesa/swrast/s_copypix.c6
-rw-r--r--src/mesa/swrast/s_span.c4
-rw-r--r--src/mesa/swrast/swrast.h6
6 files changed, 34 insertions, 20 deletions
diff --git a/src/mesa/swrast/s_alphabuf.c b/src/mesa/swrast/s_alphabuf.c
index b563baf39a0..736ff2d7394 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 26b4f902e14..d05c8dfbf9b 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
@@ -261,6 +261,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
* this for glReadPixels, glCopyPixels, etc.
@@ -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 a678e0b55b2..87d4bf8cdf3 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 f715e5a6267..bfcd9cb8f7b 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 46f59ef3c02..c4a86f141c5 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 7fb0d2a389c..7d8cf8c7a8a 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