diff options
author | Brian Paul <[email protected]> | 2005-05-04 20:11:35 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2005-05-04 20:11:35 +0000 |
commit | e4b2356c07d31fbeeabb13b2fb47db703b473080 (patch) | |
tree | d8b7f1c7c9e7c84d84349485f942dd205dd4c16d /src/mesa/drivers/dri/tdfx | |
parent | ebef61f5c0950572f9c6a81b08f447957461675c (diff) |
Major check-in of changes for GL_EXT_framebuffer_object extension.
Main driver impacts:
- new code for creating the Mesa GLframebuffer
- new span/pixel read/write code
Some drivers not yet updated/tested.
Diffstat (limited to 'src/mesa/drivers/dri/tdfx')
-rw-r--r-- | src/mesa/drivers/dri/tdfx/tdfx_context.c | 14 | ||||
-rw-r--r-- | src/mesa/drivers/dri/tdfx/tdfx_dd.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/tdfx/tdfx_pixels.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/tdfx/tdfx_render.c | 40 | ||||
-rw-r--r-- | src/mesa/drivers/dri/tdfx/tdfx_screen.c | 58 | ||||
-rw-r--r-- | src/mesa/drivers/dri/tdfx/tdfx_span.c | 146 | ||||
-rw-r--r-- | src/mesa/drivers/dri/tdfx/tdfx_span.h | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/tdfx/tdfx_state.c | 10 |
8 files changed, 223 insertions, 56 deletions
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_context.c b/src/mesa/drivers/dri/tdfx/tdfx_context.c index 2a9e23a1a6f..654ada59804 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_context.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_context.c @@ -634,9 +634,9 @@ tdfxMakeCurrent( __DRIcontextPrivate *driContextPriv, /* Need to call _mesa_make_current2() in order to make sure API * dispatch is set correctly. */ - _mesa_make_current2( newCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate ); + _mesa_make_current( newCtx, + (GLframebuffer *) driDrawPriv->driverPrivate, + (GLframebuffer *) driReadPriv->driverPrivate ); return GL_TRUE; } /* [dBorca] tunnel2 requires this */ @@ -667,11 +667,11 @@ tdfxMakeCurrent( __DRIcontextPrivate *driContextPriv, UNLOCK_HARDWARE( newFx ); } - _mesa_make_current2( newCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate ); + _mesa_make_current( newCtx, + (GLframebuffer *) driDrawPriv->driverPrivate, + (GLframebuffer *) driReadPriv->driverPrivate ); } else { - _mesa_make_current( 0, 0 ); + _mesa_make_current( NULL, NULL, NULL ); } return GL_TRUE; diff --git a/src/mesa/drivers/dri/tdfx/tdfx_dd.c b/src/mesa/drivers/dri/tdfx/tdfx_dd.c index 34e4babcf5e..02fbace5be8 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_dd.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_dd.c @@ -43,6 +43,7 @@ #include "context.h" #include "enums.h" +#include "framebuffer.h" #include "swrast/swrast.h" #if defined(USE_X86_ASM) #include "x86/common_x86_asm.h" @@ -257,7 +258,7 @@ void tdfxDDInitDriverFuncs( const __GLcontextModes *visual, functions->GetString = tdfxDDGetString; functions->GetBufferSize = tdfxDDGetBufferSize; - functions->ResizeBuffers = _swrast_alloc_buffers; + functions->ResizeBuffers = _mesa_resize_framebuffer; /* Accelerated paths */ diff --git a/src/mesa/drivers/dri/tdfx/tdfx_pixels.c b/src/mesa/drivers/dri/tdfx/tdfx_pixels.c index 7ec6302cf15..6592ecccfba 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_pixels.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_pixels.c @@ -175,7 +175,7 @@ tdfx_bitmap_R5G6B5(GLcontext * ctx, GLint px, GLint py, SCISSOR_BIT | STENCIL_BIT | MASKING_BIT | - ALPHABUF_BIT | MULTI_DRAW_BIT)) return GL_FALSE; + MULTI_DRAW_BIT)) return GL_FALSE; if (ctx->Scissor.Enabled) { /* This is a bit tricky, but by carefully adjusting the px, py, @@ -339,7 +339,7 @@ tdfx_bitmap_R8G8B8A8(GLcontext * ctx, GLint px, GLint py, SCISSOR_BIT | STENCIL_BIT | MASKING_BIT | - ALPHABUF_BIT | MULTI_DRAW_BIT)) return GL_FALSE; + MULTI_DRAW_BIT)) return GL_FALSE; if (ctx->Scissor.Enabled) { /* This is a bit tricky, but by carefully adjusting the px, py, diff --git a/src/mesa/drivers/dri/tdfx/tdfx_render.c b/src/mesa/drivers/dri/tdfx/tdfx_render.c index 3ce91b9257b..56f5f147eeb 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_render.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_render.c @@ -51,7 +51,7 @@ static void tdfxClear( GLcontext *ctx, GLint x, GLint y, GLint width, GLint height ) { 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; @@ -67,14 +67,14 @@ static void tdfxClear( GLcontext *ctx, } /* we can't clear accum buffers */ - mask &= ~(DD_ACCUM_BIT); + mask &= ~(BUFFER_BIT_ACCUM); - if (mask & DD_STENCIL_BIT) { + if (mask & BUFFER_BIT_STENCIL) { if (!fxMesa->haveHwStencil || ctx->Stencil.WriteMask[0] != 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; } } @@ -82,8 +82,8 @@ static void tdfxClear( GLcontext *ctx, /* 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); + softwareMask |= (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)); + mask &= ~(BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT); } } @@ -94,7 +94,7 @@ static void tdfxClear( GLcontext *ctx, * 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, @@ -119,8 +119,8 @@ static void tdfxClear( GLcontext *ctx, * 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); @@ -139,7 +139,7 @@ static void tdfxClear( GLcontext *ctx, 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/ @@ -173,7 +173,7 @@ static void tdfxClear( GLcontext *ctx, 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); @@ -190,7 +190,7 @@ static void tdfxClear( GLcontext *ctx, 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); @@ -207,7 +207,7 @@ static void tdfxClear( GLcontext *ctx, 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); @@ -234,7 +234,7 @@ static void tdfxClear( GLcontext *ctx, 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); @@ -263,7 +263,7 @@ static void tdfxClear( GLcontext *ctx, 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); @@ -278,14 +278,14 @@ static void tdfxClear( GLcontext *ctx, fxMesa->Color.ClearAlpha, fxMesa->Depth.Clear); FX_grColorMaskv_NoLock(ctx, true4); - if (ctx->Color._DrawDestMask[0] & DD_FRONT_LEFT_BIT) + if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_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); @@ -298,14 +298,14 @@ static void tdfxClear( GLcontext *ctx, fxMesa->Glide.grDepthMask(FXTRUE); } FX_grColorMaskv_NoLock(ctx, true4); - if (ctx->Color._DrawDestMask[0] & DD_FRONT_LEFT_BIT) + if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_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. */ diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 7896811d997..500d5d3f3dd 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -38,9 +38,11 @@ #include "tdfx_context.h" #include "tdfx_lock.h" #include "tdfx_vb.h" +#include "tdfx_span.h" #include "tdfx_tris.h" #include "utils.h" - +#include "framebuffer.h" +#include "renderbuffer.h" #ifdef DEBUG_LOCKING char *prevLockFile = 0; @@ -137,16 +139,70 @@ tdfxCreateBuffer( __DRIscreenPrivate *driScrnPriv, const __GLcontextModes *mesaVis, GLboolean isPixmap ) { + tdfxScreenPrivate *screen = (tdfxScreenPrivate *) driScrnPriv->private; + if (isPixmap) { return GL_FALSE; /* not implemented */ } else { +#if 0 driDrawPriv->driverPrivate = (void *) _mesa_create_framebuffer( mesaVis, GL_FALSE, /* software depth buffer? */ mesaVis->stencilBits > 0, mesaVis->accumRedBits > 0, GL_FALSE /* software alpha channel? */ ); +#else + struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis); + + { + driRenderbuffer *frontRb + = driNewRenderbuffer(GL_RGBA, screen->cpp, + screen->fbOffset, screen->width); + tdfxSetSpanFunctions(frontRb, mesaVis); + _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); + } + + if (mesaVis->doubleBufferMode) { + driRenderbuffer *backRb + = driNewRenderbuffer(GL_RGBA8, screen->cpp, + screen->backOffset, screen->width); + tdfxSetSpanFunctions(backRb, mesaVis); + _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); + } + + if (mesaVis->depthBits == 16) { + driRenderbuffer *depthRb + = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp, + screen->depthOffset, screen->width); + tdfxSetSpanFunctions(depthRb, mesaVis); + _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); + } + else if (mesaVis->depthBits == 24) { + driRenderbuffer *depthRb + = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp, + screen->depthOffset, screen->width); + tdfxSetSpanFunctions(depthRb, mesaVis); + _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); + } + + if (mesaVis->stencilBits > 0) { + driRenderbuffer *stencilRb + = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp, + screen->depthOffset, screen->width); + tdfxSetSpanFunctions(stencilRb, mesaVis); + _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); + } + + _mesa_add_soft_renderbuffers(fb, + GL_FALSE, /* color */ + GL_FALSE, /* depth */ + GL_FALSE, /*swStencil,*/ + mesaVis->accumRedBits > 0, + GL_FALSE, /* alpha */ + GL_FALSE /* aux */); + driDrawPriv->driverPrivate = (void *) fb; +#endif return (driDrawPriv->driverPrivate != NULL); } } diff --git a/src/mesa/drivers/dri/tdfx/tdfx_span.c b/src/mesa/drivers/dri/tdfx/tdfx_span.c index 1bcec634131..1fab811b74d 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_span.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_span.c @@ -596,11 +596,13 @@ GetFbParams(tdfxContextPtr fxMesa, PUT_WRAPPED_FB_DATA(ReadParamsp, type, x, y, value); \ } while (0) + static void -tdfxDDWriteDepthSpan(GLcontext * ctx, - GLuint n, GLint x, GLint y, const GLdepth depth[], +tdfxDDWriteDepthSpan(GLcontext * ctx, struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, const void *values, const GLubyte mask[]) { + const GLuint *depth = (const GLuint *) values; tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; GLint bottom = fxMesa->y_offset + fxMesa->height - 1; GLuint depth_size = fxMesa->glCtx->Visual.depthBits; @@ -833,9 +835,24 @@ tdfxDDWriteDepthSpan(GLcontext * ctx, } static void -tdfxDDReadDepthSpan(GLcontext * ctx, - GLuint n, GLint x, GLint y, GLdepth depth[]) +tdfxDDWriteMonoDepthSpan(GLcontext * ctx, struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, const void *value, + const GLubyte mask[]) { + GLuint depthVal = *((GLuint *) value); + GLuint depths[MAX_WIDTH]; + GLuint i; + for (i = 0; i < n; i++) + depths[i] = depthVal; + tdfxDDWriteDepthSpan(ctx, rb, n, x, y, depths, mask); +} + + +static void +tdfxDDReadDepthSpan(GLcontext * ctx, struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, void *values) +{ + GLuint *depth = (GLuint *) values; tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; GLint bottom = fxMesa->height + fxMesa->y_offset - 1; GLuint i; @@ -936,10 +953,11 @@ tdfxDDReadDepthSpan(GLcontext * ctx, static void -tdfxDDWriteDepthPixels(GLcontext * ctx, +tdfxDDWriteDepthPixels(GLcontext * ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], - const GLdepth depth[], const GLubyte mask[]) + const void *values, const GLubyte mask[]) { + const GLuint *depth = (const GLuint *) values; tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; GLint bottom = fxMesa->height + fxMesa->y_offset - 1; GLuint i; @@ -1018,9 +1036,10 @@ tdfxDDWriteDepthPixels(GLcontext * ctx, static void -tdfxDDReadDepthPixels(GLcontext * ctx, GLuint n, - const GLint x[], const GLint y[], GLdepth depth[]) +tdfxDDReadDepthPixels(GLcontext * ctx, struct gl_renderbuffer *rb, GLuint n, + const GLint x[], const GLint y[], void *values) { + GLuint *depth = (GLuint *) values; tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx; GLint bottom = fxMesa->height + fxMesa->y_offset - 1; GLuint i; @@ -1104,9 +1123,11 @@ tdfxDDReadDepthPixels(GLcontext * ctx, GLuint n, #define BUILD_ZS(z, s) (((s) << 24) | (z)) static void -write_stencil_span(GLcontext * ctx, GLuint n, GLint x, GLint y, - const GLstencil stencil[], const GLubyte mask[]) +write_stencil_span(GLcontext * ctx, struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *values, const GLubyte mask[]) { + const GLubyte *stencil = (const GLubyte *) values; tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); GrLfbInfo_t info; GrLfbInfo_t backBufferInfo; @@ -1161,9 +1182,25 @@ write_stencil_span(GLcontext * ctx, GLuint n, GLint x, GLint y, static void -read_stencil_span(GLcontext * ctx, GLuint n, GLint x, GLint y, - GLstencil stencil[]) +write_mono_stencil_span(GLcontext * ctx, struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *value, const GLubyte mask[]) { + GLbyte stencilVal = *((GLbyte *) value); + GLbyte stencils[MAX_WIDTH]; + GLuint i; + for (i = 0; i < n; i++) + stencils[i] = stencilVal; + write_stencil_span(ctx, rb, n, x, y, stencils, mask); +} + + +static void +read_stencil_span(GLcontext * ctx, struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + void *values) +{ + GLubyte *stencil = (GLubyte *) values; tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); GrLfbInfo_t info; GrLfbInfo_t backBufferInfo; @@ -1211,10 +1248,11 @@ read_stencil_span(GLcontext * ctx, GLuint n, GLint x, GLint y, static void -write_stencil_pixels(GLcontext * ctx, GLuint n, - const GLint x[], const GLint y[], - const GLstencil stencil[], const GLubyte mask[]) +write_stencil_pixels(GLcontext * ctx, struct gl_renderbuffer *rb, + GLuint n, const GLint x[], const GLint y[], + const void *values, const GLubyte mask[]) { + const GLubyte *stencil = (const GLubyte *) values; tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); GrLfbInfo_t info; GrLfbInfo_t backBufferInfo; @@ -1249,9 +1287,11 @@ write_stencil_pixels(GLcontext * ctx, GLuint n, static void -read_stencil_pixels(GLcontext * ctx, GLuint n, const GLint x[], - const GLint y[], GLstencil stencil[]) +read_stencil_pixels(GLcontext * ctx, struct gl_renderbuffer *rb, + GLuint n, const GLint x[], const GLint y[], + void *values) { + GLubyte *stencil = (GLubyte *) values; tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); GrLfbInfo_t info; GrLfbInfo_t backBufferInfo; @@ -1315,10 +1355,10 @@ static void tdfxDDSetBuffer( GLcontext *ctx, (void) buffer; switch ( bufferBit ) { - case DD_FRONT_LEFT_BIT: + case BUFFER_BIT_FRONT_LEFT: fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER; break; - case DD_BACK_LEFT_BIT: + case BUFFER_BIT_BACK_LEFT: fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER; break; default: @@ -1337,6 +1377,7 @@ void tdfxDDInitSpanFuncs( GLcontext *ctx ) swdd->SetBuffer = tdfxDDSetBuffer; +#if 0 if ( VISUAL_EQUALS_RGBA(ctx->Visual, 5, 6, 5, 0) ) { /* 16bpp mode */ @@ -1374,19 +1415,23 @@ void tdfxDDInitSpanFuncs( GLcontext *ctx ) { abort(); } +#endif if ( fxMesa->haveHwStencil ) { +#if 0 swdd->WriteStencilSpan = write_stencil_span; swdd->ReadStencilSpan = read_stencil_span; swdd->WriteStencilPixels = write_stencil_pixels; swdd->ReadStencilPixels = read_stencil_pixels; +#endif } +#if 0 swdd->WriteDepthSpan = tdfxDDWriteDepthSpan; swdd->WriteDepthPixels = tdfxDDWriteDepthPixels; swdd->ReadDepthSpan = tdfxDDReadDepthSpan; swdd->ReadDepthPixels = tdfxDDReadDepthPixels; - +#endif swdd->WriteCI8Span = NULL; swdd->WriteCI32Span = NULL; swdd->WriteMonoCISpan = NULL; @@ -1398,3 +1443,64 @@ void tdfxDDInitSpanFuncs( GLcontext *ctx ) swdd->SpanRenderStart = tdfxSpanRenderStart; swdd->SpanRenderFinish = tdfxSpanRenderFinish; } + + + +/** + * Plug in the Get/Put routines for the given driRenderbuffer. + */ +void +tdfxSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis) +{ + if (drb->Base.InternalFormat == GL_RGBA) { + if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) { + drb->Base.GetRow = tdfxReadRGBASpan_RGB565; + drb->Base.GetValues = tdfxReadRGBAPixels_RGB565; + drb->Base.PutRow = tdfxWriteRGBASpan_RGB565; + drb->Base.PutRowRGB = tdfxWriteRGBSpan_RGB565; + drb->Base.PutMonoRow = tdfxWriteMonoRGBASpan_RGB565; + drb->Base.PutValues = tdfxWriteRGBAPixels_RGB565; + drb->Base.PutMonoValues = tdfxWriteMonoRGBAPixels_RGB565; + } + else if (vis->redBits == 8 && vis->greenBits == 8 + && vis->blueBits == 8 && vis->alphaBits == 0) { + drb->Base.GetRow = tdfxReadRGBASpan_RGB888; + drb->Base.GetValues = tdfxReadRGBAPixels_RGB888; + drb->Base.PutRow = tdfxWriteRGBASpan_RGB888; + drb->Base.PutRowRGB = tdfxWriteRGBSpan_RGB888; + drb->Base.PutMonoRow = tdfxWriteMonoRGBASpan_RGB888; + drb->Base.PutValues = tdfxWriteRGBAPixels_RGB888; + drb->Base.PutMonoValues = tdfxWriteMonoRGBAPixels_RGB888; + } + else if (vis->redBits == 8 && vis->greenBits == 8 + && vis->blueBits == 8 && vis->alphaBits == 8) { + drb->Base.GetRow = tdfxReadRGBASpan_ARGB8888; + drb->Base.GetValues = tdfxReadRGBAPixels_ARGB8888; + drb->Base.PutRow = tdfxWriteRGBASpan_ARGB8888; + drb->Base.PutRowRGB = tdfxWriteRGBSpan_ARGB8888; + drb->Base.PutMonoRow = tdfxWriteMonoRGBASpan_ARGB8888; + drb->Base.PutValues = tdfxWriteRGBAPixels_ARGB8888; + drb->Base.PutMonoValues = tdfxWriteMonoRGBAPixels_ARGB8888; + } + else { + _mesa_problem(NULL, "problem in tdfxSetSpanFunctions"); + } + } + else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16 || + drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) { + drb->Base.GetRow = tdfxDDReadDepthSpan; + drb->Base.GetValues = tdfxDDReadDepthPixels; + drb->Base.PutRow = tdfxDDWriteDepthSpan; + drb->Base.PutMonoRow = tdfxDDWriteMonoDepthSpan; + drb->Base.PutValues = tdfxDDWriteDepthPixels; + drb->Base.PutMonoValues = NULL; + } + else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) { + drb->Base.GetRow = read_stencil_span; + drb->Base.GetValues = read_stencil_pixels; + drb->Base.PutRow = write_stencil_span; + drb->Base.PutMonoRow = write_mono_stencil_span; + drb->Base.PutValues = write_stencil_pixels; + drb->Base.PutMonoValues = NULL; + } +} diff --git a/src/mesa/drivers/dri/tdfx/tdfx_span.h b/src/mesa/drivers/dri/tdfx/tdfx_span.h index a95aad5dbf6..62044144f0a 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_span.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_span.h @@ -39,7 +39,11 @@ #define __TDFX_SPAN_H__ #include "context.h" +#include "drirenderbuffer.h" extern void tdfxDDInitSpanFuncs( GLcontext *ctx ); +extern void +tdfxSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis); + #endif diff --git a/src/mesa/drivers/dri/tdfx/tdfx_state.c b/src/mesa/drivers/dri/tdfx/tdfx_state.c index cb3c1059bca..85d99bb05e7 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_state.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_state.c @@ -377,7 +377,7 @@ static void tdfxUpdateZMode( GLcontext *ctx ) mask = FXFALSE; /* zbuffer is not touched */ } - fxMesa->Depth.Clear = (FxU32) (ctx->DepthMaxF * ctx->Depth.Clear); + fxMesa->Depth.Clear = (FxU32) (ctx->DrawBuffer->_DepthMaxF * ctx->Depth.Clear); if ( fxMesa->Depth.Bias != bias ) { fxMesa->Depth.Bias = bias; @@ -1034,15 +1034,15 @@ static void tdfxDDDrawBuffer( GLcontext *ctx, GLenum mode ) FLUSH_BATCH( fxMesa ); /* - * _DrawDestMask is easier to cope with than <mode>. + * _ColorDrawBufferMask is easier to cope with than <mode>. */ - switch ( ctx->Color._DrawDestMask[0] ) { - case DD_FRONT_LEFT_BIT: + switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) { + case BUFFER_BIT_FRONT_LEFT: fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER; fxMesa->new_state |= TDFX_NEW_RENDER; FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_FALSE ); break; - case DD_BACK_LEFT_BIT: + case BUFFER_BIT_BACK_LEFT: fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER; fxMesa->new_state |= TDFX_NEW_RENDER; FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_FALSE ); |