* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_render.c,v 1.4 2002/02/22 21:45:03 dawes Exp $ */
/*
* New fixes:
/* Clear the color and/or depth buffers.
*/
-static void tdfxClear( GLcontext *ctx,
- GLbitfield mask, GLboolean all,
- GLint x, GLint y, GLint width, GLint height )
+static void tdfxClear( GLcontext *ctx, GLbitfield mask )
{
tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx;
- GLbitfield softwareMask = mask & (DD_ACCUM_BIT);
+ GLbitfield softwareMask = mask & (BUFFER_BIT_ACCUM);
const GLuint stencil_size =
fxMesa->haveHwStencil ? fxMesa->glCtx->Visual.stencilBits : 0;
if ( TDFX_DEBUG & DEBUG_VERBOSE_API ) {
- fprintf( stderr, "%s( %d, %d, %d, %d )\n",
- __FUNCTION__, (int) x, (int) y, (int) width, (int) height );
+ fprintf( stderr, "tdfxClear(0x%x)\n", mask);
}
/* Need this check to respond to glScissor and clipping updates */
}
/* we can't clear accum buffers */
- mask &= ~(DD_ACCUM_BIT);
+ mask &= ~(BUFFER_BIT_ACCUM);
- if (mask & DD_STENCIL_BIT) {
- if (!fxMesa->haveHwStencil || ctx->Stencil.WriteMask[0] != 0xff) {
+ if (mask & BUFFER_BIT_STENCIL) {
+ if (!fxMesa->haveHwStencil || (ctx->Stencil.WriteMask[0] & 0xff) != 0xff) {
/* Napalm seems to have trouble with stencil write masks != 0xff */
/* do stencil clear in software */
- mask &= ~(DD_STENCIL_BIT);
- softwareMask |= DD_STENCIL_BIT;
+ mask &= ~(BUFFER_BIT_STENCIL);
+ softwareMask |= BUFFER_BIT_STENCIL;
}
}
if (fxMesa->glCtx->Visual.redBits != 8) {
/* can only do color masking if running in 24/32bpp on Napalm */
- if (ctx->Color.ColorMask[RCOMP] != ctx->Color.ColorMask[GCOMP] ||
- ctx->Color.ColorMask[GCOMP] != ctx->Color.ColorMask[BCOMP]) {
- softwareMask |= (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT));
- mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT);
+ if (ctx->Color.ColorMask[0][RCOMP] != ctx->Color.ColorMask[0][GCOMP] ||
+ ctx->Color.ColorMask[0][GCOMP] != ctx->Color.ColorMask[0][BCOMP]) {
+ softwareMask |= (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT));
+ mask &= ~(BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT);
}
}
* in the OGL state.
*/
LOCK_HARDWARE(fxMesa);
- if (mask & DD_STENCIL_BIT) {
+ if (mask & BUFFER_BIT_STENCIL) {
fxMesa->Glide.grStencilMask(/*ctx->Stencil.WriteMask*/ 0xff);
/* set stencil ref value = desired clear value */
fxMesa->Glide.grStencilFunc(GR_CMP_ALWAYS,
- fxMesa->Stencil.Clear, 0xff);
+ (fxMesa->Stencil.Clear & 0xff), 0xff);
fxMesa->Glide.grStencilOp(GR_STENCILOP_REPLACE,
GR_STENCILOP_REPLACE, GR_STENCILOP_REPLACE);
fxMesa->Glide.grEnable(GR_STENCIL_MODE_EXT);
* This could probably be done fancier but doing each possible case
* explicitly is less error prone.
*/
- switch (mask & ~DD_STENCIL_BIT) {
- case DD_BACK_LEFT_BIT | DD_DEPTH_BIT:
+ switch (mask & ~BUFFER_BIT_STENCIL) {
+ case BUFFER_BIT_BACK_LEFT | BUFFER_BIT_DEPTH:
/* back buffer & depth */
FX_grColorMaskv_NoLock(ctx, true4); /* work around Voodoo3 bug */
fxMesa->Glide.grDepthMask(FXTRUE);
fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
fxMesa->Color.ClearAlpha,
fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ (FxU32) (ctx->Stencil.Clear & 0xff));
}
else
fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
fxMesa->Glide.grDepthMask(FXFALSE);
}
break;
- case DD_FRONT_LEFT_BIT | DD_DEPTH_BIT:
+ case BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_DEPTH:
/* XXX it appears that the depth buffer isn't cleared when
* glRenderBuffer(GR_BUFFER_FRONTBUFFER) is set.
* This is a work-around/
fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
fxMesa->Color.ClearAlpha,
fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ (FxU32) (ctx->Stencil.Clear & 0xff));
else
fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
fxMesa->Color.ClearAlpha,
- fxMesa->Depth.Clear);
+ fxMesa->Depth.Clear & 0xff);
/* clear front */
FX_grColorMaskv_NoLock(ctx, true4);
fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
fxMesa->Color.ClearAlpha,
fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ (FxU32) (ctx->Stencil.Clear & 0xff));
else
fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
fxMesa->Color.ClearAlpha,
fxMesa->Glide.grDepthMask(FXFALSE);
}
break;
- case DD_BACK_LEFT_BIT:
+ case BUFFER_BIT_BACK_LEFT:
/* back buffer only */
fxMesa->Glide.grDepthMask(FXFALSE);
fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
fxMesa->Color.ClearAlpha,
fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ (FxU32) (ctx->Stencil.Clear & 0xff));
else
fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
fxMesa->Color.ClearAlpha,
fxMesa->Glide.grDepthMask(FXTRUE);
}
break;
- case DD_FRONT_LEFT_BIT:
+ case BUFFER_BIT_FRONT_LEFT:
/* front buffer only */
fxMesa->Glide.grDepthMask(FXFALSE);
fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
fxMesa->Color.ClearAlpha,
fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ (FxU32) (ctx->Stencil.Clear & 0xff));
else
fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
fxMesa->Color.ClearAlpha,
fxMesa->Glide.grDepthMask(FXTRUE);
}
break;
- case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT:
+ case BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT:
/* front and back */
fxMesa->Glide.grDepthMask(FXFALSE);
fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
fxMesa->Color.ClearAlpha,
fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ (FxU32) (ctx->Stencil.Clear & 0xff));
else
fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
fxMesa->Color.ClearAlpha,
fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
fxMesa->Color.ClearAlpha,
fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ (FxU32) (ctx->Stencil.Clear & 0xff));
else
fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
fxMesa->Color.ClearAlpha,
fxMesa->Glide.grDepthMask(FXTRUE);
}
break;
- case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT | DD_DEPTH_BIT:
+ case BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT | BUFFER_BIT_DEPTH:
/* clear front */
fxMesa->Glide.grDepthMask(FXFALSE);
fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
fxMesa->Color.ClearAlpha,
fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ (FxU32) (ctx->Stencil.Clear & 0xff));
else
fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
fxMesa->Color.ClearAlpha,
fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
fxMesa->Color.ClearAlpha,
fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ (FxU32) (ctx->Stencil.Clear & 0xff));
else
fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
fxMesa->Color.ClearAlpha,
fxMesa->Glide.grDepthMask(FXFALSE);
}
break;
- case DD_DEPTH_BIT:
+ case BUFFER_BIT_DEPTH:
/* just the depth buffer */
fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
FX_grColorMaskv_NoLock(ctx, false4);
fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
fxMesa->Color.ClearAlpha,
fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ (FxU32) (ctx->Stencil.Clear & 0xff));
else
fxMesa->Glide.grBufferClear(fxMesa->Color.ClearColor,
fxMesa->Color.ClearAlpha,
fxMesa->Depth.Clear);
FX_grColorMaskv_NoLock(ctx, true4);
- if (ctx->Color._DrawDestMask[0] & DD_FRONT_LEFT_BIT)
+ if (ctx->DrawBuffer->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT)
fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
if (!ctx->Depth.Test || !ctx->Depth.Mask)
fxMesa->Glide.grDepthMask(FXFALSE);
break;
default:
/* clear no color buffers or depth buffer but might clear stencil */
- if (stencil_size > 0 && (mask & DD_STENCIL_BIT)) {
+ if (stencil_size > 0 && (mask & BUFFER_BIT_STENCIL)) {
/* XXX need this RenderBuffer call to work around Glide bug */
fxMesa->Glide.grRenderBuffer(GR_BUFFER_BACKBUFFER);
fxMesa->Glide.grDepthMask(FXFALSE);
fxMesa->Glide.grBufferClearExt(fxMesa->Color.ClearColor,
fxMesa->Color.ClearAlpha,
fxMesa->Depth.Clear,
- (FxU32) ctx->Stencil.Clear);
+ (FxU32) (ctx->Stencil.Clear & 0xff));
if (ctx->Depth.Mask && ctx->Depth.Test) {
fxMesa->Glide.grDepthMask(FXTRUE);
}
FX_grColorMaskv_NoLock(ctx, true4);
- if (ctx->Color._DrawDestMask[0] & DD_FRONT_LEFT_BIT)
+ if (ctx->DrawBuffer->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT)
fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
}
}
}
END_CLIP_LOOP(fxMesa);
- if (fxMesa->haveHwStencil && (mask & DD_STENCIL_BIT)) {
+ if (fxMesa->haveHwStencil && (mask & BUFFER_BIT_STENCIL)) {
/* We changed the stencil state above. Signal that we need to
* upload it again.
*/
}
if (softwareMask)
- _swrast_Clear( ctx, softwareMask, all, x, y, width, height );
+ _swrast_Clear(ctx, softwareMask);
}
*/
void tdfxUploadClipping( tdfxContextPtr fxMesa )
{
- __DRIdrawablePrivate *dPriv = fxMesa->driDrawable;
+ __DRIdrawable *dPriv = fxMesa->driDrawable;
assert(dPriv);
fxMesa->Glide.grColorMask( fxMesa->Color.ColorMask[RCOMP] ||
fxMesa->Color.ColorMask[GCOMP] ||
fxMesa->Color.ColorMask[BCOMP],
- /*fxMesa->Color.ColorMask[ACOMP]*/GL_FALSE/*[dBorca] no-no*/ );
+ /*fxMesa->Color.ColorMask[0][ACOMP]*/GL_FALSE/*[dBorca] no-no*/ );
}
fxMesa->dirty &= ~TDFX_UPLOAD_COLOR_MASK;
}
}
if ( fxMesa->dirty & TDFX_UPLOAD_STENCIL ) {
- if (fxMesa->glCtx->Stencil.Enabled) {
+ if (fxMesa->glCtx->Stencil._Enabled) {
fxMesa->Glide.grEnable(GR_STENCIL_MODE_EXT);
fxMesa->Glide.grStencilOp(fxMesa->Stencil.FailFunc,
fxMesa->Stencil.ZFailFunc,