summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2004-03-21 17:05:03 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2004-03-21 17:05:03 +0000
commit894844a8d956a0ee5f95836331dc318f49fdb845 (patch)
tree92aab765e7c82edf310ce1a5d3f1b25cfabc5156
parent009501642533c7378fc4f061f1abe2ed4473a3f6 (diff)
Implemented support for software-based AUX color buffers.
Only available with Xlib driver for now. Assorted clean-ups related to Draw/ReadBuffer(). Renamed FRONT_LEFT_BIT -> DD_FRONT_LEFT_BIT, etc.
-rw-r--r--src/mesa/drivers/allegro/amesa.c4
-rw-r--r--src/mesa/drivers/dri/fb/fb_dri.c4
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_state.c11
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_span.c6
-rw-r--r--src/mesa/drivers/dri/i810/i810context.c9
-rw-r--r--src/mesa/drivers/dri/i810/i810span.c4
-rw-r--r--src/mesa/drivers/dri/i810/i810state.c6
-rw-r--r--src/mesa/drivers/dri/i830/i830_context.c4
-rw-r--r--src/mesa/drivers/dri/i830/i830_span.c4
-rw-r--r--src/mesa/drivers/dri/i830/i830_state.c4
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_lock.c2
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_span.c8
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_state.c8
-rw-r--r--src/mesa/drivers/dri/mga/mgaspan.c4
-rw-r--r--src/mesa/drivers/dri/mga/mgastate.c4
-rw-r--r--src/mesa/drivers/dri/r128/r128_lock.c2
-rw-r--r--src/mesa/drivers/dri/r128/r128_span.c4
-rw-r--r--src/mesa/drivers/dri/r128/r128_state.c4
-rw-r--r--src/mesa/drivers/dri/r200/r200_lock.c4
-rw-r--r--src/mesa/drivers/dri/r200/r200_span.c4
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.c4
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_ioctl.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_lock.c4
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_span.c4
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_state.c4
-rw-r--r--src/mesa/drivers/dri/savage/savage_xmesa.c4
-rw-r--r--src/mesa/drivers/dri/savage/savagespan.c4
-rw-r--r--src/mesa/drivers/dri/savage/savagestate.c6
-rw-r--r--src/mesa/drivers/dri/sis/sis_span.c4
-rw-r--r--src/mesa/drivers/dri/sis/sis_state.c4
-rw-r--r--src/mesa/drivers/dri/sis/sis_tris.c2
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_render.c4
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_span.c4
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_state.c4
-rw-r--r--src/mesa/drivers/dri/unichrome/via_span.c4
-rw-r--r--src/mesa/drivers/fbdev/glfbdev.c4
-rw-r--r--src/mesa/drivers/ggi/ggimesa.c4
-rw-r--r--src/mesa/drivers/glide/fxdd.c7
-rw-r--r--src/mesa/drivers/glide/fxddspan.c4
-rw-r--r--src/mesa/drivers/osmesa/osmesa.c2
-rw-r--r--src/mesa/drivers/x11/fakeglx.c23
-rw-r--r--src/mesa/drivers/x11/xm_api.c3
-rw-r--r--src/mesa/drivers/x11/xm_dd.c15
-rw-r--r--src/mesa/drivers/x11/xm_line.c2
-rw-r--r--src/mesa/drivers/x11/xm_tri.c2
-rw-r--r--src/mesa/main/blend.c10
-rw-r--r--src/mesa/main/buffers.c72
-rw-r--r--src/mesa/main/config.h4
-rw-r--r--src/mesa/main/context.c52
-rw-r--r--src/mesa/main/dd.h20
-rw-r--r--src/mesa/main/get.c10
-rw-r--r--src/mesa/main/mtypes.h45
-rw-r--r--src/mesa/main/pixel.c10
-rw-r--r--src/mesa/sources1
-rw-r--r--src/mesa/swrast/s_alphabuf.c16
-rw-r--r--src/mesa/swrast/s_auxbuffer.c121
-rw-r--r--src/mesa/swrast/s_auxbuffer.h41
-rw-r--r--src/mesa/swrast/s_buffers.c109
-rw-r--r--src/mesa/swrast/s_context.c9
-rw-r--r--src/mesa/swrast/s_context.h3
-rw-r--r--src/mesa/swrast/s_span.c4
-rw-r--r--src/mesa/swrast/swrast.h16
62 files changed, 492 insertions, 275 deletions
diff --git a/src/mesa/drivers/allegro/amesa.c b/src/mesa/drivers/allegro/amesa.c
index 1462161781..92fd1b7068 100644
--- a/src/mesa/drivers/allegro/amesa.c
+++ b/src/mesa/drivers/allegro/amesa.c
@@ -117,10 +117,10 @@ static GLboolean set_buffer(GLcontext *ctx, GLframebuffer *buffer, GLuint bit)
AMesaContext context = (AMesaContext)(ctx->DriverCtx);
GLboolean ok = GL_TRUE;
- if (bit == FRONT_LEFT_BIT)
+ if (bit == DD_FRONT_LEFT_BIT)
context->Buffer->Active = context->Buffer->Screen;
- else if (bit == BACK_LEFT)
+ else if (bit == DD_BACK_LEFT)
{
if (context->Buffer->Background)
context->Buffer->Active = context->Buffer->Background;
diff --git a/src/mesa/drivers/dri/fb/fb_dri.c b/src/mesa/drivers/dri/fb/fb_dri.c
index 2589c07142..0111e36384 100644
--- a/src/mesa/drivers/dri/fb/fb_dri.c
+++ b/src/mesa/drivers/dri/fb/fb_dri.c
@@ -147,10 +147,10 @@ set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit )
switch (bufferBit) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
dPriv->currentBuffer = dPriv->frontBuffer;
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
dPriv->currentBuffer = dPriv->backBuffer;
break;
default:
diff --git a/src/mesa/drivers/dri/ffb/ffb_state.c b/src/mesa/drivers/dri/ffb/ffb_state.c
index eef7af4e5d..86f92c83db 100644
--- a/src/mesa/drivers/dri/ffb/ffb_state.c
+++ b/src/mesa/drivers/dri/ffb/ffb_state.c
@@ -469,21 +469,21 @@ static void ffbDDDrawBuffer(GLcontext *ctx, GLenum buffer)
#endif
fbc &= ~(FFB_FBC_WB_AB | FFB_FBC_RB_MASK);
switch (buffer) {
- case FRONT_LEFT_BIT:
+ case GL_FRONT:
if (fmesa->back_buffer == 0)
fbc |= FFB_FBC_WB_B | FFB_FBC_RB_B;
else
fbc |= FFB_FBC_WB_A | FFB_FBC_RB_A;
break;
- case BACK_LEFT_BIT:
+ case GL_BACK:
if (fmesa->back_buffer == 0)
fbc |= FFB_FBC_WB_A | FFB_FBC_RB_A;
else
fbc |= FFB_FBC_WB_B | FFB_FBC_RB_B;
break;
- case BACK_LEFT_BIT | FRONT_LEFT_BIT:
+ case GL_FRONT_AND_BACK:
fbc |= FFB_FBC_WB_AB;
break;
@@ -519,14 +519,14 @@ static void ffbDDSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
#endif
fbc &= ~(FFB_FBC_RB_MASK);
switch (bufferBit) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
if (fmesa->back_buffer == 0)
fbc |= FFB_FBC_RB_B;
else
fbc |= FFB_FBC_RB_A;
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
if (fmesa->back_buffer == 0)
fbc |= FFB_FBC_RB_A;
else
@@ -534,6 +534,7 @@ static void ffbDDSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
break;
default:
+ _mesa_problem(ctx, "Unexpected buffer in ffbDDSetBuffer()");
return;
};
diff --git a/src/mesa/drivers/dri/gamma/gamma_span.c b/src/mesa/drivers/dri/gamma/gamma_span.c
index 35cbd8ba7e..533166ddbb 100644
--- a/src/mesa/drivers/dri/gamma/gamma_span.c
+++ b/src/mesa/drivers/dri/gamma/gamma_span.c
@@ -268,12 +268,14 @@ static void gammaSetBuffer( GLcontext *ctx,
gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
switch ( bufferBit ) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
gmesa->readOffset = 0;
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
gmesa->readOffset = gmesa->driScreen->fbHeight * gmesa->driScreen->fbWidth * gmesa->gammaScreen->cpp;
break;
+ default:
+ _mesa_problem(ctx, "Unexpected buffer 0x%x in gammaSetBuffer()", bufferBit);
}
}
diff --git a/src/mesa/drivers/dri/i810/i810context.c b/src/mesa/drivers/dri/i810/i810context.c
index 780f0492e0..0822b6b8b1 100644
--- a/src/mesa/drivers/dri/i810/i810context.c
+++ b/src/mesa/drivers/dri/i810/i810context.c
@@ -385,13 +385,12 @@ void i810XMesaSetBackClipRects( i810ContextPtr imesa )
static void i810XMesaWindowMoved( i810ContextPtr imesa )
{
switch (imesa->glCtx->Color._DrawDestMask) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
i810XMesaSetFrontClipRects( imesa );
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
i810XMesaSetBackClipRects( imesa );
break;
- case GL_FRONT_LEFT:
default:
/* glDrawBuffer(GL_NONE or GL_FRONT_AND_BACK): software fallback */
i810XMesaSetFrontClipRects( imesa );
@@ -450,10 +449,10 @@ i810UpdatePageFlipping( i810ContextPtr imesa )
int front = 0;
switch (ctx->Color._DrawDestMask) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
front = 1;
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
front = 0;
break;
default:
diff --git a/src/mesa/drivers/dri/i810/i810span.c b/src/mesa/drivers/dri/i810/i810span.c
index 53bd15162f..52fb1754df 100644
--- a/src/mesa/drivers/dri/i810/i810span.c
+++ b/src/mesa/drivers/dri/i810/i810span.c
@@ -123,13 +123,13 @@ static void i810SetBuffer(GLcontext *ctx, GLframebuffer *buffer,
(void) buffer;
switch(bufferBit) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
if ( imesa->sarea->pf_current_page == 1)
imesa->readMap = imesa->i810Screen->back.map;
else
imesa->readMap = (char*)imesa->driScreen->pFB;
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
if ( imesa->sarea->pf_current_page == 1)
imesa->readMap = (char*)imesa->driScreen->pFB;
else
diff --git a/src/mesa/drivers/dri/i810/i810state.c b/src/mesa/drivers/dri/i810/i810state.c
index e00af656f0..4a1c15f8af 100644
--- a/src/mesa/drivers/dri/i810/i810state.c
+++ b/src/mesa/drivers/dri/i810/i810state.c
@@ -285,10 +285,10 @@ void i810DrawBuffer(GLcontext *ctx, GLenum mode )
* _DrawDestMask is easier to cope with than <mode>.
*/
switch ( ctx->Color._DrawDestMask ) {
- case FRONT_LEFT_BIT:
- front=1;
+ case DD_FRONT_LEFT_BIT:
+ front = 1;
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
front = 0;
break;
default:
diff --git a/src/mesa/drivers/dri/i830/i830_context.c b/src/mesa/drivers/dri/i830/i830_context.c
index a692203ce2..7f306f2110 100644
--- a/src/mesa/drivers/dri/i830/i830_context.c
+++ b/src/mesa/drivers/dri/i830/i830_context.c
@@ -461,10 +461,10 @@ void i830XMesaSetBackClipRects( i830ContextPtr imesa )
static void i830XMesaWindowMoved( i830ContextPtr imesa )
{
switch (imesa->glCtx->Color._DrawDestMask) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
i830XMesaSetFrontClipRects( imesa );
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
i830XMesaSetBackClipRects( imesa );
break;
default:
diff --git a/src/mesa/drivers/dri/i830/i830_span.c b/src/mesa/drivers/dri/i830/i830_span.c
index 34830bf58c..28610923e3 100644
--- a/src/mesa/drivers/dri/i830/i830_span.c
+++ b/src/mesa/drivers/dri/i830/i830_span.c
@@ -267,10 +267,10 @@ static void i830SetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
GLuint bufferBit)
{
i830ContextPtr imesa = I830_CONTEXT(ctx);
- if (bufferBit == FRONT_LEFT_BIT) {
+ if (bufferBit == DD_FRONT_LEFT_BIT) {
imesa->drawMap = (char *)imesa->driScreen->pFB;
imesa->readMap = (char *)imesa->driScreen->pFB;
- } else if (bufferBit == BACK_LEFT_BIT) {
+ } else if (bufferBit == DD_BACK_LEFT_BIT) {
imesa->drawMap = imesa->i830Screen->back.map;
imesa->readMap = imesa->i830Screen->back.map;
} else {
diff --git a/src/mesa/drivers/dri/i830/i830_state.c b/src/mesa/drivers/dri/i830/i830_state.c
index 0fde909571..a8edf85426 100644
--- a/src/mesa/drivers/dri/i830/i830_state.c
+++ b/src/mesa/drivers/dri/i830/i830_state.c
@@ -831,14 +831,14 @@ static void i830DrawBuffer(GLcontext *ctx, GLenum mode )
* _DrawDestMask is easier to cope with than <mode>.
*/
switch ( ctx->Color._DrawDestMask ) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
I830_FIREVERTICES(imesa);
I830_STATECHANGE(imesa, I830_UPLOAD_BUFFERS);
imesa->BufferSetup[I830_DESTREG_CBUFADDR] = imesa->i830Screen->fbOffset;
i830XMesaSetFrontClipRects( imesa );
FALLBACK( imesa, I830_FALLBACK_DRAW_BUFFER, GL_FALSE );
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
I830_FIREVERTICES(imesa);
I830_STATECHANGE(imesa, I830_UPLOAD_BUFFERS);
imesa->BufferSetup[I830_DESTREG_CBUFADDR] =
diff --git a/src/mesa/drivers/dri/mach64/mach64_lock.c b/src/mesa/drivers/dri/mach64/mach64_lock.c
index 465bcb3ab8..f95c1595cd 100644
--- a/src/mesa/drivers/dri/mach64/mach64_lock.c
+++ b/src/mesa/drivers/dri/mach64/mach64_lock.c
@@ -69,7 +69,7 @@ void mach64GetLock( mach64ContextPtr mmesa, GLuint flags )
if ( mmesa->lastStamp != dPriv->lastStamp ) {
mmesa->lastStamp = dPriv->lastStamp;
- if (mmesa->glCtx->Color._DrawDestMask == BACK_LEFT_BIT)
+ if (mmesa->glCtx->Color._DrawDestMask == DD_BACK_LEFT_BIT)
mach64SetCliprects( mmesa->glCtx, GL_BACK_LEFT );
else
mach64SetCliprects( mmesa->glCtx, GL_FRONT_LEFT );
diff --git a/src/mesa/drivers/dri/mach64/mach64_span.c b/src/mesa/drivers/dri/mach64/mach64_span.c
index 4c668ba90e..3e553a9094 100644
--- a/src/mesa/drivers/dri/mach64/mach64_span.c
+++ b/src/mesa/drivers/dri/mach64/mach64_span.c
@@ -200,15 +200,15 @@ static void mach64DDSetBuffer( GLcontext *ctx,
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
switch ( bufferBit ) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf(stderr,"%s: FRONT_LEFT_BIT\n", __FUNCTION__);
+ fprintf(stderr,"%s: DD_FRONT_LEFT_BIT\n", __FUNCTION__);
mmesa->drawOffset = mmesa->readOffset = mmesa->mach64Screen->frontOffset;
mmesa->drawPitch = mmesa->readPitch = mmesa->mach64Screen->frontPitch;
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf(stderr,"%s: BACK_LEFT_BIT\n", __FUNCTION__);
+ fprintf(stderr,"%s: DD_BACK_LEFT_BIT\n", __FUNCTION__);
mmesa->drawOffset = mmesa->readOffset = mmesa->mach64Screen->backOffset;
mmesa->drawPitch = mmesa->readPitch = mmesa->mach64Screen->backPitch;
break;
diff --git a/src/mesa/drivers/dri/mach64/mach64_state.c b/src/mesa/drivers/dri/mach64/mach64_state.c
index 9c37d85490..f81e91a3c9 100644
--- a/src/mesa/drivers/dri/mach64/mach64_state.c
+++ b/src/mesa/drivers/dri/mach64/mach64_state.c
@@ -730,17 +730,17 @@ static void mach64DDDrawBuffer( GLcontext *ctx, GLenum mode )
* _DrawDestMask is easier to cope with than <mode>.
*/
switch ( ctx->Color._DrawDestMask ) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
FALLBACK( mmesa, MACH64_FALLBACK_DRAW_BUFFER, GL_FALSE );
mach64SetCliprects( ctx, GL_FRONT_LEFT );
if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf(stderr,"%s: FRONT_LEFT_BIT\n", __FUNCTION__);
+ fprintf(stderr,"%s: DD_FRONT_LEFT_BIT\n", __FUNCTION__);
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
FALLBACK( mmesa, MACH64_FALLBACK_DRAW_BUFFER, GL_FALSE );
mach64SetCliprects( ctx, GL_BACK_LEFT );
if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf(stderr,"%s: BACK_LEFT_BIT\n", __FUNCTION__);
+ fprintf(stderr,"%s: DD_BACK_LEFT_BIT\n", __FUNCTION__);
break;
default:
/* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
diff --git a/src/mesa/drivers/dri/mga/mgaspan.c b/src/mesa/drivers/dri/mga/mgaspan.c
index c8a55d4cd1..a72c4d7fb0 100644
--- a/src/mesa/drivers/dri/mga/mgaspan.c
+++ b/src/mesa/drivers/dri/mga/mgaspan.c
@@ -244,9 +244,9 @@ static void mgaDDSetBuffer(GLcontext *ctx, GLframebuffer *buffer,
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
unsigned int offset;
- assert( (bufferBit == FRONT_LEFT_BIT) || (bufferBit == BACK_LEFT_BIT) );
+ assert((bufferBit == DD_FRONT_LEFT_BIT) || (bufferBit == DD_BACK_LEFT_BIT));
- offset = (bufferBit == FRONT_LEFT_BIT)
+ offset = (bufferBit == DD_FRONT_LEFT_BIT)
? mmesa->mgaScreen->frontOffset
: mmesa->mgaScreen->backOffset;
diff --git a/src/mesa/drivers/dri/mga/mgastate.c b/src/mesa/drivers/dri/mga/mgastate.c
index 56d9d77ca5..fce083689b 100644
--- a/src/mesa/drivers/dri/mga/mgastate.c
+++ b/src/mesa/drivers/dri/mga/mgastate.c
@@ -824,14 +824,14 @@ static void mgaDDDrawBuffer(GLcontext *ctx, GLenum mode )
* _DrawDestMask is easier to cope with than <mode>.
*/
switch ( ctx->Color._DrawDestMask ) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
mmesa->setup.dstorg = mmesa->mgaScreen->frontOffset;
mmesa->dirty |= MGA_UPLOAD_CONTEXT;
mmesa->draw_buffer = MGA_FRONT;
mgaXMesaSetFrontClipRects( mmesa );
FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_FALSE );
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
mmesa->setup.dstorg = mmesa->mgaScreen->backOffset;
mmesa->draw_buffer = MGA_BACK;
mmesa->dirty |= MGA_UPLOAD_CONTEXT;
diff --git a/src/mesa/drivers/dri/r128/r128_lock.c b/src/mesa/drivers/dri/r128/r128_lock.c
index 47ad1c8246..8508f7dfe8 100644
--- a/src/mesa/drivers/dri/r128/r128_lock.c
+++ b/src/mesa/drivers/dri/r128/r128_lock.c
@@ -52,7 +52,7 @@ r128UpdatePageFlipping( r128ContextPtr rmesa )
rmesa->doPageFlip = rmesa->sarea->pfAllowPageFlip;
- use_back = (rmesa->glCtx->Color._DrawDestMask == BACK_LEFT_BIT);
+ use_back = (rmesa->glCtx->Color._DrawDestMask == DD_BACK_LEFT_BIT);
use_back ^= (rmesa->sarea->pfCurrentPage == 1);
if ( R128_DEBUG & DEBUG_VERBOSE_API )
diff --git a/src/mesa/drivers/dri/r128/r128_span.c b/src/mesa/drivers/dri/r128/r128_span.c
index c6f3195942..db2ec44fbf 100644
--- a/src/mesa/drivers/dri/r128/r128_span.c
+++ b/src/mesa/drivers/dri/r128/r128_span.c
@@ -390,7 +390,7 @@ static void r128DDSetBuffer( GLcontext *ctx,
r128ContextPtr rmesa = R128_CONTEXT(ctx);
switch ( bufferBit ) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
if ( rmesa->sarea->pfCurrentPage == 1 ) {
rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->backOffset;
rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->backPitch;
@@ -399,7 +399,7 @@ static void r128DDSetBuffer( GLcontext *ctx,
rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->frontPitch;
}
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
if ( rmesa->sarea->pfCurrentPage == 1 ) {
rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->frontOffset;
rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->frontPitch;
diff --git a/src/mesa/drivers/dri/r128/r128_state.c b/src/mesa/drivers/dri/r128/r128_state.c
index ec3a7965e5..e27e542a7d 100644
--- a/src/mesa/drivers/dri/r128/r128_state.c
+++ b/src/mesa/drivers/dri/r128/r128_state.c
@@ -688,10 +688,10 @@ static void r128DDDrawBuffer( GLcontext *ctx, GLenum mode )
* _DrawDestMask is easier to cope with than <mode>.
*/
switch ( ctx->Color._DrawDestMask ) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
FALLBACK( rmesa, R128_FALLBACK_DRAW_BUFFER, GL_FALSE );
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
FALLBACK( rmesa, R128_FALLBACK_DRAW_BUFFER, GL_FALSE );
break;
default:
diff --git a/src/mesa/drivers/dri/r200/r200_lock.c b/src/mesa/drivers/dri/r200/r200_lock.c
index 794a29972a..1700d31e16 100644
--- a/src/mesa/drivers/dri/r200/r200_lock.c
+++ b/src/mesa/drivers/dri/r200/r200_lock.c
@@ -53,7 +53,7 @@ r200UpdatePageFlipping( r200ContextPtr rmesa )
int use_back;
rmesa->doPageFlip = rmesa->sarea->pfState;
- use_back = (rmesa->glCtx->Color._DrawDestMask == BACK_LEFT_BIT);
+ use_back = (rmesa->glCtx->Color._DrawDestMask == DD_BACK_LEFT_BIT);
use_back ^= (rmesa->sarea->pfCurrentPage == 1);
if (use_back) {
@@ -101,7 +101,7 @@ void r200GetLock( r200ContextPtr rmesa, GLuint flags )
if ( rmesa->lastStamp != dPriv->lastStamp ) {
r200UpdatePageFlipping( rmesa );
- if (rmesa->glCtx->Color._DrawDestMask == BACK_LEFT_BIT)
+ if (rmesa->glCtx->Color._DrawDestMask == DD_BACK_LEFT_BIT)
r200SetCliprects( rmesa, GL_BACK_LEFT );
else
r200SetCliprects( rmesa, GL_FRONT_LEFT );
diff --git a/src/mesa/drivers/dri/r200/r200_span.c b/src/mesa/drivers/dri/r200/r200_span.c
index 7e48a9d5af..e1ad976ce3 100644
--- a/src/mesa/drivers/dri/r200/r200_span.c
+++ b/src/mesa/drivers/dri/r200/r200_span.c
@@ -301,7 +301,7 @@ static void r200SetBuffer( GLcontext *ctx,
r200ContextPtr rmesa = R200_CONTEXT(ctx);
switch ( bufferBit ) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
if ( rmesa->doPageFlip && rmesa->sarea->pfCurrentPage == 1 ) {
rmesa->state.pixel.readOffset = rmesa->r200Screen->backOffset;
rmesa->state.pixel.readPitch = rmesa->r200Screen->backPitch;
@@ -314,7 +314,7 @@ static void r200SetBuffer( GLcontext *ctx,
rmesa->state.color.drawPitch = rmesa->r200Screen->frontPitch;
}
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
if ( rmesa->doPageFlip && rmesa->sarea->pfCurrentPage == 1 ) {
rmesa->state.pixel.readOffset = rmesa->r200Screen->frontOffset;
rmesa->state.pixel.readPitch = rmesa->r200Screen->frontPitch;
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index 478531f5b5..1dd352a53d 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -1674,11 +1674,11 @@ static void r200DrawBuffer( GLcontext *ctx, GLenum mode )
* _DrawDestMask is easier to cope with than <mode>.
*/
switch ( ctx->Color._DrawDestMask ) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_FALSE );
r200SetCliprects( rmesa, GL_FRONT_LEFT );
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_FALSE );
r200SetCliprects( rmesa, GL_BACK_LEFT );
break;
diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/src/mesa/drivers/dri/radeon/radeon_ioctl.c
index 4399c86fa0..6d51b886d8 100644
--- a/src/mesa/drivers/dri/radeon/radeon_ioctl.c
+++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.c
@@ -844,7 +844,7 @@ void radeonCopyBuffer( const __DRIdrawablePrivate *dPriv )
rmesa = (radeonContextPtr) dPriv->driContextPriv->driverPrivate;
if ( RADEON_DEBUG & DEBUG_IOCTL ) {
- fprintf( stderr, "\n%s( %p )\n\n", __FUNCTION__, rmesa->glCtx );
+ fprintf( stderr, "\n%s( %p )\n\n", __FUNCTION__, (void *) rmesa->glCtx );
}
RADEON_FIREVERTICES( rmesa );
diff --git a/src/mesa/drivers/dri/radeon/radeon_lock.c b/src/mesa/drivers/dri/radeon/radeon_lock.c
index 033a45efb2..0b58589a38 100644
--- a/src/mesa/drivers/dri/radeon/radeon_lock.c
+++ b/src/mesa/drivers/dri/radeon/radeon_lock.c
@@ -56,7 +56,7 @@ radeonUpdatePageFlipping( radeonContextPtr rmesa )
rmesa->doPageFlip = rmesa->sarea->pfState;
- use_back = (rmesa->glCtx->Color._DrawDestMask == BACK_LEFT_BIT);
+ use_back = (rmesa->glCtx->Color._DrawDestMask == DD_BACK_LEFT_BIT);
use_back ^= (rmesa->sarea->pfCurrentPage == 1);
if ( RADEON_DEBUG & DEBUG_VERBOSE )
@@ -108,7 +108,7 @@ void radeonGetLock( radeonContextPtr rmesa, GLuint flags )
if ( rmesa->lastStamp != dPriv->lastStamp ) {
radeonUpdatePageFlipping( rmesa );
- if (rmesa->glCtx->Color._DrawDestMask == BACK_LEFT_BIT)
+ if (rmesa->glCtx->Color._DrawDestMask == DD_BACK_LEFT_BIT)
radeonSetCliprects( rmesa, GL_BACK_LEFT );
else
radeonSetCliprects( rmesa, GL_FRONT_LEFT );
diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c
index 029d7cd8ee..5fa02fa97c 100644
--- a/src/mesa/drivers/dri/radeon/radeon_span.c
+++ b/src/mesa/drivers/dri/radeon/radeon_span.c
@@ -301,7 +301,7 @@ static void radeonSetBuffer( GLcontext *ctx,
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
switch ( bufferBit ) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
if ( rmesa->sarea->pfCurrentPage == 1 ) {
rmesa->state.pixel.readOffset = rmesa->radeonScreen->backOffset;
rmesa->state.pixel.readPitch = rmesa->radeonScreen->backPitch;
@@ -314,7 +314,7 @@ static void radeonSetBuffer( GLcontext *ctx,
rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch;
}
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
if ( rmesa->sarea->pfCurrentPage == 1 ) {
rmesa->state.pixel.readOffset = rmesa->radeonScreen->frontOffset;
rmesa->state.pixel.readPitch = rmesa->radeonScreen->frontPitch;
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
index 0d5d2818cd..3bd2a88d42 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -1613,11 +1613,11 @@ static void radeonDrawBuffer( GLcontext *ctx, GLenum mode )
* _DrawDestMask is easier to cope with than <mode>.
*/
switch ( ctx->Color._DrawDestMask ) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
FALLBACK( rmesa, RADEON_FALLBACK_DRAW_BUFFER, GL_FALSE );
radeonSetCliprects( rmesa, GL_FRONT_LEFT );
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
FALLBACK( rmesa, RADEON_FALLBACK_DRAW_BUFFER, GL_FALSE );
radeonSetCliprects( rmesa, GL_BACK_LEFT );
break;
diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c
index c7b31df2c6..f07d4aadd3 100644
--- a/src/mesa/drivers/dri/savage/savage_xmesa.c
+++ b/src/mesa/drivers/dri/savage/savage_xmesa.c
@@ -592,10 +592,10 @@ static void savageXMesaWindowMoved( savageContextPtr imesa )
fprintf(stderr, "savageXMesaWindowMoved\n\n");
switch (imesa->glCtx->Color._DrawDestMask) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
savageXMesaSetFrontClipRects( imesa );
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
savageXMesaSetBackClipRects( imesa );
break;
default:
diff --git a/src/mesa/drivers/dri/savage/savagespan.c b/src/mesa/drivers/dri/savage/savagespan.c
index aa13cfcb1d..0369988ad2 100644
--- a/src/mesa/drivers/dri/savage/savagespan.c
+++ b/src/mesa/drivers/dri/savage/savagespan.c
@@ -225,9 +225,9 @@ static void savageDDSetBuffer(GLcontext *ctx, GLframebuffer *buffer,
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
char *map;
- assert( (bufferBit == FRONT_LEFT_BIT) || (bufferBit == BACK_LEFT_BIT) );
+ assert((bufferBit == DD_FRONT_LEFT_BIT) || (bufferBit == DD_BACK_LEFT_BIT));
- map = (bufferBit == FRONT_LEFT_BIT)
+ map = (bufferBit == DD_FRONT_LEFT_BIT)
? (char*)imesa->apertureBase[TARGET_FRONT]
: (char*)imesa->apertureBase[TARGET_BACK];
diff --git a/src/mesa/drivers/dri/savage/savagestate.c b/src/mesa/drivers/dri/savage/savagestate.c
index 6b297448d5..b32b58ab87 100644
--- a/src/mesa/drivers/dri/savage/savagestate.c
+++ b/src/mesa/drivers/dri/savage/savagestate.c
@@ -639,7 +639,7 @@ static void savageDDDrawBuffer(GLcontext *ctx, GLenum mode )
* _DrawDestMask is easier to cope with than <mode>.
*/
switch ( ctx->Color._DrawDestMask ) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
imesa->IsDouble = GL_FALSE;
if(imesa->IsFullScreen)
@@ -657,7 +657,7 @@ static void savageDDDrawBuffer(GLcontext *ctx, GLenum mode )
savageXMesaSetFrontClipRects( imesa );
FALLBACK( ctx, SAVAGE_FALLBACK_DRAW_BUFFER, GL_FALSE );
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
imesa->IsDouble = GL_TRUE;
imesa->drawMap = (char *)imesa->apertureBase[TARGET_BACK];
imesa->readMap = (char *)imesa->apertureBase[TARGET_BACK];
@@ -1776,7 +1776,7 @@ void savageDDInitState( savageContextPtr imesa ) {
imesa->regs.s4.zBufOffset.ni.zDepthSelect = 1;
}
- if (imesa->glCtx->Color._DrawDestMask == BACK_LEFT_BIT) {
+ if (imesa->glCtx->Color._DrawDestMask == DD_BACK_LEFT_BIT) {
if(imesa->IsFullScreen)
{
imesa->toggle = TARGET_BACK;
diff --git a/src/mesa/drivers/dri/sis/sis_span.c b/src/mesa/drivers/dri/sis/sis_span.c
index 05e1777891..1342d53922 100644
--- a/src/mesa/drivers/dri/sis/sis_span.c
+++ b/src/mesa/drivers/dri/sis/sis_span.c
@@ -203,11 +203,11 @@ static void sisDDSetBuffer( GLcontext *ctx,
sisContextPtr smesa = SIS_CONTEXT(ctx);
switch ( bufferBit ) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
smesa->drawOffset = smesa->readOffset = smesa->frontOffset;
smesa->drawPitch = smesa->readPitch = smesa->frontPitch;
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
smesa->drawOffset = smesa->readOffset = smesa->backOffset;
smesa->drawPitch = smesa->readPitch = smesa->backPitch;
break;
diff --git a/src/mesa/drivers/dri/sis/sis_state.c b/src/mesa/drivers/dri/sis/sis_state.c
index 6dc002171d..ec91187519 100644
--- a/src/mesa/drivers/dri/sis/sis_state.c
+++ b/src/mesa/drivers/dri/sis/sis_state.c
@@ -514,8 +514,8 @@ void sisDDDrawBuffer( GLcontext *ctx, GLenum mode )
* _DrawDestMask is easier to cope with than <mode>.
*/
switch ( ctx->Color._DrawDestMask ) {
- case FRONT_LEFT_BIT:
- case BACK_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
FALLBACK( smesa, SIS_FALLBACK_DRAW_BUFFER, GL_FALSE );
break;
default:
diff --git a/src/mesa/drivers/dri/sis/sis_tris.c b/src/mesa/drivers/dri/sis/sis_tris.c
index e49c49e72d..21ec99c878 100644
--- a/src/mesa/drivers/dri/sis/sis_tris.c
+++ b/src/mesa/drivers/dri/sis/sis_tris.c
@@ -792,7 +792,7 @@ static void sisRenderStart( GLcontext *ctx )
*/
sisCheckTexSizes( ctx );
- if (ctx->Color._DrawDestMask == FRONT_LEFT_BIT &&
+ if (ctx->Color._DrawDestMask == DD_FRONT_LEFT_BIT &&
smesa->driDrawable->numClipRects != 0)
{
multipass_cliprect(ctx, 0);
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_render.c b/src/mesa/drivers/dri/tdfx/tdfx_render.c
index 84d919591b..e15b38034e 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_render.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_render.c
@@ -275,7 +275,7 @@ static void tdfxClear( GLcontext *ctx,
fxMesa->Color.ClearAlpha,
fxMesa->Depth.Clear);
FX_grColorMaskv_NoLock(ctx, true4);
- if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT)
+ if (ctx->Color._DrawDestMask & DD_FRONT_LEFT_BIT)
fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
if (!ctx->Depth.Test || !ctx->Depth.Mask)
fxMesa->Glide.grDepthMask(FXFALSE);
@@ -295,7 +295,7 @@ static void tdfxClear( GLcontext *ctx,
fxMesa->Glide.grDepthMask(FXTRUE);
}
FX_grColorMaskv_NoLock(ctx, true4);
- if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT)
+ if (ctx->Color._DrawDestMask & DD_FRONT_LEFT_BIT)
fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
}
}
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_span.c b/src/mesa/drivers/dri/tdfx/tdfx_span.c
index 4207d05dd3..43fcb90fd2 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_span.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_span.c
@@ -1314,10 +1314,10 @@ static void tdfxDDSetBuffer( GLcontext *ctx,
(void) buffer;
switch ( bufferBit ) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER;
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER;
break;
default:
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_state.c b/src/mesa/drivers/dri/tdfx/tdfx_state.c
index 5e59b91f80..dffcccd9a2 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_state.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_state.c
@@ -1011,12 +1011,12 @@ static void tdfxDDDrawBuffer( GLcontext *ctx, GLenum mode )
* _DrawDestMask is easier to cope with than <mode>.
*/
switch ( ctx->Color._DrawDestMask ) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER;
fxMesa->new_state |= TDFX_NEW_RENDER;
FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_FALSE );
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER;
fxMesa->new_state |= TDFX_NEW_RENDER;
FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_FALSE );
diff --git a/src/mesa/drivers/dri/unichrome/via_span.c b/src/mesa/drivers/dri/unichrome/via_span.c
index af1bcf5579..fcb9771875 100644
--- a/src/mesa/drivers/dri/unichrome/via_span.c
+++ b/src/mesa/drivers/dri/unichrome/via_span.c
@@ -327,13 +327,13 @@ static void viaSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
#ifdef DEBUG
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
#endif
- if (bufferBit == FRONT_LEFT_BIT) {
+ if (bufferBit == DD_FRONT_LEFT_BIT) {
vmesa->drawMap = (char *)vmesa->driScreen->pFB;
vmesa->readMap = (char *)vmesa->driScreen->pFB;
vmesa->drawPitch = vmesa->front.pitch;
vmesa->readPitch = vmesa->front.pitch;
}
- else if (bufferBit == BACK_LEFT_BIT) {
+ else if (bufferBit == DD_BACK_LEFT_BIT) {
vmesa->drawMap = vmesa->back.map;
vmesa->readMap = vmesa->back.map;
vmesa->drawPitch = vmesa->back.pitch;
diff --git a/src/mesa/drivers/fbdev/glfbdev.c b/src/mesa/drivers/fbdev/glfbdev.c
index 15ddbca9ed..cfb6a70f60 100644
--- a/src/mesa/drivers/fbdev/glfbdev.c
+++ b/src/mesa/drivers/fbdev/glfbdev.c
@@ -159,10 +159,10 @@ set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit )
GLFBDevBufferPtr fbdevbuf = GLFBDEV_BUFFER(buffer);
fbdevctx->curBuffer = fbdevbuf;
switch (bufferBit) {
- case FRONT_LEFT_BIT:
+ case DD_FRONT_LEFT_BIT:
fbdevbuf->curBottom = fbdevbuf->frontBottom;
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
fbdevbuf->curBottom = fbdevbuf->backBottom;
break;
default:
diff --git a/src/mesa/drivers/ggi/ggimesa.c b/src/mesa/drivers/ggi/ggimesa.c
index 8825c47162..8a2f44a558 100644
--- a/src/mesa/drivers/ggi/ggimesa.c
+++ b/src/mesa/drivers/ggi/ggimesa.c
@@ -160,7 +160,7 @@ static GLboolean gl_ggiSetBuffer(GLcontext *ctx, GLframebuffer *buffer, GLuint b
printf("set read %d\n", bufferBit);
GGIMESADPRINT_CORE("gl_ggiSetBuffer() called\n");
- if (bufferBit == FRONT_LEFT_BIT)
+ if (bufferBit == DD_FRONT_LEFT_BIT)
{
ggiSetReadFrame(ggi_ctx->ggi_visual,
ggiGetDisplayFrame(ggi_ctx->ggi_visual));
@@ -168,7 +168,7 @@ static GLboolean gl_ggiSetBuffer(GLcontext *ctx, GLframebuffer *buffer, GLuint b
ggiGetDisplayFrame(ggi_ctx->ggi_visual));
return GL_TRUE;
}
- else if (bufferBit == BACK_LEFT_BIT)
+ else if (bufferBit == DD_BACK_LEFT_BIT)
{
ggiSetReadFrame(ggi_ctx->ggi_visual,
ggiGetDisplayFrame(ggi_ctx->ggi_visual)?0 : 1);
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c
index 8d40d8476a..245654ca4c 100644
--- a/src/mesa/drivers/glide/fxdd.c
+++ b/src/mesa/drivers/glide/fxdd.c
@@ -380,7 +380,7 @@ static void fxDDClear( GLcontext *ctx,
fxMesa->clearA,
clearD);
fxSetupColorMask(ctx);
- if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT) {
+ if (ctx->Color._DrawDestMask & DD_FRONT_LEFT_BIT) {
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
}
if (!fxMesa->unitsState.depthTestEnabled) {
@@ -401,7 +401,7 @@ static void fxDDClear( GLcontext *ctx,
grDepthMask(FXTRUE);
}
fxSetupColorMask(ctx);
- if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT) {
+ if (ctx->Color._DrawDestMask & DD_FRONT_LEFT_BIT) {
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
}
}
@@ -1552,7 +1552,8 @@ fx_check_IsInHardware(GLcontext * ctx)
return FX_FALLBACK_STENCIL;
}
- if (ctx->Color._DrawDestMask != FRONT_LEFT_BIT && ctx->Color._DrawDestMask != BACK_LEFT_BIT) {
+ if (ctx->Color._DrawDestMask != DD_FRONT_LEFT_BIT &&
+ ctx->Color._DrawDestMask != DD_BACK_LEFT_BIT) {
return FX_FALLBACK_DRAW_BUFFER;
}
diff --git a/src/mesa/drivers/glide/fxddspan.c b/src/mesa/drivers/glide/fxddspan.c
index 4b9b2123b4..4eacfc0b5d 100644
--- a/src/mesa/drivers/glide/fxddspan.c
+++ b/src/mesa/drivers/glide/fxddspan.c
@@ -557,11 +557,11 @@ fxDDSetBuffer(GLcontext * ctx, GLframebuffer * buffer, GLuint bufferBit)
fprintf(stderr, "fxDDSetBuffer(%x)\n", (int)bufferBit);
}
- if (bufferBit == FRONT_LEFT_BIT) {
+ if (bufferBit == DD_FRONT_LEFT_BIT) {
fxMesa->currentFB = GR_BUFFER_FRONTBUFFER;
grRenderBuffer(fxMesa->currentFB);
}
- else if (bufferBit == BACK_LEFT_BIT) {
+ else if (bufferBit == DD_BACK_LEFT_BIT) {
fxMesa->currentFB = GR_BUFFER_BACKBUFFER;
grRenderBuffer(fxMesa->currentFB);
}
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index 464ca7381a..a8e6b12832 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -133,7 +133,7 @@ set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit )
{
/* separate read buffer not supported */
ASSERT(buffer == ctx->DrawBuffer);
- ASSERT(bufferBit == FRONT_LEFT_BIT);
+ ASSERT(bufferBit == DD_FRONT_LEFT_BIT);
}
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index 4535f8cae0..47882114cf 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -252,7 +252,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
GLint depth_size, GLint stencil_size,
GLint accumRedSize, GLint accumGreenSize,
GLint accumBlueSize, GLint accumAlphaSize,
- GLint level )
+ GLint level, GLint numAuxBuffers )
{
GLboolean ximageFlag = GL_TRUE;
XMesaVisual xmvis;
@@ -287,6 +287,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
XMesaVisual v = VisualTable[i];
if (v->display == dpy
&& v->mesa_visual.level == level
+ && v->mesa_visual.numAuxBuffers == numAuxBuffers
&& v->ximage_flag == ximageFlag
&& v->mesa_visual.rgbMode == rgbFlag
&& v->mesa_visual.doubleBufferMode == dbFlag
@@ -327,6 +328,8 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
/* add xmvis to the list */
VisualTable[NumVisuals] = xmvis;
NumVisuals++;
+ /* XXX minor hack */
+ xmvis->mesa_visual.numAuxBuffers = numAuxBuffers;
}
return xmvis;
}
@@ -357,7 +360,8 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo )
0, /* depth bits */
0, /* stencil bits */
0,0,0,0, /* accum bits */
- vislevel /* level */
+ vislevel, /* level */
+ 0 /* numAux */
);
}
else if (is_usable_visual( visinfo )) {
@@ -374,7 +378,8 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo )
0 * sizeof(GLaccum), /* g */
0 * sizeof(GLaccum), /* b */
0 * sizeof(GLaccum), /* a */
- 0 /* level */
+ 0, /* level */
+ 0 /* numAux */
);
}
else {
@@ -392,7 +397,8 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo )
8 * sizeof(GLaccum), /* g */
8 * sizeof(GLaccum), /* b */
8 * sizeof(GLaccum), /* a */
- 0 /* level */
+ 0, /* level */
+ 0 /* numAux */
);
}
}
@@ -925,6 +931,7 @@ static XMesaVisual choose_visual( Display *dpy, int screen, const int *list,
GLint caveat = DONT_CARE;
XMesaVisual xmvis = NULL;
int desiredVisualID = -1;
+ int numAux = 0;
parselist = list;
@@ -957,7 +964,9 @@ static XMesaVisual choose_visual( Display *dpy, int screen, const int *list,
case GLX_AUX_BUFFERS:
/* ignore */
parselist++;
- parselist++;
+ numAux = *parselist++;
+ if (numAux > MAX_AUX_BUFFERS)
+ return NULL;
break;
case GLX_RED_SIZE:
parselist++;
@@ -1186,7 +1195,7 @@ static XMesaVisual choose_visual( Display *dpy, int screen, const int *list,
xmvis = save_glx_visual( dpy, vis, rgb_flag, alpha_flag, double_flag,
stereo_flag, depth_size, stencil_size,
accumRedSize, accumGreenSize,
- accumBlueSize, accumAlphaSize, level );
+ accumBlueSize, accumAlphaSize, level, numAux );
}
return xmvis;
@@ -1566,7 +1575,7 @@ get_config( XMesaVisual xmvis, int attrib, int *value, GLboolean fbconfig )
*value = (int) xmvis->mesa_visual.stereoMode;
return 0;
case GLX_AUX_BUFFERS:
- *value = (int) False;
+ *value = xmvis->mesa_visual.numAuxBuffers;
return 0;
case GLX_RED_SIZE:
*value = xmvis->mesa_visual.redBits;
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 189fde636e..da2371eb7c 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -1602,6 +1602,7 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
accum_blue_size, accum_alpha_size,
0 );
+ /* XXX minor hack */
v->mesa_visual.level = level;
return v;
}
@@ -1789,6 +1790,8 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w,
v->mesa_visual.stencilBits > 0,
v->mesa_visual.accumRedBits > 0,
v->mesa_visual.alphaBits > 0 );
+ /* XXX hack */
+ b->mesa_buffer.UseSoftwareAuxBuffers = GL_TRUE;
if (!initialize_visual_and_buffer( client, v, b, v->mesa_visual.rgbMode,
(XMesaDrawable)w, b->cmap )) {
diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c
index 1178b71b74..b58188e200 100644
--- a/src/mesa/drivers/x11/xm_dd.c
+++ b/src/mesa/drivers/x11/xm_dd.c
@@ -41,6 +41,7 @@
#include "xmesaP.h"
#include "array_cache/acache.h"
#include "swrast/swrast.h"
+#include "swrast/s_auxbuffer.h"
#include "swrast/s_context.h"
#include "swrast/s_drawpix.h"
#include "swrast/s_alphabuf.h"
@@ -167,10 +168,11 @@ xmesa_set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit )
/*
* Now determine front vs back color buffer.
*/
- if (bufferBit == FRONT_LEFT_BIT) {
+ if (bufferBit == DD_FRONT_LEFT_BIT) {
target->buffer = target->frontbuffer;
+ xmesa_update_span_funcs(ctx);
}
- else if (bufferBit == BACK_LEFT_BIT) {
+ else if (bufferBit == DD_BACK_LEFT_BIT) {
ASSERT(target->db_state);
if (target->backpixmap) {
/* back buffer is a pixmap */
@@ -184,12 +186,15 @@ xmesa_set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit )
/* No back buffer!!!! Must be out of memory, use front buffer */
target->buffer = target->frontbuffer;
}
+ xmesa_update_span_funcs(ctx);
}
+ else if (bufferBit & (DD_AUX0_BIT | DD_AUX1_BIT | DD_AUX2_BIT | DD_AUX3_BIT)) {
+ _swrast_use_aux_buffer(ctx, buffer, bufferBit);
+ }
else {
_mesa_problem(ctx, "invalid buffer 0x%x in set_buffer() in xm_dd.c");
return;
}
- xmesa_update_span_funcs(ctx);
}
@@ -1105,7 +1110,9 @@ void xmesa_update_state( GLcontext *ctx, GLuint new_state )
break;
}
- xmesa_update_span_funcs(ctx);
+ if (ctx->Color._DrawDestMask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) {
+ xmesa_update_span_funcs(ctx);
+ }
}
diff --git a/src/mesa/drivers/x11/xm_line.c b/src/mesa/drivers/x11/xm_line.c
index 342528dbef..a5352d6147 100644
--- a/src/mesa/drivers/x11/xm_line.c
+++ b/src/mesa/drivers/x11/xm_line.c
@@ -492,6 +492,8 @@ static swrast_line_func get_line_func( GLcontext *ctx )
SWcontext *swrast = SWRAST_CONTEXT(ctx);
int depth = GET_VISUAL_DEPTH(xmesa->xm_visual);
+ if ((ctx->Color._DrawDestMask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) ==0)
+ return (swrast_line_func) NULL;
if (ctx->RenderMode != GL_RENDER) return (swrast_line_func) NULL;
if (ctx->Line.SmoothFlag) return (swrast_line_func) NULL;
if (ctx->Texture._EnabledUnits) return (swrast_line_func) NULL;
diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c
index 868bca4937..f018a6acac 100644
--- a/src/mesa/drivers/x11/xm_tri.c
+++ b/src/mesa/drivers/x11/xm_tri.c
@@ -1313,6 +1313,8 @@ static swrast_tri_func get_triangle_func( GLcontext *ctx )
triFuncName = NULL;
#endif
+ if ((ctx->Color._DrawDestMask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) ==0)
+ return (swrast_tri_func) NULL;
if (ctx->RenderMode != GL_RENDER) return (swrast_tri_func) NULL;
if (ctx->Polygon.SmoothFlag) return (swrast_tri_func) NULL;
if (ctx->Texture._EnabledUnits) return (swrast_tri_func) NULL;
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index 6741238aae..fde542c4b9 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -5,9 +5,9 @@
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 6.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -532,7 +532,7 @@ _mesa_ColorMask( GLboolean red, GLboolean green,
/*@{*/
/**
- * Initialization of the context color data.
+ * Initialization of the context's Color attribute group.
*
* \param ctx GL context.
*
@@ -569,11 +569,11 @@ void _mesa_init_color( GLcontext * ctx )
if (ctx->Visual.doubleBufferMode) {
ctx->Color.DrawBuffer = GL_BACK;
- ctx->Color._DrawDestMask = BACK_LEFT_BIT;
+ ctx->Color._DrawDestMask = DD_BACK_LEFT_BIT;
}
else {
ctx->Color.DrawBuffer = GL_FRONT;
- ctx->Color._DrawDestMask = FRONT_LEFT_BIT;
+ ctx->Color._DrawDestMask = DD_FRONT_LEFT_BIT;
}
}
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 30fa433280..488125c4db 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -5,7 +5,7 @@
/*
* Mesa 3-D graphics library
- * Version: 6.0.1
+ * Version: 6.1
*
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
@@ -192,9 +192,9 @@ _mesa_DrawBuffer( GLenum mode )
case GL_FRONT:
/* never an error */
if (ctx->Visual.stereoMode)
- ctx->Color._DrawDestMask = FRONT_LEFT_BIT | FRONT_RIGHT_BIT;
+ ctx->Color._DrawDestMask = DD_FRONT_LEFT_BIT | DD_FRONT_RIGHT_BIT;
else
- ctx->Color._DrawDestMask = FRONT_LEFT_BIT;
+ ctx->Color._DrawDestMask = DD_FRONT_LEFT_BIT;
break;
case GL_BACK:
if (!ctx->Visual.doubleBufferMode) {
@@ -202,9 +202,9 @@ _mesa_DrawBuffer( GLenum mode )
return;
}
if (ctx->Visual.stereoMode)
- ctx->Color._DrawDestMask = BACK_LEFT_BIT | BACK_RIGHT_BIT;
+ ctx->Color._DrawDestMask = DD_BACK_LEFT_BIT | DD_BACK_RIGHT_BIT;
else
- ctx->Color._DrawDestMask = BACK_LEFT_BIT;
+ ctx->Color._DrawDestMask = DD_BACK_LEFT_BIT;
break;
case GL_NONE:
/* never an error */
@@ -216,30 +216,30 @@ _mesa_DrawBuffer( GLenum mode )
_mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_RIGHT)");
return;}
if (ctx->Visual.doubleBufferMode)
- ctx->Color._DrawDestMask = FRONT_RIGHT_BIT | BACK_RIGHT_BIT;
+ ctx->Color._DrawDestMask = DD_FRONT_RIGHT_BIT | DD_BACK_RIGHT_BIT;
else
- ctx->Color._DrawDestMask = FRONT_RIGHT_BIT;
+ ctx->Color._DrawDestMask = DD_FRONT_RIGHT_BIT;
break;
case GL_FRONT_RIGHT:
if (!ctx->Visual.stereoMode) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_FRONT_RIGHT)");
return;
}
- ctx->Color._DrawDestMask = FRONT_RIGHT_BIT;
+ ctx->Color._DrawDestMask = DD_FRONT_RIGHT_BIT;
break;
case GL_BACK_RIGHT:
if (!ctx->Visual.stereoMode || !ctx->Visual.doubleBufferMode) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_BACK_RIGHT)");
return;
}
- ctx->Color._DrawDestMask = BACK_RIGHT_BIT;
+ ctx->Color._DrawDestMask = DD_BACK_RIGHT_BIT;
break;
case GL_BACK_LEFT:
if (!ctx->Visual.doubleBufferMode) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_BACK_LEFT)");
return;
}
- ctx->Color._DrawDestMask = BACK_LEFT_BIT;
+ ctx->Color._DrawDestMask = DD_BACK_LEFT_BIT;
break;
case GL_FRONT_AND_BACK:
if (!ctx->Visual.doubleBufferMode) {
@@ -247,25 +247,25 @@ _mesa_DrawBuffer( GLenum mode )
return;
}
if (ctx->Visual.stereoMode)
- ctx->Color._DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT
- | FRONT_RIGHT_BIT | BACK_RIGHT_BIT;
+ ctx->Color._DrawDestMask = DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT
+ | DD_FRONT_RIGHT_BIT | DD_BACK_RIGHT_BIT;
else
- ctx->Color._DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT;
+ ctx->Color._DrawDestMask = DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT;
break;
case GL_LEFT:
/* never an error */
if (ctx->Visual.doubleBufferMode)
- ctx->Color._DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT;
+ ctx->Color._DrawDestMask = DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT;
else
- ctx->Color._DrawDestMask = FRONT_LEFT_BIT;
+ ctx->Color._DrawDestMask = DD_FRONT_LEFT_BIT;
break;
case GL_FRONT_LEFT:
/* never an error */
- ctx->Color._DrawDestMask = FRONT_LEFT_BIT;
+ ctx->Color._DrawDestMask = DD_FRONT_LEFT_BIT;
break;
case GL_AUX0:
- if (ctx->Const.NumAuxBuffers >= 1) {
- ctx->Color._DrawDestMask = AUX0_BIT;
+ if (ctx->Visual.numAuxBuffers >= 1) {
+ ctx->Color._DrawDestMask = DD_AUX0_BIT;
}
else {
_mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_AUX0)" );
@@ -273,8 +273,8 @@ _mesa_DrawBuffer( GLenum mode )
}
break;
case GL_AUX1:
- if (ctx->Const.NumAuxBuffers >= 2) {
- ctx->Color._DrawDestMask = AUX1_BIT;
+ if (ctx->Visual.numAuxBuffers >= 2) {
+ ctx->Color._DrawDestMask = DD_AUX1_BIT;
}
else {
_mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_AUX1)" );
@@ -282,8 +282,8 @@ _mesa_DrawBuffer( GLenum mode )
}
break;
case GL_AUX2:
- if (ctx->Const.NumAuxBuffers >= 3) {
- ctx->Color._DrawDestMask = AUX2_BIT;
+ if (ctx->Visual.numAuxBuffers >= 3) {
+ ctx->Color._DrawDestMask = DD_AUX2_BIT;
}
else {
_mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_AUX2)" );
@@ -291,8 +291,8 @@ _mesa_DrawBuffer( GLenum mode )
}
break;
case GL_AUX3:
- if (ctx->Const.NumAuxBuffers >= 4) {
- ctx->Color._DrawDestMask = AUX3_BIT;
+ if (ctx->Visual.numAuxBuffers >= 4) {
+ ctx->Color._DrawDestMask = DD_AUX3_BIT;
}
else {
_mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_AUX3)" );
@@ -344,7 +344,7 @@ _mesa_ReadBuffer( GLenum mode )
case GL_FRONT:
case GL_FRONT_LEFT:
/* Front-Left buffer, always exists */
- ctx->Pixel._ReadSrcMask = FRONT_LEFT_BIT;
+ ctx->Pixel._ReadSrcMask = DD_FRONT_LEFT_BIT;
break;
case GL_BACK:
case GL_BACK_LEFT:
@@ -353,7 +353,7 @@ _mesa_ReadBuffer( GLenum mode )
_mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" );
return;
}
- ctx->Pixel._ReadSrcMask = BACK_LEFT_BIT;
+ ctx->Pixel._ReadSrcMask = DD_BACK_LEFT_BIT;
break;
#if _HAVE_FULL_GL
case GL_FRONT_RIGHT:
@@ -362,18 +362,18 @@ _mesa_ReadBuffer( GLenum mode )
_mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" );
return;
}
- ctx->Pixel._ReadSrcMask = FRONT_RIGHT_BIT;
+ ctx->Pixel._ReadSrcMask = DD_FRONT_RIGHT_BIT;
break;
case GL_BACK_RIGHT:
if (!ctx->Visual.stereoMode || !ctx->Visual.doubleBufferMode) {
_mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" );
return;
}
- ctx->Pixel._ReadSrcMask = BACK_RIGHT_BIT;
+ ctx->Pixel._ReadSrcMask = DD_BACK_RIGHT_BIT;
break;
case GL_AUX0:
- if (ctx->Const.NumAuxBuffers >= 1) {
- ctx->Pixel._ReadSrcMask = AUX0_BIT;
+ if (ctx->Visual.numAuxBuffers >= 1) {
+ ctx->Pixel._ReadSrcMask = DD_AUX0_BIT;
}
else {
_mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer(GL_AUX0)" );
@@ -381,8 +381,8 @@ _mesa_ReadBuffer( GLenum mode )
}
break;
case GL_AUX1:
- if (ctx->Const.NumAuxBuffers >= 2) {
- ctx->Pixel._ReadSrcMask = AUX1_BIT;
+ if (ctx->Visual.numAuxBuffers >= 2) {
+ ctx->Pixel._ReadSrcMask = DD_AUX1_BIT;
}
else {
_mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer(GL_AUX1)" );
@@ -390,8 +390,8 @@ _mesa_ReadBuffer( GLenum mode )
}
break;
case GL_AUX2:
- if (ctx->Const.NumAuxBuffers >= 3) {
- ctx->Pixel._ReadSrcMask = AUX2_BIT;
+ if (ctx->Visual.numAuxBuffers >= 3) {
+ ctx->Pixel._ReadSrcMask = DD_AUX2_BIT;
}
else {
_mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer(GL_AUX2)" );
@@ -399,8 +399,8 @@ _mesa_ReadBuffer( GLenum mode )
}
break;
case GL_AUX3:
- if (ctx->Const.NumAuxBuffers >= 4) {
- ctx->Pixel._ReadSrcMask = AUX3_BIT;
+ if (ctx->Visual.numAuxBuffers >= 4) {
+ ctx->Pixel._ReadSrcMask = DD_AUX3_BIT;
}
else {
_mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer(GL_AUX3)" );
diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
index 74ebb469af..20206482c9 100644
--- a/src/mesa/main/config.h
+++ b/src/mesa/main/config.h
@@ -71,8 +71,8 @@
/** Maximum pixel map lookup table size */
#define MAX_PIXEL_MAP_TABLE 256
-/** Number of auxillary color buffers */
-#define NUM_AUX_BUFFERS 0
+/** Maximum Number of auxillary color buffers */
+#define MAX_AUX_BUFFERS 4
/** Maximum order (degree) of curves */
#ifdef AMIGA
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 951763642b..2328b3726e 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -418,7 +418,8 @@ __glCoreNopDispatch(void)
/*@{*/
/**
- * Allocate a new GLvisual object.
+ * Allocates a GLvisual structure and initializes it via
+ * _mesa_initialize_visual().
*
* \param rgbFlag GL_TRUE for RGB(A) mode, GL_FALSE for Color Index mode.
* \param dbFlag double buffering
@@ -439,8 +440,7 @@ __glCoreNopDispatch(void)
* \return pointer to new GLvisual or NULL if requested parameters can't be
* met.
*
- * Allocates a GLvisual structure and initializes it via
- * _mesa_initialize_visual().
+ * \note Need to add params for level and numAuxBuffers (at least)
*/
GLvisual *
_mesa_create_visual( GLboolean rgbFlag,
@@ -475,14 +475,14 @@ _mesa_create_visual( GLboolean rgbFlag,
}
/**
- * Initialize the fields of the given GLvisual.
+ * Makes some sanity checks and fills in the fields of the
+ * GLvisual structure with the given parameters.
*
* \return GL_TRUE on success, or GL_FALSE on failure.
*
* \sa _mesa_create_visual() above for the parameter description.
*
- * Makes some sanity checks and fills in the fields of the
- * GLvisual structure with the given parameters.
+ * \note Need to add params for level and numAuxBuffers (at least)
*/
GLboolean
_mesa_initialize_visual( GLvisual *vis,
@@ -502,8 +502,6 @@ _mesa_initialize_visual( GLvisual *vis,
GLint accumAlphaBits,
GLint numSamples )
{
- (void) numSamples;
-
assert(vis);
/* This is to catch bad values from device drivers not updated for
@@ -555,12 +553,14 @@ _mesa_initialize_visual( GLvisual *vis,
vis->numAuxBuffers = 0;
vis->level = 0;
vis->pixmapMode = 0;
+ vis->samples = numSamples;
return GL_TRUE;
}
+
/**
- * Destroy a visual.
+ * Destroy a visual and free its memory.
*
* \param vis visual.
*
@@ -581,7 +581,8 @@ _mesa_destroy_visual( GLvisual *vis )
/*@{*/
/**
- * Create a new framebuffer.
+ * Allocate a GLframebuffer structure and initializes it via
+ * _mesa_initialize_framebuffer().
*
* A GLframebuffer is a structure which encapsulates the depth, stencil and
* accum buffers and related parameters.
@@ -594,8 +595,7 @@ _mesa_destroy_visual( GLvisual *vis )
*
* \return pointer to new GLframebuffer struct or NULL if error.
*
- * Allocate a GLframebuffer structure and initializes it via
- * _mesa_initialize_framebuffer().
+ * \note Need to add softwareAuxBuffers parameter.
*/
GLframebuffer *
_mesa_create_framebuffer( const GLvisual *visual,
@@ -614,13 +614,12 @@ _mesa_create_framebuffer( const GLvisual *visual,
return buffer;
}
+
/**
- * Initialize a GLframebuffer object.
- *
- * \sa _mesa_create_framebuffer() above for the parameter description.
- *
* Makes some sanity checks and fills in the fields of the
* GLframebuffer structure with the given parameters.
+ *
+ * \sa _mesa_create_framebuffer() above for the parameter description.
*/
void
_mesa_initialize_framebuffer( GLframebuffer *buffer,
@@ -630,6 +629,7 @@ _mesa_initialize_framebuffer( GLframebuffer *buffer,
GLboolean softwareAccum,
GLboolean softwareAlpha )
{
+ GLboolean softwareAux = GL_FALSE;
assert(buffer);
assert(visual);
@@ -658,8 +658,10 @@ _mesa_initialize_framebuffer( GLframebuffer *buffer,
buffer->UseSoftwareStencilBuffer = softwareStencil;
buffer->UseSoftwareAccumBuffer = softwareAccum;
buffer->UseSoftwareAlphaBuffers = softwareAlpha;
+ buffer->UseSoftwareAuxBuffers = softwareAux;
}
+
/**
* Free a framebuffer struct and its buffers.
*
@@ -674,6 +676,7 @@ _mesa_destroy_framebuffer( GLframebuffer *buffer )
}
}
+
/**
* Free the data hanging off of \p buffer, but not \p buffer itself.
*
@@ -757,11 +760,11 @@ one_time_init( GLcontext *ctx )
/* do some implementation tests */
assert( sizeof(GLbyte) == 1 );
- assert( sizeof(GLshort) >= 2 );
- assert( sizeof(GLint) >= 4 );
assert( sizeof(GLubyte) == 1 );
- assert( sizeof(GLushort) >= 2 );
- assert( sizeof(GLuint) >= 4 );
+ assert( sizeof(GLshort) == 2 );
+ assert( sizeof(GLushort) == 2 );
+ assert( sizeof(GLint) == 4 );
+ assert( sizeof(GLuint) == 4 );
_mesa_init_lists();
@@ -799,15 +802,15 @@ one_time_init( GLcontext *ctx )
_glthread_UNLOCK_MUTEX(OneTimeLock);
}
+
/**
* Allocate and initialize a shared context state structure.
- *
- * \return pointer to a gl_shared_state structure on success, or NULL on
- * failure.
- *
* Initializes the display list, texture objects and vertex programs hash
* tables, allocates the texture objects. If it runs out of memory, frees
* everything already allocated before returning NULL.
+ *
+ * \return pointer to a gl_shared_state structure on success, or NULL on
+ * failure.
*/
static GLboolean
alloc_shared_state( GLcontext *ctx )
@@ -1033,7 +1036,6 @@ _mesa_init_constants( GLcontext *ctx )
ctx->Const.MinLineWidthAA = MIN_LINE_WIDTH;
ctx->Const.MaxLineWidthAA = MAX_LINE_WIDTH;
ctx->Const.LineWidthGranularity = (GLfloat) LINE_WIDTH_GRANULARITY;
- ctx->Const.NumAuxBuffers = NUM_AUX_BUFFERS;
ctx->Const.MaxColorTableSize = MAX_COLOR_TABLE_SIZE;
ctx->Const.MaxConvolutionWidth = MAX_CONVOLUTION_WIDTH;
ctx->Const.MaxConvolutionHeight = MAX_CONVOLUTION_HEIGHT;
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index f1b49b7a30..b2b0bbd237 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -5,9 +5,9 @@
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 6.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -35,20 +35,6 @@
struct gl_pixelstore_attrib;
-/* Mask bits sent to the driver Clear() function */
-#define DD_FRONT_LEFT_BIT FRONT_LEFT_BIT /* 1 */
-#define DD_FRONT_RIGHT_BIT FRONT_RIGHT_BIT /* 2 */
-#define DD_BACK_LEFT_BIT BACK_LEFT_BIT /* 4 */
-#define DD_BACK_RIGHT_BIT BACK_RIGHT_BIT /* 8 */
-#define DD_AUX0 AUX0_BIT /* future use */
-#define DD_AUX1 AUX1_BIT /* future use */
-#define DD_AUX2 AUX2_BIT /* future use */
-#define DD_AUX3 AUX3_BIT /* future use */
-#define DD_DEPTH_BIT GL_DEPTH_BUFFER_BIT /* 0x00000100 */
-#define DD_ACCUM_BIT GL_ACCUM_BUFFER_BIT /* 0x00000200 */
-#define DD_STENCIL_BIT GL_STENCIL_BUFFER_BIT /* 0x00000400 */
-
-
/**
* Device driver function table.
* Core Mesa uses these function pointers to call into device drivers.
@@ -629,7 +615,7 @@ struct dd_function_table {
void (*DepthFunc)(GLcontext *ctx, GLenum func);
/** Enable or disable writing into the depth buffer */
void (*DepthMask)(GLcontext *ctx, GLboolean flag);
- /** Specify mapping of depth values from normalized device coordinates to window coordinates */
+ /** Specify mapping of depth values from NDC to window coordinates */
void (*DepthRange)(GLcontext *ctx, GLclampd nearval, GLclampd farval);
/** Specify the current buffer for writing */
void (*DrawBuffer)( GLcontext *ctx, GLenum buffer );
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index fac3f072bc..e4e60abe7e 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -5,7 +5,7 @@
/*
* Mesa 3-D graphics library
- * Version: 6.0
+ * Version: 6.1
*
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
@@ -212,7 +212,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
*params = ctx->Eval.AutoNormal;
break;
case GL_AUX_BUFFERS:
- *params = (ctx->Const.NumAuxBuffers) ? GL_TRUE : GL_FALSE;
+ *params = (ctx->Visual.numAuxBuffers) ? GL_TRUE : GL_FALSE;
break;
case GL_BLEND:
*params = ctx->Color.BlendEnabled;
@@ -1767,7 +1767,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
*params = (GLdouble) ctx->Eval.AutoNormal;
break;
case GL_AUX_BUFFERS:
- *params = (GLdouble) ctx->Const.NumAuxBuffers;
+ *params = (GLdouble) ctx->Visual.numAuxBuffers;
break;
case GL_BLEND:
*params = (GLdouble) ctx->Color.BlendEnabled;
@@ -3317,7 +3317,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
*params = (GLfloat) ctx->Eval.AutoNormal;
break;
case GL_AUX_BUFFERS:
- *params = (GLfloat) ctx->Const.NumAuxBuffers;
+ *params = (GLfloat) ctx->Visual.numAuxBuffers;
break;
case GL_BLEND:
*params = (GLfloat) ctx->Color.BlendEnabled;
@@ -4844,7 +4844,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
*params = (GLint) ctx->Eval.AutoNormal;
break;
case GL_AUX_BUFFERS:
- *params = (GLint) ctx->Const.NumAuxBuffers;
+ *params = (GLint) ctx->Visual.numAuxBuffers;
break;
case GL_BLEND:
*params = (GLint) ctx->Color.BlendEnabled;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 0dcf54baf7..b74eeaccca 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -236,6 +236,27 @@ enum {
FRAG_BIT_TEX7)
+/**
+ * Bits for each basic buffer in a complete framebuffer.
+ * When glDrawBuffer(GL_FRONT_AND_BACK) is called (non-stereo),
+ * _DrawDestMask will be set to (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT),
+ * for example. Also passed to ctx->Driver.Clear() to indicate which
+ * buffers to clear.
+ */
+/*@{*/
+#define DD_FRONT_LEFT_BIT 0x1
+#define DD_FRONT_RIGHT_BIT 0x2
+#define DD_BACK_LEFT_BIT 0x4
+#define DD_BACK_RIGHT_BIT 0x8
+#define DD_AUX0_BIT 0x10
+#define DD_AUX1_BIT 0x20
+#define DD_AUX2_BIT 0x40
+#define DD_AUX3_BIT 0x80
+#define DD_DEPTH_BIT GL_DEPTH_BUFFER_BIT /* 0x00000100 */
+#define DD_ACCUM_BIT GL_ACCUM_BUFFER_BIT /* 0x00000200 */
+#define DD_STENCIL_BIT GL_STENCIL_BUFFER_BIT /* 0x00000400 */
+/*@}*/
+
/**
* Maximum number of temporary vertices required for clipping.
@@ -410,24 +431,6 @@ struct gl_accum_attrib {
/**
- * \name Clipping planes bits
- *
- * Used in gl_colorbuffer_attrib::_DrawDestMask and
- * gl_colorbuffer_attrib::_ReadSrcMask below to identify color buffers.
- */
-/*@{*/
-#define FRONT_LEFT_BIT 0x1
-#define FRONT_RIGHT_BIT 0x2
-#define BACK_LEFT_BIT 0x4
-#define BACK_RIGHT_BIT 0x8
-#define AUX0_BIT 0x10
-#define AUX1_BIT 0x20
-#define AUX2_BIT 0x40
-#define AUX3_BIT 0x80
-/*@}*/
-
-
-/**
* Color buffers attributes.
*/
struct gl_colorbuffer_attrib {
@@ -438,7 +441,7 @@ struct gl_colorbuffer_attrib {
GLubyte ColorMask[4]; /**< Each flag is 0xff or 0x0 */
GLenum DrawBuffer; /**< Which buffer to draw into */
- GLubyte _DrawDestMask; /**< bitwise-OR of FRONT/BACK_LEFT/RIGHT_BITs */
+ GLbitfield _DrawDestMask; /**< bitmask of DD_*_BIT bits */
/**
* \name alpha testing
@@ -1709,6 +1712,7 @@ struct gl_frame_buffer
GLboolean UseSoftwareAccumBuffer;
GLboolean UseSoftwareStencilBuffer;
GLboolean UseSoftwareAlphaBuffers;
+ GLboolean UseSoftwareAuxBuffers;
/** \name Software depth (aka Z) buffer */
/*@{*/
@@ -1733,6 +1737,8 @@ struct gl_frame_buffer
GLchan *BackRightAlpha; /**< array [Width*Height] of GLchan */
/*@}*/
+ GLchan *AuxBuffers[MAX_AUX_BUFFERS];
+
/**
* \name Drawing bounds
*
@@ -1770,7 +1776,6 @@ struct gl_constants
GLfloat MinLineWidth, MaxLineWidth; /* aliased */
GLfloat MinLineWidthAA, MaxLineWidthAA; /* antialiased */
GLfloat LineWidthGranularity;
- GLuint NumAuxBuffers;
GLuint MaxColorTableSize;
GLuint MaxConvolutionWidth;
GLuint MaxConvolutionHeight;
diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c
index 8e2b55fc34..c4fa17f22f 100644
--- a/src/mesa/main/pixel.c
+++ b/src/mesa/main/pixel.c
@@ -1683,8 +1683,12 @@ void _mesa_update_pixel( GLcontext *ctx, GLuint new_state )
/***** Initialization *****/
/**********************************************************************/
+
+/**
+ * Initialize the context's PIXEL attribute group.
+ */
void
-_mesa_init_pixel( GLcontext * ctx )
+_mesa_init_pixel( GLcontext *ctx )
{
int i;
@@ -1815,11 +1819,11 @@ _mesa_init_pixel( GLcontext * ctx )
if (ctx->Visual.doubleBufferMode) {
ctx->Pixel.ReadBuffer = GL_BACK;
- ctx->Pixel._ReadSrcMask = BACK_LEFT_BIT;
+ ctx->Pixel._ReadSrcMask = DD_BACK_LEFT_BIT;
}
else {
ctx->Pixel.ReadBuffer = GL_FRONT;
- ctx->Pixel._ReadSrcMask = FRONT_LEFT_BIT;
+ ctx->Pixel._ReadSrcMask = DD_FRONT_LEFT_BIT;
}
/* Miscellaneous */
diff --git a/src/mesa/sources b/src/mesa/sources
index 832cc587ee..247fd1a4f1 100644
--- a/src/mesa/sources
+++ b/src/mesa/sources
@@ -84,6 +84,7 @@ SWRAST_SOURCES = \
swrast/s_accum.c \
swrast/s_alpha.c \
swrast/s_alphabuf.c \
+ swrast/s_auxbuffer.c \
swrast/s_bitmap.c \
swrast/s_blend.c \
swrast/s_buffers.c \
diff --git a/src/mesa/swrast/s_alphabuf.c b/src/mesa/swrast/s_alphabuf.c
index e0468a4c91..b563baf39a 100644
--- a/src/mesa/swrast/s_alphabuf.c
+++ b/src/mesa/swrast/s_alphabuf.c
@@ -114,13 +114,13 @@ _swrast_clear_alpha_buffers( GLcontext *ctx )
for (bufferBit = 1; bufferBit <= 8; bufferBit = bufferBit << 1) {
if (bufferBit & ctx->Color._DrawDestMask) {
GLchan *buffer;
- if (bufferBit == FRONT_LEFT_BIT) {
+ if (bufferBit == DD_FRONT_LEFT_BIT) {
buffer = ctx->DrawBuffer->FrontLeftAlpha;
}
- else if (bufferBit == FRONT_RIGHT_BIT) {
+ else if (bufferBit == DD_FRONT_RIGHT_BIT) {
buffer = ctx->DrawBuffer->FrontRightAlpha;
}
- else if (bufferBit == BACK_LEFT_BIT) {
+ else if (bufferBit == DD_BACK_LEFT_BIT) {
buffer = ctx->DrawBuffer->BackLeftAlpha;
}
else {
@@ -175,17 +175,17 @@ GLchan *get_alpha_buffer( GLcontext *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- switch (swrast->CurrentBuffer) {
- case FRONT_LEFT_BIT:
+ switch (swrast->CurrentBufferBit) {
+ case DD_FRONT_LEFT_BIT:
return ctx->DrawBuffer->FrontLeftAlpha;
break;
- case BACK_LEFT_BIT:
+ case DD_BACK_LEFT_BIT:
return ctx->DrawBuffer->BackLeftAlpha;
break;
- case FRONT_RIGHT_BIT:
+ case DD_FRONT_RIGHT_BIT:
return ctx->DrawBuffer->FrontRightAlpha;
break;
- case BACK_RIGHT_BIT:
+ case DD_BACK_RIGHT_BIT:
return ctx->DrawBuffer->BackRightAlpha;
break;
default:
diff --git a/src/mesa/swrast/s_auxbuffer.c b/src/mesa/swrast/s_auxbuffer.c
new file mode 100644
index 0000000000..ca36d90ded
--- /dev/null
+++ b/src/mesa/swrast/s_auxbuffer.c
@@ -0,0 +1,121 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "glheader.h"
+#include "imports.h"
+
+#include "s_auxbuffer.h"
+#include "s_context.h"
+
+
+
+void
+_swrast_alloc_aux_buffers( GLframebuffer *buffer )
+{
+ GLuint i;
+
+ for (i = 0; i < buffer->Visual.numAuxBuffers; i++) {
+ if (buffer->AuxBuffers[i]) {
+ _mesa_free(buffer->AuxBuffers[i]);
+ buffer->AuxBuffers[i] = NULL;
+ }
+
+ buffer->AuxBuffers[i] = _mesa_malloc(buffer->Width * buffer->Height
+ * 4 * sizeof(GLchan));
+ }
+}
+
+
+
+/* RGBA */
+#define NAME(PREFIX) PREFIX##_aux
+#define SPAN_VARS \
+ const SWcontext *swrast = SWRAST_CONTEXT(ctx);
+#define INIT_PIXEL_PTR(P, X, Y) \
+ GLchan *P = swrast->CurAuxBuffer + ((Y) * ctx->DrawBuffer->Width + (X)) * 4; \
+ assert(swrast->CurAuxBuffer);
+
+#define INC_PIXEL_PTR(P) P += 4
+#if CHAN_TYPE == GL_FLOAT
+#define STORE_RGB_PIXEL(P, X, Y, R, G, B) \
+ P[0] = MAX2((R), 0.0F); \
+ P[1] = MAX2((G), 0.0F); \
+ P[2] = MAX2((B), 0.0F); \
+ P[3] = CHAN_MAXF
+#define STORE_RGBA_PIXEL(P, X, Y, R, G, B, A) \
+ P[0] = MAX2((R), 0.0F); \
+ P[1] = MAX2((G), 0.0F); \
+ P[2] = MAX2((B), 0.0F); \
+ P[3] = CLAMP((A), 0.0F, CHAN_MAXF)
+#else
+#define STORE_RGB_PIXEL(P, X, Y, R, G, B) \
+ P[0] = R; P[1] = G; P[2] = B; P[3] = CHAN_MAX
+#define STORE_RGBA_PIXEL(P, X, Y, R, G, B, A) \
+ P[0] = R; P[1] = G; P[2] = B; P[3] = A
+#endif
+#define FETCH_RGBA_PIXEL(R, G, B, A, P) \
+ R = P[0]; G = P[1]; B = P[2]; A = P[3]
+#include "swrast/s_spantemp.h"
+
+
+
+/**
+ * Called from driver's SetBuffer() function to choose an aux buffer.
+ */
+void
+_swrast_use_aux_buffer(GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit)
+{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+
+ switch (bufferBit) {
+ case DD_AUX0_BIT:
+ ASSERT(buffer->Visual.numAuxBuffers >= 1);
+ swrast->CurAuxBuffer = ctx->DrawBuffer->AuxBuffers[0];
+ break;
+ case DD_AUX1_BIT:
+ ASSERT(buffer->Visual.numAuxBuffers >= 2);
+ swrast->CurAuxBuffer = ctx->DrawBuffer->AuxBuffers[1];
+ break;
+ case DD_AUX2_BIT:
+ ASSERT(buffer->Visual.numAuxBuffers >= 3);
+ swrast->CurAuxBuffer = ctx->DrawBuffer->AuxBuffers[2];
+ break;
+ case DD_AUX3_BIT:
+ ASSERT(buffer->Visual.numAuxBuffers >= 4);
+ swrast->CurAuxBuffer = ctx->DrawBuffer->AuxBuffers[3];
+ break;
+ default:
+ swrast->CurAuxBuffer = NULL;
+ }
+
+ swrast->Driver.WriteRGBASpan = write_rgba_span_aux;
+ swrast->Driver.WriteRGBSpan = write_rgb_span_aux;
+ swrast->Driver.WriteMonoRGBASpan = write_monorgba_span_aux;
+ swrast->Driver.WriteRGBAPixels = write_rgba_pixels_aux;
+ swrast->Driver.WriteMonoRGBAPixels = write_monorgba_pixels_aux;
+ swrast->Driver.ReadRGBASpan = read_rgba_span_aux;
+ swrast->Driver.ReadRGBAPixels = read_rgba_pixels_aux;
+}
+
diff --git a/src/mesa/swrast/s_auxbuffer.h b/src/mesa/swrast/s_auxbuffer.h
new file mode 100644
index 0000000000..48fb6951a1
--- /dev/null
+++ b/src/mesa/swrast/s_auxbuffer.h
@@ -0,0 +1,41 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef S_AUXBUFFER_H
+#define S_AUXBUFFER_H
+
+
+#include "context.h"
+
+
+extern void
+_swrast_alloc_aux_buffers( GLframebuffer *buffer );
+
+
+extern void
+_swrast_use_aux_buffer(GLcontext *ctx, GLframebuffer *buffr, GLuint bufferBit);
+
+
+#endif /* S_AUXBUFFER_H */
diff --git a/src/mesa/swrast/s_buffers.c b/src/mesa/swrast/s_buffers.c
index 894cc4060f..7888bb618f 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.0.1
+ * Version: 6.1
*
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
@@ -30,16 +30,17 @@
#include "s_accum.h"
#include "s_alphabuf.h"
+#include "s_auxbuffer.h"
#include "s_context.h"
#include "s_depth.h"
#include "s_masking.h"
#include "s_stencil.h"
-
-
-/*
+/**
* Clear the color buffer when glColorMask or glIndexMask is in effect.
+ * We'll have specified which color buffer to clear by previously
+ * calling Driver.SetBuffer().
*/
static void
clear_color_buffer_with_masking( GLcontext *ctx )
@@ -86,9 +87,10 @@ clear_color_buffer_with_masking( GLcontext *ctx )
}
-
-/*
+/**
* Clear a color buffer without index/channel masking.
+ * We'll have specified which color buffer to clear by previously
+ * calling Driver.SetBuffer().
*/
static void
clear_color_buffer(GLcontext *ctx)
@@ -131,11 +133,10 @@ clear_color_buffer(GLcontext *ctx)
}
-
-/*
- * Clear the front/back/left/right color buffers.
- * This function is usually only called if we need to clear the
- * buffers with masking.
+/**
+ * Clear the front/back/left/right/aux color buffers.
+ * This function is usually only called if the device driver can't
+ * clear its own color buffers for some reason (such as with masking).
*/
static void
clear_color_buffers(GLcontext *ctx)
@@ -145,7 +146,7 @@ clear_color_buffers(GLcontext *ctx)
GLuint bufferBit;
/* loop over four possible dest color buffers */
- for (bufferBit = 1; bufferBit <= 8; bufferBit = bufferBit << 1) {
+ for (bufferBit = 1; bufferBit <= DD_AUX3_BIT; bufferBit <<= 1) {
if (bufferBit & ctx->Color._DrawDestMask) {
(*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, bufferBit);
@@ -163,7 +164,12 @@ clear_color_buffers(GLcontext *ctx)
}
-
+/**
+ * Called via the device driver's ctx->Driver.Clear() function if the
+ * device driver can't clear one or more of the buffers itself.
+ * \param mask bitwise-OR of DD_*_BIT flags.
+ * \param all if GL_TRUE, clear whole buffer, else clear specified region.
+ */
void
_swrast_Clear( GLcontext *ctx, GLbitfield mask,
GLboolean all,
@@ -172,13 +178,18 @@ _swrast_Clear( GLcontext *ctx, GLbitfield mask,
SWcontext *swrast = SWRAST_CONTEXT(ctx);
#ifdef DEBUG
{
- GLbitfield legalBits = DD_FRONT_LEFT_BIT |
+ const GLbitfield legalBits =
+ DD_FRONT_LEFT_BIT |
DD_FRONT_RIGHT_BIT |
DD_BACK_LEFT_BIT |
DD_BACK_RIGHT_BIT |
DD_DEPTH_BIT |
DD_STENCIL_BIT |
- DD_ACCUM_BIT;
+ DD_ACCUM_BIT |
+ DD_AUX0_BIT |
+ DD_AUX1_BIT |
+ DD_AUX2_BIT |
+ DD_AUX3_BIT;
assert((mask & (~legalBits)) == 0);
}
#endif
@@ -187,23 +198,34 @@ _swrast_Clear( GLcontext *ctx, GLbitfield mask,
/* do software clearing here */
if (mask) {
- if (mask & ctx->Color._DrawDestMask) clear_color_buffers(ctx);
- if (mask & GL_DEPTH_BUFFER_BIT) _swrast_clear_depth_buffer(ctx);
- if (mask & GL_ACCUM_BUFFER_BIT) _swrast_clear_accum_buffer(ctx);
- if (mask & GL_STENCIL_BUFFER_BIT) _swrast_clear_stencil_buffer(ctx);
- }
-
- /* clear software-based alpha buffer(s) */
- if ( (mask & GL_COLOR_BUFFER_BIT)
- && ctx->DrawBuffer->UseSoftwareAlphaBuffers
- && ctx->Color.ColorMask[ACOMP]) {
- _swrast_clear_alpha_buffers( ctx );
+ if (mask & ctx->Color._DrawDestMask) {
+ clear_color_buffers(ctx);
+ /* clear software-based alpha buffer(s) */
+ if (ctx->DrawBuffer->UseSoftwareAlphaBuffers
+ && ctx->Color.ColorMask[ACOMP]) {
+ _swrast_clear_alpha_buffers( ctx );
+ }
+ }
+ if (mask & DD_DEPTH_BIT) {
+ _swrast_clear_depth_buffer(ctx);
+ }
+ if (mask & DD_ACCUM_BIT) {
+ _swrast_clear_accum_buffer(ctx);
+ }
+ if (mask & DD_STENCIL_BIT) {
+ _swrast_clear_stencil_buffer(ctx);
+ }
}
RENDER_FINISH(swrast,ctx);
}
+/**
+ * Typically called via ctx->Driver.ResizeBuffers().
+ * Reallocate all software-based depth/stencil/accum/etc buffers
+ * to match current window dimensions.
+ */
void
_swrast_alloc_buffers( GLframebuffer *buffer )
{
@@ -220,6 +242,9 @@ _swrast_alloc_buffers( GLframebuffer *buffer )
if (buffer->UseSoftwareAlphaBuffers) {
_swrast_alloc_alpha_buffers( buffer );
}
+ if (buffer->UseSoftwareAuxBuffers) {
+ _swrast_alloc_aux_buffers( buffer );
+ }
}
@@ -244,9 +269,9 @@ _swrast_use_read_buffer( GLcontext *ctx )
SWcontext *swrast = SWRAST_CONTEXT(ctx);
/* Do this so the software-emulated alpha plane span functions work! */
- swrast->CurrentBuffer = ctx->Pixel._ReadSrcMask;
+ swrast->CurrentBufferBit = ctx->Pixel._ReadSrcMask;
/* Tell the device driver where to read/write spans */
- (*swrast->Driver.SetBuffer)( ctx, ctx->ReadBuffer, swrast->CurrentBuffer );
+ swrast->Driver.SetBuffer(ctx, ctx->ReadBuffer, swrast->CurrentBufferBit);
}
@@ -270,17 +295,25 @@ _swrast_use_draw_buffer( GLcontext *ctx )
* we loop over multiple color buffers when needed.
*/
- if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT)
- swrast->CurrentBuffer = FRONT_LEFT_BIT;
- else if (ctx->Color._DrawDestMask & BACK_LEFT_BIT)
- swrast->CurrentBuffer = BACK_LEFT_BIT;
- else if (ctx->Color._DrawDestMask & FRONT_RIGHT_BIT)
- swrast->CurrentBuffer = FRONT_RIGHT_BIT;
- else if (ctx->Color._DrawDestMask & BACK_RIGHT_BIT)
- swrast->CurrentBuffer = BACK_RIGHT_BIT;
+ if (ctx->Color._DrawDestMask & DD_FRONT_LEFT_BIT)
+ swrast->CurrentBufferBit = DD_FRONT_LEFT_BIT;
+ else if (ctx->Color._DrawDestMask & DD_BACK_LEFT_BIT)
+ swrast->CurrentBufferBit = DD_BACK_LEFT_BIT;
+ else if (ctx->Color._DrawDestMask & DD_FRONT_RIGHT_BIT)
+ swrast->CurrentBufferBit = DD_FRONT_RIGHT_BIT;
+ else if (ctx->Color._DrawDestMask & DD_BACK_RIGHT_BIT)
+ swrast->CurrentBufferBit = DD_BACK_RIGHT_BIT;
+ else if (ctx->Color._DrawDestMask & DD_AUX0_BIT)
+ swrast->CurrentBufferBit = DD_AUX0_BIT;
+ else if (ctx->Color._DrawDestMask & DD_AUX1_BIT)
+ swrast->CurrentBufferBit = DD_AUX1_BIT;
+ else if (ctx->Color._DrawDestMask & DD_AUX2_BIT)
+ swrast->CurrentBufferBit = DD_AUX2_BIT;
+ else if (ctx->Color._DrawDestMask & DD_AUX3_BIT)
+ swrast->CurrentBufferBit = DD_AUX3_BIT;
else
/* glDrawBuffer(GL_NONE) */
- swrast->CurrentBuffer = FRONT_LEFT_BIT; /* we always have this buffer */
+ swrast->CurrentBufferBit = DD_FRONT_LEFT_BIT; /* we always have this buffer */
- (*swrast->Driver.SetBuffer)( ctx, ctx->DrawBuffer, swrast->CurrentBuffer );
+ swrast->Driver.SetBuffer(ctx, ctx->DrawBuffer, swrast->CurrentBufferBit);
}
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index be800d4d59..94b57e4bbf 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -91,10 +91,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 (ctx->Color._DrawDestMask != FRONT_LEFT_BIT &&
- ctx->Color._DrawDestMask != BACK_LEFT_BIT &&
- ctx->Color._DrawDestMask != FRONT_RIGHT_BIT &&
- ctx->Color._DrawDestMask != BACK_RIGHT_BIT) {
+ if (_mesa_bitcount(ctx->Color._DrawDestMask) != 1) {
/* more than one color buffer designated for writing (or zero buffers) */
RasterMask |= MULTI_DRAW_BIT;
}
@@ -582,9 +579,9 @@ _swrast_CreateContext( GLcontext *ctx )
swrast->AllowPixelFog = GL_TRUE;
if (ctx->Visual.doubleBufferMode)
- swrast->CurrentBuffer = BACK_LEFT_BIT;
+ swrast->CurrentBufferBit = DD_BACK_LEFT_BIT;
else
- swrast->CurrentBuffer = FRONT_LEFT_BIT;
+ swrast->CurrentBufferBit = DD_FRONT_LEFT_BIT;
/* Optimized Accum buffer */
swrast->_IntegerAccumMode = GL_TRUE;
diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h
index 081d2557ad..d6a14e6b4a 100644
--- a/src/mesa/swrast/s_context.h
+++ b/src/mesa/swrast/s_context.h
@@ -281,6 +281,7 @@ typedef struct
GLboolean _IntegerAccumMode; /**< Storing unscaled integers? */
GLfloat _IntegerAccumScaler; /**< Implicit scale factor */
+ GLchan *CurAuxBuffer;
/* Working values:
*/
@@ -288,7 +289,7 @@ typedef struct
GLuint NewState;
GLuint StateChanges;
GLenum Primitive; /* current primitive being drawn (ala glBegin) */
- GLuint CurrentBuffer; /* exactly one of FRONT_LEFT_BIT, BACK_LEFT_BIT, etc*/
+ GLbitfield CurrentBufferBit; /* exactly one the of DD_*_BIT buffer bits */
/** Mechanism to allow driver (like X11) to register further
* software rasterization routines.
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 801595d970..13248fdc7c 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -653,7 +653,7 @@ multi_write_index_span( GLcontext *ctx, struct sw_span *span )
ASSERT(span->end < MAX_WIDTH);
/* Set the current read/draw buffer */
- swrast->CurrentBuffer = bufferBit;
+ swrast->CurrentBufferBit = bufferBit;
(*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, bufferBit);
/* make copy of incoming indexes */
@@ -710,7 +710,7 @@ multi_write_rgba_span( GLcontext *ctx, struct sw_span *span )
ASSERT(span->end < MAX_WIDTH);
/* Set the current read/draw buffer */
- swrast->CurrentBuffer = bufferBit;
+ swrast->CurrentBufferBit = bufferBit;
(*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, bufferBit);
/* make copy of incoming colors */
diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h
index e1220cff4e..9447e99880 100644
--- a/src/mesa/swrast/swrast.h
+++ b/src/mesa/swrast/swrast.h
@@ -262,18 +262,18 @@ _swrast_copy_texsubimage3d(GLcontext *ctx,
*/
struct swrast_device_driver {
- void (*SetBuffer)( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit);
+ void (*SetBuffer)(GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit);
/*
- * Specifies the current buffer for span/pixel writing/reading.
+ * Specifies the current color buffer for span/pixel writing/reading.
* buffer indicates which window to write to / read from. Normally,
* this'll be the buffer currently bound to the context, but it doesn't
* have to be!
- * bufferBit indicates which color buffer, one of:
- * FRONT_LEFT_BIT - this buffer always exists
- * BACK_LEFT_BIT - when double buffering
- * FRONT_RIGHT_BIT - when using stereo
- * BACK_RIGHT_BIT - when using stereo and double buffering
- * AUXn_BIT - if aux buffers are implemented
+ * bufferBit indicates which color buffer, exactly one of:
+ * DD_FRONT_LEFT_BIT - this buffer always exists
+ * DD_BACK_LEFT_BIT - when double buffering
+ * DD_FRONT_RIGHT_BIT - when using stereo
+ * DD_BACK_RIGHT_BIT - when using stereo and double buffering
+ * DD_AUXn_BIT - if aux buffers are implemented
*/