diff options
-rw-r--r-- | src/mesa/drivers/glide/fxapi.c | 5 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxdd.c | 269 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxddspan.c | 107 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxddtex.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxdrv.h | 218 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxglidew.c | 20 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxglidew.h | 45 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxsetup.c | 20 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxtexman.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxwgl.c | 1 |
10 files changed, 155 insertions, 540 deletions
diff --git a/src/mesa/drivers/glide/fxapi.c b/src/mesa/drivers/glide/fxapi.c index 4166f792aa..ea5f816258 100644 --- a/src/mesa/drivers/glide/fxapi.c +++ b/src/mesa/drivers/glide/fxapi.c @@ -1051,11 +1051,8 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win, fxMesa->screen_width = fxMesa->width; fxMesa->screen_height = fxMesa->height; - fxMesa->x_offset = 0; - fxMesa->y_offset = 0; - fxMesa->y_delta = 0; - fxMesa->needClip = 0; + fxMesa->new_state = ~0; if(verbose) fprintf(stderr,"Voodoo Glide screen size: %dx%d\n", diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c index 4768e1a233..10f635852a 100644 --- a/src/mesa/drivers/glide/fxdd.c +++ b/src/mesa/drivers/glide/fxdd.c @@ -1,4 +1,3 @@ -/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */ /* * Mesa 3-D graphics library @@ -324,21 +323,6 @@ static void fxDDSetReadBuffer(GLcontext *ctx, GLframebuffer *buffer, } -#ifdef XF86DRI -/* test if window coord (px,py) is visible */ -static GLboolean inClipRects(fxMesaContext fxMesa, int px, int py) -{ - int i; - for (i=0; i<fxMesa->numClipRects; i++) { - if ((px>=fxMesa->pClipRects[i].x1) && - (px<fxMesa->pClipRects[i].x2) && - (py>=fxMesa->pClipRects[i].y1) && - (py<fxMesa->pClipRects[i].y2)) return GL_TRUE; - } - return GL_FALSE; -} -#endif - static GLboolean fxDDDrawBitmap(GLcontext *ctx, GLint px, GLint py, GLsizei width, GLsizei height, @@ -352,22 +336,25 @@ static GLboolean fxDDDrawBitmap(GLcontext *ctx, GLint px, GLint py, struct gl_pixelstore_attrib scissoredUnpack; /* check if there's any raster operations enabled which we can't handle */ - if (ctx->RasterMask & (ALPHATEST_BIT | - BLEND_BIT | - DEPTH_BIT | - FOG_BIT | - LOGIC_OP_BIT | - SCISSOR_BIT | - STENCIL_BIT | - MASKING_BIT | - ALPHABUF_BIT | - MULTI_DRAW_BIT)) + if (ctx->Color.AlphaEnabled || + ctx->Color.BlendEnabled || + ctx->Depth.Test || + ctx->Fog.Enabled || + ctx->Color.ColorLogicOpEnabled || + ctx->Stencil.Enabled || + ctx->Scissor.Enabled || + ( ctx->DrawBuffer->UseSoftwareAlphaBuffers && + ctx->Color.ColorMask[ACOMP]) || + ctx->Color.MultiDrawBuffer) return GL_FALSE; + if (ctx->Scissor.Enabled) { /* This is a bit tricky, but by carefully adjusting the px, py, * width, height, skipPixels and skipRows values we can do * scissoring without special code in the rendering loop. + * + * KW: This code is never reached, see the test above. */ /* we'll construct a new pixelstore struct */ @@ -435,25 +422,15 @@ static GLboolean fxDDDrawBitmap(GLcontext *ctx, GLint px, GLint py, return GL_TRUE; } -#ifdef XF86DRI -#define INSIDE(c, x, y) inClipRects((c), (x), (y)) -#else -#define INSIDE(c, x, y) (1) -#endif - { - const GLint winX = fxMesa->x_offset; - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = 0; + const GLint winY = fxMesa->height - 1; /* The dest stride depends on the hardware and whether we're drawing * to the front or back buffer. This compile-time test seems to do * the job for now. */ -#ifdef XF86DRI - const GLint dstStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) - ? (fxMesa->screen_width) : (info.strideInBytes / 2); -#else const GLint dstStride = info.strideInBytes / 2; /* stride in GLushorts */ -#endif + GLint row; /* compute dest address of bottom-left pixel in bitmap */ GLushort *dst = (GLushort *) info.lfbPtr @@ -469,8 +446,7 @@ static GLboolean fxDDDrawBitmap(GLcontext *ctx, GLint px, GLint py, GLint col; for (col=0; col<width; col++) { if (*src & mask) { - if (INSIDE(fxMesa, winX + px + col, winY - py - row)) - dst[col] = color; + dst[col] = color; } if (mask == 128U) { src++; @@ -489,8 +465,7 @@ static GLboolean fxDDDrawBitmap(GLcontext *ctx, GLint px, GLint py, GLint col; for (col=0; col<width; col++) { if (*src & mask) { - if (INSIDE(fxMesa, winX + px + col, winY - py - row)) - dst[col] = color; + dst[col] = color; } if (mask == 1U) { src++; @@ -507,8 +482,6 @@ static GLboolean fxDDDrawBitmap(GLcontext *ctx, GLint px, GLint py, } } -#undef INSIDE - FX_grLfbUnlock(GR_LFB_WRITE_ONLY,fxMesa->currentFB); return GL_TRUE; } @@ -520,7 +493,7 @@ static GLboolean fxDDReadPixels( GLcontext *ctx, GLint x, GLint y, const struct gl_pixelstore_attrib *packing, GLvoid *dstImage ) { - if (ctx->ImageTransferState) { + if (ctx->_ImageTransferState) { return GL_FALSE; /* can't do this */ } else { @@ -535,14 +508,9 @@ static GLboolean fxDDReadPixels( GLcontext *ctx, GLint x, GLint y, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint winX = fxMesa->x_offset; - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; -#ifdef XF86DRI - const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) - ? (fxMesa->screen_width) : (info.strideInBytes / 2); -#else + const GLint winX = 0; + const GLint winY = fxMesa->height - 1; const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */ -#endif const GLushort *src = (const GLushort *) info.lfbPtr + (winY - y) * srcStride + (winX + x); GLubyte *dst = (GLubyte *) _mesa_image_address(packing, dstImage, @@ -640,18 +608,6 @@ static void fxDDFinish(GLcontext *ctx) } -static GLint fxDDGetParameteri(const GLcontext *ctx, GLint param) -{ - switch(param) { - case DD_HAVE_HARDWARE_FOG: - return 1; - default: - fprintf(stderr,"fx Driver: internal error in fxDDGetParameteri(): %x\n", (int) param); - fxCloseHardware(); - exit(-1); - return 0; - } -} void fxDDSetNearFar(GLcontext *ctx, GLfloat n, GLfloat f) @@ -666,39 +622,6 @@ void fxDDSetNearFar(GLcontext *ctx, GLfloat n, GLfloat f) */ static const GLubyte *fxDDGetString(GLcontext *ctx, GLenum name) { -#if defined(GLX_DIRECT_RENDERING) - /* Building for DRI driver */ - switch (name) { - case GL_RENDERER: - { - static char buffer[100]; - char hardware[100]; - strcpy(hardware, grGetString(GR_HARDWARE)); - if (strcmp(hardware, "Voodoo3 (tm)") == 0) - strcpy(hardware, "Voodoo3"); - else if (strcmp(hardware, "Voodoo Banshee (tm)") == 0) - strcpy(hardware, "VoodooBanshee"); - else { - /* unexpected result: replace spaces with hyphens */ - int i; - for (i = 0; hardware[i]; i++) { - if (hardware[i] == ' ' || hardware[i] == '\t') - hardware[i] = '-'; - } - } - /* now make the GL_RENDERER string */ - sprintf(buffer, "Mesa DRI %s 20000510", hardware); - return buffer; - } - case GL_VENDOR: - return "Precision Insight, Inc."; - default: - return NULL; - } - -#else - - /* Building for Voodoo1/2 stand-alone Mesa */ switch (name) { case GL_RENDERER: { @@ -738,7 +661,6 @@ static const GLubyte *fxDDGetString(GLcontext *ctx, GLenum name) default: return NULL; } -#endif } @@ -834,12 +756,17 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa ) fxMesa->new_state = _NEW_ALL; fxDDSetupInit(); - fxDDClipInit(); fxDDTrifuncInit(); fxDDFastPathInit(); + + /* Initialize the software rasterizer and helper modules. + */ + _swrast_CreateContext( fxMesa->glCtx ); + _swsetup_CreateContext( fxMesa->glCtx ); + + fxSetupDDPointers(fxMesa->glCtx); - fxDDRenderInit(fxMesa->glCtx); fxDDInitExtensions(fxMesa->glCtx); fxDDSetNearFar(fxMesa->glCtx,1.0,100.0); @@ -868,13 +795,6 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa ) } -#if 0 -/* Example extension function */ -static void fxFooBarEXT(GLint i) -{ - printf("You called glFooBarEXT(%d)\n", i); -} -#endif void fxDDInitExtensions( GLcontext *ctx ) @@ -894,26 +814,6 @@ void fxDDInitExtensions( GLcontext *ctx ) if (!fxMesa->emulateTwoTMUs) gl_extensions_disable(ctx, "GL_ARB_multitexture"); - - - /* Example of hooking in an extension function. - * For DRI-based drivers, also see __driRegisterExtensions in the - * tdfx_xmesa.c file. - */ -#if 0 - { - void **dispatchTable = (void **) ctx->Exec; - const int _gloffset_FooBarEXT = 555; /* just an example number! */ - const int tabSize = _glapi_get_dispatch_table_size(); - assert(_gloffset_FooBarEXT < tabSize); - dispatchTable[_gloffset_FooBarEXT] = (void *) fxFooBarEXT; - /* XXX You would also need to hook into the display list dispatch - * table. Really, the implementation of extensions might as well - * be in the core of Mesa since core Mesa and the device driver - * is one big shared lib. - */ - } -#endif } @@ -929,48 +829,52 @@ static GLboolean fxIsInHardware(GLcontext *ctx) { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; + if (ctx->RenderMode != GL_RENDER) + return GL_FALSE; + if (!ctx->Hint.AllowDrawMem) return GL_TRUE; /* you'll take it and like it */ - if((ctx->RasterMask & (STENCIL_BIT | MULTI_DRAW_BIT)) || - ((ctx->Color.BlendEnabled) && (ctx->Color.BlendEquation!=GL_FUNC_ADD_EXT)) || - ((ctx->Color.ColorLogicOpEnabled) && (ctx->Color.LogicOp!=GL_COPY)) || - (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) || - (!((ctx->Color.ColorMask[RCOMP]==ctx->Color.ColorMask[GCOMP]) && - (ctx->Color.ColorMask[GCOMP]==ctx->Color.ColorMask[BCOMP]) && - (ctx->Color.ColorMask[ACOMP]==ctx->Color.ColorMask[ACOMP]))) - ) + if (ctx->Stencil.Enabled || + ctx->Color.MultiDrawBuffer || + ((ctx->Color.BlendEnabled) && (ctx->Color.BlendEquation!=GL_FUNC_ADD_EXT)) || + ((ctx->Color.ColorLogicOpEnabled) && (ctx->Color.LogicOp!=GL_COPY)) || + (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) || + (!((ctx->Color.ColorMask[RCOMP]==ctx->Color.ColorMask[GCOMP]) && + (ctx->Color.ColorMask[GCOMP]==ctx->Color.ColorMask[BCOMP]) && + (ctx->Color.ColorMask[ACOMP]==ctx->Color.ColorMask[ACOMP]))) + ) { return GL_FALSE; } /* Unsupported texture/multitexture cases */ if(fxMesa->emulateTwoTMUs) { - if((ctx->Enabled & (TEXTURE0_3D | TEXTURE1_3D)) || + if((ctx->_Enabled & (TEXTURE0_3D | TEXTURE1_3D)) || /* Not very well written ... */ - ((ctx->Enabled & (TEXTURE0_1D | TEXTURE1_1D)) && - ((ctx->Enabled & (TEXTURE0_2D | TEXTURE1_2D))!=(TEXTURE0_2D | TEXTURE1_2D))) + ((ctx->_Enabled & (TEXTURE0_1D | TEXTURE1_1D)) && + ((ctx->_Enabled & (TEXTURE0_2D | TEXTURE1_2D))!=(TEXTURE0_2D | TEXTURE1_2D))) ) { return GL_FALSE; } - if (ctx->Texture.ReallyEnabled & TEXTURE0_2D) { + if (ctx->Texture._ReallyEnabled & TEXTURE0_2D) { if (ctx->Texture.Unit[0].EnvMode == GL_BLEND && - (ctx->Texture.ReallyEnabled & TEXTURE1_2D || + (ctx->Texture._ReallyEnabled & TEXTURE1_2D || ctx->Texture.Unit[0].EnvColor[0] != 0 || ctx->Texture.Unit[0].EnvColor[1] != 0 || ctx->Texture.Unit[0].EnvColor[2] != 0 || ctx->Texture.Unit[0].EnvColor[3] != 1)) { return GL_FALSE; } - if (ctx->Texture.Unit[0].Current->Image[0]->Border > 0) + if (ctx->Texture.Unit[0]._Current->Image[0]->Border > 0) return GL_FALSE; } - if (ctx->Texture.ReallyEnabled & TEXTURE1_2D) { + if (ctx->Texture._ReallyEnabled & TEXTURE1_2D) { if (ctx->Texture.Unit[1].EnvMode == GL_BLEND) return GL_FALSE; - if (ctx->Texture.Unit[0].Current->Image[0]->Border > 0) + if (ctx->Texture.Unit[0]._Current->Image[0]->Border > 0) return GL_FALSE; } @@ -982,8 +886,8 @@ static GLboolean fxIsInHardware(GLcontext *ctx) /* KW: This was wrong (I think) and I changed it... which doesn't mean * it is now correct... */ - if((ctx->Enabled & (TEXTURE0_1D | TEXTURE0_2D | TEXTURE0_3D)) && - (ctx->Enabled & (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D))) + if((ctx->_Enabled & (TEXTURE0_1D | TEXTURE0_2D | TEXTURE0_3D)) && + (ctx->_Enabled & (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D))) { /* Can't use multipass to blend a multitextured triangle - fall * back to software. @@ -1002,16 +906,16 @@ static GLboolean fxIsInHardware(GLcontext *ctx) } } } else { - if((ctx->Enabled & (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D)) || + if((ctx->_Enabled & (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D)) || /* Not very well written ... */ - ((ctx->Enabled & TEXTURE0_1D) && - (!(ctx->Enabled & TEXTURE0_2D))) + ((ctx->_Enabled & TEXTURE0_1D) && + (!(ctx->_Enabled & TEXTURE0_2D))) ) { return GL_FALSE; } - if((ctx->Texture.ReallyEnabled & TEXTURE0_2D) && + if((ctx->Texture._ReallyEnabled & TEXTURE0_2D) && (ctx->Texture.Unit[0].EnvMode==GL_BLEND)) { return GL_FALSE; } @@ -1023,50 +927,32 @@ static GLboolean fxIsInHardware(GLcontext *ctx) static void fxDDUpdateDDPointers(GLcontext *ctx) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; GLuint new_state = ctx->NewState; - if (MESA_VERBOSE&(VERBOSE_DRIVER|VERBOSE_STATE)) - fprintf(stderr,"fxmesa: fxDDUpdateDDPointers(...)\n"); + _swrast_InvalidateState( ctx, new_state ); + _swsetup_InvalidateState( ctx, new_state ); - if (new_state & _FX_NEW_FALLBACK) - fxMesa->is_in_hardware = fxIsInHardware(ctx); + if (new_state & (_FX_NEW_IS_IN_HARDWARE | + _FX_NEW_RENDERSTATE | + _FX_NEW_SETUP_FUNCTION)) + { + fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; - if (fxMesa->is_in_hardware) { + if (new_state & _FX_NEW_IS_IN_HARDWARE) + fxMesa->is_in_hardware = fxIsInHardware(ctx); + if (fxMesa->new_state) fxSetupFXUnits(ctx); - if (new_state & _FX_NEW_RENDERSTATE) { + if (new_state & _FX_NEW_RENDERSTATE) fxDDChooseRenderState( ctx ); - - fxMesa->RenderVBTables=fxDDChooseRenderVBTables(ctx); - fxMesa->RenderVBClippedTab=fxMesa->RenderVBTables[0]; - fxMesa->RenderVBCulledTab=fxMesa->RenderVBTables[1]; - fxMesa->RenderVBRawTab=fxMesa->RenderVBTables[2]; - } if (new_state & _FX_NEW_SETUP_FUNCTION) - ctx->Driver.RasterSetup=fxDDChooseSetupFunction(ctx); - - - ctx->Driver.PointsFunc=fxMesa->PointsFunc; - ctx->Driver.LineFunc=fxMesa->LineFunc; - ctx->Driver.TriangleFunc=fxMesa->TriangleFunc; - ctx->Driver.QuadFunc=fxMesa->QuadFunc; - } else { - fxMesa->render_index = FX_FALLBACK; + ctx->Driver.RasterSetup = fxDDChooseSetupFunction(ctx); } } -static void fxDDReducedPrimitiveChange(GLcontext *ctx, GLenum prim) -{ - if (ctx->Polygon.CullFlag) { - if (ctx->ReducedPrimitive != GL_POLYGON) { /* Lines or Points */ - FX_grCullMode(GR_CULL_DISABLE); - FX_CONTEXT(ctx)->cullMode=GR_CULL_DISABLE; - } - } -} + void fxSetupDDPointers(GLcontext *ctx) { @@ -1074,13 +960,7 @@ void fxSetupDDPointers(GLcontext *ctx) fprintf(stderr,"fxmesa: fxSetupDDPointers()\n"); } - ctx->Driver.UpdateStateNotify = (_FX_NEW_SETUP_FUNCTION| - _FX_NEW_RENDERSTATE| - _FX_NEW_FALLBACK| - _SWRAST_NEW_TRIANGLE| - _SWRAST_NEW_LINE| - _SWRAST_NEW_POINT); - + ctx->Driver.UpdateStateNotify = ~0; ctx->Driver.UpdateState=fxDDUpdateDDPointers; ctx->Driver.WriteDepthSpan=fxDDWriteDepthSpan; @@ -1092,8 +972,6 @@ void fxSetupDDPointers(GLcontext *ctx) ctx->Driver.NearFar=fxDDSetNearFar; - ctx->Driver.GetParameteri=fxDDGetParameteri; - ctx->Driver.ClearIndex=NULL; ctx->Driver.ClearColor=fxDDClearColor; ctx->Driver.Clear=fxDDClear; @@ -1137,27 +1015,16 @@ void fxSetupDDPointers(GLcontext *ctx) ctx->Driver.CullFace=fxDDCullFace; ctx->Driver.ShadeModel=fxDDShadeModel; ctx->Driver.Enable=fxDDEnable; - ctx->Driver.ReducedPrimitiveChange=fxDDReducedPrimitiveChange; ctx->Driver.RegisterVB=fxDDRegisterVB; ctx->Driver.UnregisterVB=fxDDUnregisterVB; ctx->Driver.RegisterPipelineStages = fxDDRegisterPipelineStages; - ctx->Driver.OptimizeImmediatePipeline = 0; /* nothing done yet */ - ctx->Driver.OptimizePrecalcPipeline = 0; - -/* if (getenv("MESA_USE_FAST") || getenv("FX_USE_FAST")) */ -/* ctx->Driver.OptimizePrecalcPipeline = fxDDOptimizePrecalcPipeline; */ - if (!getenv("FX_NO_FAST")) ctx->Driver.BuildPrecalcPipeline = fxDDBuildPrecalcPipeline; - ctx->Driver.TriangleCaps = DD_TRI_CULL|DD_TRI_OFFSET|DD_TRI_LIGHT_TWOSIDE; - fxSetupDDSpanPointers(ctx); - - FX_CONTEXT(ctx)->render_index = 1; /* force an update */ fxDDUpdateDDPointers(ctx); } diff --git a/src/mesa/drivers/glide/fxddspan.c b/src/mesa/drivers/glide/fxddspan.c index c620cc3c61..1c195000a7 100644 --- a/src/mesa/drivers/glide/fxddspan.c +++ b/src/mesa/drivers/glide/fxddspan.c @@ -1,4 +1,3 @@ -/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */ /* * Mesa 3-D graphics library @@ -67,64 +66,10 @@ #if !defined(FXMESA_USE_ARGB) -#if defined(FX_GLIDE3) && defined(XF86DRI) - -static FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer, - FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format, - FxU32 src_width, FxU32 src_height, FxI32 src_stride, - void *src_data) -{ - int i, x, w, srcElt; - void *data; - - if (src_width==1 && src_height==1) { /* Easy case writing a point */ - for (i=0; i<fxMesa->numClipRects; i++) { - if ((dst_x>=fxMesa->pClipRects[i].x1) && - (dst_x<fxMesa->pClipRects[i].x2) && - (dst_y>=fxMesa->pClipRects[i].y1) && - (dst_y<fxMesa->pClipRects[i].y2)) { - FX_grLfbWriteRegion(dst_buffer, dst_x, dst_y, src_format, - 1, 1, src_stride, src_data); - return GL_TRUE; - } - } - } else if (src_height==1) { /* Writing a span */ - if (src_format==GR_LFB_SRC_FMT_8888) srcElt=4; - else if (src_format==GR_LFB_SRC_FMT_ZA16) srcElt=2; - else { - fprintf(stderr, "Unknown src_format passed to writeRegionClipped\n"); - return GL_FALSE; - } - for (i=0; i<fxMesa->numClipRects; i++) { - if (dst_y>=fxMesa->pClipRects[i].y1 && dst_y<fxMesa->pClipRects[i].y2) { - if (dst_x<fxMesa->pClipRects[i].x1) { - x=fxMesa->pClipRects[i].x1; - data=((char*)src_data)+srcElt*(x - dst_x); - w=src_width-(x-dst_x); - } else { - x=dst_x; - data=src_data; - w=src_width; - } - if (x+w>fxMesa->pClipRects[i].x2) { - w=fxMesa->pClipRects[i].x2-x; - } - FX_grLfbWriteRegion(dst_buffer, x, dst_y, src_format, w, 1, - src_stride, data); - } - } - } else { /* Punt on the case of arbitrary rectangles */ - return GL_FALSE; - } - return GL_TRUE; -} - -#else #define writeRegionClipped(fxm,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \ FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) -#endif /* KW: Rearranged the args in the call to grLfbWriteRegion(). @@ -197,13 +142,12 @@ static void fxDDWriteRGBASpan(const GLcontext *ctx, { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; GLuint i; - GLint bottom=fxMesa->height+fxMesa->y_offset-1; + GLint bottom=fxMesa->height-1; if (MESA_VERBOSE&VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxDDWriteRGBASpan(...)\n"); } - x+=fxMesa->x_offset; if (mask) { int span=0; @@ -234,14 +178,13 @@ static void fxDDWriteRGBSpan(const GLcontext *ctx, { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; GLuint i; - GLint bottom=fxMesa->height+fxMesa->y_offset-1; + GLint bottom=fxMesa->height-1; GLubyte rgba[MAX_WIDTH][4]; if (MESA_VERBOSE&VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxDDWriteRGBSpan()\n"); } - x+=fxMesa->x_offset; if (mask) { int span=0; @@ -284,14 +227,13 @@ static void fxDDWriteMonoRGBASpan(const GLcontext *ctx, { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; GLuint i; - GLint bottom=fxMesa->height+fxMesa->y_offset-1; + GLint bottom=fxMesa->height-1; GLuint data[MAX_WIDTH]; if (MESA_VERBOSE&VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxDDWriteMonoRGBASpan(...)\n"); } - x+=fxMesa->x_offset; if (mask) { int span=0; @@ -331,7 +273,7 @@ static void fxDDReadRGBASpan(const GLcontext *ctx, fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; GLushort data[MAX_WIDTH]; GLuint i; - GLint bottom=fxMesa->height+fxMesa->y_offset-1; + GLint bottom=fxMesa->height-1; printf("read span %d, %d, %d\n", x,y,n); if (MESA_VERBOSE&VERBOSE_DRIVER) { @@ -340,7 +282,6 @@ static void fxDDReadRGBASpan(const GLcontext *ctx, assert(n < MAX_WIDTH); - x+=fxMesa->x_offset; FX_grLfbReadRegion( fxMesa->currentFB, x, bottom-y, n, 1, 0, data); for (i=0;i<n;i++) { @@ -370,14 +311,9 @@ static void read_R5G6B5_span(const GLcontext *ctx, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { - const GLint winX = fxMesa->x_offset; - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; -#ifdef XF86DRI - const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) - ? (fxMesa->screen_width) : (info.strideInBytes / 2); -#else + const GLint winX = 0; + const GLint winY = fxMesa->height - 1; const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */ -#endif const GLushort *data16 = (const GLushort *) info.lfbPtr + (winY - y) * srcStride + (winX + x); @@ -422,7 +358,7 @@ static void fxDDWriteRGBAPixels(const GLcontext *ctx, { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; GLuint i; - GLint bottom=fxMesa->height+fxMesa->y_offset-1; + GLint bottom=fxMesa->height-1; if (MESA_VERBOSE&VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxDDWriteRGBAPixels(...)\n"); @@ -430,7 +366,7 @@ static void fxDDWriteRGBAPixels(const GLcontext *ctx, for(i=0;i<n;i++) if(mask[i]) - LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x[i]+fxMesa->x_offset, bottom-y[i], + LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x[i], bottom-y[i], 1, 1, (void *)rgba[i]); } @@ -440,7 +376,7 @@ static void fxDDWriteMonoRGBAPixels(const GLcontext *ctx, { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; GLuint i; - GLint bottom=fxMesa->height+fxMesa->y_offset-1; + GLint bottom=fxMesa->height-1; if (MESA_VERBOSE&VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxDDWriteMonoRGBAPixels(...)\n"); @@ -448,7 +384,7 @@ static void fxDDWriteMonoRGBAPixels(const GLcontext *ctx, for(i=0;i<n;i++) if(mask[i]) - writeRegionClipped(fxMesa, fxMesa->currentFB,x[i]+fxMesa->x_offset,bottom-y[i], + writeRegionClipped(fxMesa, fxMesa->currentFB,x[i],bottom-y[i], GR_LFB_SRC_FMT_8888,1,1,0,(void *) &fxMesa->color); } @@ -466,14 +402,9 @@ static void read_R5G6B5_pixels(const GLcontext *ctx, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { -#ifdef XF86DRI - const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) - ? (fxMesa->screen_width) : (info.strideInBytes / 2); -#else const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */ -#endif - const GLint winX = fxMesa->x_offset; - const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = 0; + const GLint winY = fxMesa->height - 1; GLuint i; for(i=0;i<n;i++) { if(mask[i]) { @@ -503,13 +434,12 @@ void fxDDWriteDepthSpan(GLcontext *ctx, const GLubyte mask[]) { fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; - GLint bottom = fxMesa->height + fxMesa->y_offset - 1; + GLint bottom = fxMesa->height - 1; if (MESA_VERBOSE & VERBOSE_DRIVER) { fprintf(stderr, "fxmesa: fxDDWriteDepthSpan(...)\n"); } - x += fxMesa->x_offset; if (mask) { GLint i; @@ -537,7 +467,7 @@ void fxDDReadDepthSpan(GLcontext *ctx, GLuint n, GLint x, GLint y, GLdepth depth[]) { fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; - GLint bottom = fxMesa->height + fxMesa->y_offset - 1; + GLint bottom = fxMesa->height - 1; GLushort depth16[MAX_WIDTH]; GLuint i; @@ -545,7 +475,6 @@ void fxDDReadDepthSpan(GLcontext *ctx, fprintf(stderr, "fxmesa: fxDDReadDepthSpan(...)\n"); } - x += fxMesa->x_offset; FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER, x, bottom - y, n, 1, 0, depth16); for (i = 0; i < n; i++) { depth[i] = depth16[i]; @@ -559,7 +488,7 @@ void fxDDWriteDepthPixels(GLcontext *ctx, const GLdepth depth[], const GLubyte mask[]) { fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; - GLint bottom = fxMesa->height + fxMesa->y_offset - 1; + GLint bottom = fxMesa->height - 1; GLuint i; if (MESA_VERBOSE & VERBOSE_DRIVER) { @@ -568,7 +497,7 @@ void fxDDWriteDepthPixels(GLcontext *ctx, for (i = 0; i < n; i++) { if (mask[i]) { - int xpos = x[i] + fxMesa->x_offset; + int xpos = x[i]; int ypos = bottom - y[i]; GLushort d = depth[i]; writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, xpos, ypos, @@ -582,7 +511,7 @@ void fxDDReadDepthPixels(GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLdepth depth[]) { fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; - GLint bottom = fxMesa->height + fxMesa->y_offset - 1; + GLint bottom = fxMesa->height - 1; GLuint i; if (MESA_VERBOSE & VERBOSE_DRIVER) { @@ -590,7 +519,7 @@ void fxDDReadDepthPixels(GLcontext *ctx, GLuint n, } for (i = 0; i < n; i++) { - int xpos = x[i] + fxMesa->x_offset; + int xpos = x[i]; int ypos = bottom - y[i]; GLushort d; FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER, xpos, ypos, 1, 1, 0, &d); diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index 553dc8f86a..9f978b3f46 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -1,4 +1,3 @@ -/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */ /* * Mesa 3-D graphics library @@ -463,9 +462,9 @@ void fxDDTexUseGlbPalette(GLcontext *ctx, GLboolean state) else { fxMesa->haveGlobalPaletteTexture = 0; - if ((ctx->Texture.Unit[0].Current == ctx->Texture.Unit[0].CurrentD[2]) && - (ctx->Texture.Unit[0].Current != NULL)) { - struct gl_texture_object *tObj = ctx->Texture.Unit[0].Current; + if ((ctx->Texture.Unit[0]._Current == ctx->Texture.Unit[0].CurrentD[2]) && + (ctx->Texture.Unit[0]._Current != NULL)) { + struct gl_texture_object *tObj = ctx->Texture.Unit[0]._Current; if (!tObj->DriverData) tObj->DriverData = fxAllocTexObjData(fxMesa); diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h index 9a5fd0cd75..833abceb34 100644 --- a/src/mesa/drivers/glide/fxdrv.h +++ b/src/mesa/drivers/glide/fxdrv.h @@ -1,4 +1,3 @@ -/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */ /* * Mesa 3-D graphics library @@ -50,11 +49,7 @@ * you turn debugging on/off from the debugger. */ -#ifdef XFree86Server -#include "GL/xf86glx.h" -#else #include "glheader.h" -#endif #if defined(__linux__) @@ -72,14 +67,13 @@ #include "clip.h" #include "vbrender.h" -#ifdef XF86DRI -typedef struct tfxMesaContext *fxMesaContext; -#else #include "GL/fxmesa.h" -#endif #include "fxglidew.h" -/* use gl/gl.h GLAPI/GLAPIENTRY/GLCALLBACK in place of WINGDIAPI/APIENTRY/CALLBACK, */ -/* these are defined in mesa gl/gl.h - tjump@spgs.com */ + +/* use gl/gl.h GLAPI/GLAPIENTRY/GLCALLBACK in place of + * WINGDIAPI/APIENTRY/CALLBACK, these are defined in mesa gl/gl.h - + * tjump@spgs.com + */ @@ -107,18 +101,6 @@ extern void fx_sanity_triangle( GrVertex *, GrVertex *, GrVertex * ); #define T1COORD GR_VERTEX_TOW_TMU1_OFFSET -#if FX_USE_PARGB - -#define CLIP_XCOORD 0 /* normal place */ -#define CLIP_YCOROD 1 /* normal place */ -#define CLIP_ZCOORD 2 /* normal place */ -#define CLIP_WCOORD 3 /* normal place */ -#define CLIP_GCOORD 4 /* GR_VERTEX_PARGB_OFFSET */ -#define CLIP_BCOORD 5 /* GR_VERTEX_SOW_TMU0_OFFSET */ -#define CLIP_RCOORD 6 /* GR_VERTEX_TOW_TMU0_OFFSET */ -#define CLIP_ACOORD 7 /* GR_VERTEX_OOW_TMU0_OFFSET */ - -#else #define CLIP_XCOORD 0 /* normal place */ #define CLIP_YCOROD 1 /* normal place */ @@ -130,19 +112,16 @@ extern void fx_sanity_triangle( GrVertex *, GrVertex *, GrVertex * ); #define CLIP_ACOORD 7 /* normal place */ -#endif /* Should have size == 16 * sizeof(float). */ -typedef struct { - GLfloat f[15]; /* Same layout as GrVertex */ - GLubyte mask; /* Unsued */ - GLubyte usermask; /* Unused */ +typedef union { + GrVertex v; + GLfloat f[16]; + GLuint ui[16]; } fxVertex; - - #if defined(FXMESA_USE_ARGB) #define FXCOLOR4( c ) ( \ ( ((unsigned int)(c[3]))<<24 ) | \ @@ -162,40 +141,6 @@ typedef struct { #endif #endif -#define FX_VB_COLOR(fxm, color) \ - do { \ - if (sizeof(GLint) == 4*sizeof(GLubyte)) { \ - if (fxm->constColor != *(GLuint*)color) { \ - fxm->constColor = *(GLuint*)color; \ - FX_grConstantColorValue(FXCOLOR4(color)); \ - } \ - } else { \ - FX_grConstantColorValue(FXCOLOR4(color)); \ - } \ - } while (0) - -#define GOURAUD(x) { \ - GLubyte *col = VB->ColorPtr->data[(x)]; \ - gWin[(x)].v.r=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \ - gWin[(x)].v.g=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]); \ - gWin[(x)].v.b=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); \ - gWin[(x)].v.a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \ -} - -#if FX_USE_PARGB -#define GOURAUD2(v, c) { \ - GLubyte *col = c; \ - v->argb=MESACOLOR2PARGB(col); \ -} -#else -#define GOURAUD2(v, c) { \ - GLubyte *col = c; \ - v->r=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \ - v->g=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]); \ - v->b=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); \ - v->a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \ -} -#endif /* Mergable items first @@ -203,9 +148,8 @@ typedef struct { #define SETUP_RGBA 0x1 #define SETUP_TMU0 0x2 #define SETUP_TMU1 0x4 -#define SETUP_XY 0x8 -#define SETUP_Z 0x10 -#define SETUP_W 0x20 +#define SETUP_XYZW 0x8 +#define MAX_SETUP 0x10 #define MAX_MERGABLE 0x8 @@ -319,23 +263,6 @@ typedef struct { } tfxStats; -typedef void (*tfxTriViewClipFunc)( struct vertex_buffer *VB, - GLuint v[], - GLubyte mask ); - -typedef void (*tfxTriClipFunc)( struct vertex_buffer *VB, - GLuint v[], - GLuint mask ); - - -typedef void (*tfxLineClipFunc)( struct vertex_buffer *VB, - GLuint v1, GLuint v2, - GLubyte mask ); - - -extern tfxTriViewClipFunc fxTriViewClipTab[0x8]; -extern tfxTriClipFunc fxTriClipStrideTab[0x8]; -extern tfxLineClipFunc fxLineClipTab[0x8]; typedef struct { /* Alpha test */ @@ -360,14 +287,6 @@ typedef struct { } tfxUnitsState; -/* Flags for render_index. - */ -#define FX_OFFSET 0x1 -#define FX_TWOSIDE 0x2 -#define FX_FRONT_BACK 0x4 -#define FX_FLAT 0x8 -#define FX_ANTIALIAS 0x10 -#define FX_FALLBACK 0x20 /* Flags for fxMesa->new_state @@ -389,50 +308,46 @@ struct tfxMesaVertexBuffer { fxVertex *verts; fxVertex *last_vert; void *vert_store; -#if defined(FX_GLIDE3) - GrVertex **triangle_b; /* Triangle buffer */ - GrVertex **strips_b; /* Strips buffer */ -#endif GLuint size; }; #define FX_DRIVER_DATA(vb) ((struct tfxMesaVertexBuffer *)((vb)->driver_data)) #define FX_CONTEXT(ctx) ((fxMesaContext)((ctx)->DriverCtx)) -#define FX_TEXTURE_DATA(t) fxTMGetTexInfo((t)->Current) +#define FX_TEXTURE_DATA(t) fxTMGetTexInfo((t)->_Current) -#if defined(XFree86Server) || defined(GLX_DIRECT_RENDERING) -#include "tdfx_init.h" -#else -#define DRI_FX_CONTEXT #define BEGIN_BOARD_LOCK() #define END_BOARD_LOCK() #define BEGIN_CLIP_LOOP() #define END_CLIP_LOOP() -#endif /* Covers the state referenced by IsInHardware: */ -#define _FX_NEW_FALLBACK (_NEW_TEXTURE| \ - _NEW_HINT| \ - _NEW_STENCIL| \ - _NEW_BUFFERS| \ - _NEW_COLOR| \ - _NEW_LIGHT) - -/* Covers the state referenced by fxDDChooseRenderState and - * fxDDChoseRenderVBTables. +#define _FX_NEW_IS_IN_HARDWARE (_NEW_TEXTURE| \ + _NEW_HINT| \ + _NEW_STENCIL| \ + _NEW_BUFFERS| \ + _NEW_COLOR| \ + _NEW_LIGHT) + +/* Covers the state referenced by fxDDChooseRenderState */ -#define _FX_NEW_RENDERSTATE (_NEW_RENDERMODE | \ +#define _FX_NEW_RENDERSTATE (_FX_NEW_IS_IN_HARDWARE | \ _DD_NEW_FLATSHADE | \ _DD_NEW_TRI_LIGHT_TWOSIDE| \ - _DD_NEW_MULTIDRAW | \ - _NEW_POINT | \ - _NEW_LINE | \ - _NEW_POLYGON) + _DD_NEW_TRI_OFFSET | \ + _DD_NEW_TRI_UNFILLED | \ + _DD_NEW_TRI_SMOOTH | \ + _DD_NEW_TRI_STIPPLE | \ + _DD_NEW_LINE_SMOOTH | \ + _DD_NEW_LINE_STIPPLE | \ + _DD_NEW_LINE_WIDTH | \ + _DD_NEW_POINT_SMOOTH | \ + _DD_NEW_POINT_SIZE | \ + _NEW_LINE) /* Covers the state referenced by fxDDChooseSetupFunction. */ @@ -450,14 +365,17 @@ extern GLubyte FX_PixelToG[0x10000]; extern GLubyte FX_PixelToB[0x10000]; +typedef void (*fx_tri_func)( GLcontext *, const fxVertex *, const fxVertex *, const fxVertex * ); +typedef void (*fx_line_func)( GLcontext *, const fxVertex *, const fxVertex * ); +typedef void (*fx_point_func)( GLcontext *, const fxVertex * ); +typedef void (*fxRenderEltsFunc)( struct vertex_buffer * ); + struct tfxMesaContext { GuTexPalette glbPalette; GLcontext *glCtx; /* the core Mesa context */ -#if !defined(XFree86Server) && !defined(GLX_DIRECT_RENDERING) GLvisual *glVis; /* describes the color buffer */ GLframebuffer *glBuffer; /* the ancillary buffers */ -#endif GLint board; /* the board used for this context */ GLint width, height; /* size of color buffer */ @@ -476,23 +394,14 @@ struct tfxMesaContext { GLuint tmu_source[FX_NUM_TMU]; GLuint tex_dest[MAX_TEXTURE_UNITS]; + GLuint render_index; GLuint setupindex; - GLuint partial_setup_index; GLuint setupdone; - GLuint mergeindex; - GLuint mergeinputs; - GLuint render_index; - GLuint last_tri_caps; GLuint stw_hint_state; /* for grHints */ GLuint is_in_hardware; GLuint new_state; GLuint using_fast_path, passes, multipass; - tfxLineClipFunc clip_line; - tfxTriClipFunc clip_tri_stride; - tfxTriViewClipFunc view_clip_tri; - - /* Texture Memory Manager Data */ GLuint texBindNumber; @@ -510,17 +419,27 @@ struct tfxMesaContext { /* Acc. functions */ - points_func PointsFunc; - line_func LineFunc; - triangle_func TriangleFunc; - quad_func QuadFunc; + fx_point_func draw_point; + fx_line_func draw_line; + fx_tri_func draw_tri; + + fxRenderEltsFunc RenderElementsRaw; - render_func **RenderVBTables; + /* System to turn culling on/off for tris/lines/points. + */ + fx_point_func initial_point; + fx_line_func initial_line; + fx_tri_func initial_tri; - render_func *RenderVBClippedTab; - render_func *RenderVBCulledTab; - render_func *RenderVBRawTab; + fx_point_func subsequent_point; + fx_line_func subsequent_line; + fx_tri_func subsequent_tri; + + GLfloat inv_s0scale; + GLfloat inv_s1scale; + GLfloat inv_t0scale; + GLfloat inv_t1scale; tfxStats stats; @@ -540,9 +459,6 @@ struct tfxMesaContext { FX_GrContext_t glideContext; - int x_offset; - int y_offset; - int y_delta; int screen_width; int screen_height; int initDone; @@ -550,9 +466,6 @@ struct tfxMesaContext { int clipMaxX; int clipMinY; int clipMaxY; - int needClip; - - DRI_FX_CONTEXT }; typedef void (*tfxSetupFunc)(struct vertex_buffer *, GLuint, GLuint); @@ -572,20 +485,10 @@ extern void fxDDFastPathInit(void); extern void fxDDChooseRenderState( GLcontext *ctx ); -extern void fxRenderClippedLine( struct vertex_buffer *VB, - GLuint v1, GLuint v2 ); - extern tfxSetupFunc fxDDChooseSetupFunction(GLcontext *); -extern points_func fxDDChoosePointsFunction(GLcontext *); -extern line_func fxDDChooseLineFunction(GLcontext *); -extern triangle_func fxDDChooseTriangleFunction(GLcontext *); -extern quad_func fxDDChooseQuadFunction(GLcontext *); -extern render_func **fxDDChooseRenderVBTables(GLcontext *); - extern void fxDDRenderInit(GLcontext *); -extern void fxDDClipInit(void); extern void fxUpdateDDSpanPointers(GLcontext *); extern void fxSetupDDSpanPointers(GLcontext *); @@ -626,12 +529,6 @@ extern void fxDDRegisterVB( struct vertex_buffer *VB ); extern void fxDDUnregisterVB( struct vertex_buffer *VB ); extern void fxDDResizeVB( struct vertex_buffer *VB, GLuint size ); -extern void fxDDCheckMergeAndRender( GLcontext *ctx, - struct gl_pipeline_stage *d ); - -extern void fxDDMergeAndRender( struct vertex_buffer *VB ); - - extern void fxDDPartialRasterSetup( struct vertex_buffer *VB ); extern void fxDDDoRasterSetup( struct vertex_buffer *VB ); @@ -642,11 +539,6 @@ extern GLuint fxDDRegisterPipelineStages( struct gl_pipeline_stage *out, extern GLboolean fxDDBuildPrecalcPipeline( GLcontext *ctx ); -extern void fxDDOptimizePrecalcPipeline( GLcontext *ctx, - struct gl_pipeline *pipe ); - -extern void fxDDRenderElementsDirect( struct vertex_buffer *VB ); - extern void fxDDInitExtensions( GLcontext *ctx ); #define fxTMGetTexInfo(o) ((tfxTexInfo*)((o)->DriverData)) diff --git a/src/mesa/drivers/glide/fxglidew.c b/src/mesa/drivers/glide/fxglidew.c index 3a26e0917f..ba345fcf33 100644 --- a/src/mesa/drivers/glide/fxglidew.c +++ b/src/mesa/drivers/glide/fxglidew.c @@ -1,4 +1,3 @@ -/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */ /* * Mesa 3-D graphics library @@ -265,24 +264,6 @@ void FX_grDrawPolygonVertexList(int n, GrVertex *verts) END_CLIP_LOOP(); } -#if FX_USE_PARGB -void FX_setupGrVertexLayout(void) -{ - BEGIN_BOARD_LOCK(); - grReset(GR_VERTEX_PARAMETER); - - grCoordinateSpace(GR_WINDOW_COORDS); - grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_PARGB_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE); - grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); - grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); - END_BOARD_LOCK(); -} -#else /* FX_USE_PARGB */ void FX_setupGrVertexLayout(void) { BEGIN_BOARD_LOCK(); @@ -300,7 +281,6 @@ void FX_setupGrVertexLayout(void) grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); END_BOARD_LOCK(); } -#endif void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask) { diff --git a/src/mesa/drivers/glide/fxglidew.h b/src/mesa/drivers/glide/fxglidew.h index 6da1ea5f30..9d549368d4 100644 --- a/src/mesa/drivers/glide/fxglidew.h +++ b/src/mesa/drivers/glide/fxglidew.h @@ -1,4 +1,3 @@ -/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */ /* * Mesa 3-D graphics library @@ -181,49 +180,6 @@ typedef struct { } GrTmuVertex; -#if FX_USE_PARGB - -typedef struct -{ - float x, y; /* X and Y in screen space */ - float ooz; /* 65535/Z (used for Z-buffering) */ - float oow; /* 1/W (used for W-buffering, texturing) */ - FxU32 argb; /* R, G, B, A [0..255.0] */ - GrTmuVertex tmuvtx[GLIDE_NUM_TMU]; - float z; /* Z is ignored */ -} GrVertex; - -#define GR_VERTEX_X_OFFSET 0 -#define GR_VERTEX_Y_OFFSET 1 -#define GR_VERTEX_OOZ_OFFSET 2 -#define GR_VERTEX_OOW_OFFSET 3 -#define GR_VERTEX_PARGB_OFFSET 4 -#define GR_VERTEX_SOW_TMU0_OFFSET 5 -#define GR_VERTEX_TOW_TMU0_OFFSET 6 -#define GR_VERTEX_OOW_TMU0_OFFSET 7 -#define GR_VERTEX_SOW_TMU1_OFFSET 8 -#define GR_VERTEX_TOW_TMU1_OFFSET 9 -#define GR_VERTEX_OOW_TMU1_OFFSET 10 -#define GR_VERTEX_Z_OFFSET 11 - -#define GET_PARGB(v) ((FxU32*)(v))[GR_VERTEX_PARGB_OFFSET] -/* GET_PA: returns the alpha component */ -#if GLIDE_ENDIAN == GLIDE_ENDIAN_BIG - #define GET_PA(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4] -#else - #define GET_PA(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+3] -#endif -#define MESACOLOR2PARGB(c) (c[ACOMP] << 24 | c[GCOMP] << 16 | c[GCOMP] << 8 | c[BCOMP]) -#define PACK_4F_ARGB(dest,a,r,g,b) { \ - const GLuint cr = (int)r; \ - const GLuint cg = (int)g; \ - const GLuint ca = (int)a; \ - const GLuint cb = (int)b; \ - dest = ca << 24 | cr << 16 | cg << 8 | cb; \ - } - -#else /* FX_USE_PARGB */ - typedef struct { float x, y, z; /* X, Y, and Z of scrn space -- Z is ignored */ @@ -249,7 +205,6 @@ typedef struct #define GR_VERTEX_SOW_TMU1_OFFSET 12 #define GR_VERTEX_TOW_TMU1_OFFSET 13 #define GR_VERTEX_OOW_TMU1_OFFSET 14 -#endif /* FX_USE_PARGB */ #endif diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c index 64831fcfb3..49d55541c8 100644 --- a/src/mesa/drivers/glide/fxsetup.c +++ b/src/mesa/drivers/glide/fxsetup.c @@ -1,4 +1,3 @@ -/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */ /* * Mesa 3-D graphics library @@ -1078,10 +1077,10 @@ static void fxSetupTexture_NoLock(GLcontext *ctx) /* Texture Combine, Color Combine and Alpha Combine. */ - tex2Denabled = (ctx->Texture.ReallyEnabled & TEXTURE0_2D); + tex2Denabled = (ctx->Texture._ReallyEnabled & TEXTURE0_2D); if (fxMesa->emulateTwoTMUs) - tex2Denabled |= (ctx->Texture.ReallyEnabled & TEXTURE1_2D); + tex2Denabled |= (ctx->Texture._ReallyEnabled & TEXTURE1_2D); switch(tex2Denabled) { case TEXTURE0_2D: @@ -1508,10 +1507,6 @@ void fxSetScissorValues(GLcontext *ctx) ymax=fxMesa->height; check=0; } - xmin+=fxMesa->x_offset; - xmax+=fxMesa->x_offset; - ymin+=fxMesa->y_delta; - ymax+=fxMesa->y_delta; if (xmin<fxMesa->clipMinX) xmin=fxMesa->clipMinX; if (xmax>fxMesa->clipMaxX) xmax=fxMesa->clipMaxX; if (ymin<fxMesa->screen_height-fxMesa->clipMaxY) @@ -1524,11 +1519,9 @@ void fxSetScissorValues(GLcontext *ctx) static void fxSetupScissor(GLcontext *ctx) { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; - if (!fxMesa->needClip) { BEGIN_BOARD_LOCK(); fxSetScissorValues(ctx); END_BOARD_LOCK(); - } } void fxDDScissor( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h ) @@ -1580,6 +1573,7 @@ static void fxSetupCull(GLcontext *ctx) break; } } else FX_CONTEXT(ctx)->cullMode=GR_CULL_DISABLE; + FX_grCullMode(FX_CONTEXT(ctx)->cullMode); } @@ -1839,11 +1833,15 @@ void fxSetupFXUnits( GLcontext *ctx ) if (newstate & FX_NEW_COLOR_MASK) fxSetupColorMask(ctx); - if (newstate & FX_NEW_CULL) + if (newstate & FX_NEW_CULL) { + fxSetupCull(ctx); + } + fxMesa->draw_point = fxMesa->initial_point; + fxMesa->draw_line = fxMesa->initial_line; + fxMesa->draw_tri = fxMesa->initial_tri; fxMesa->new_state = 0; -/* ctx->Driver.RenderStart = 0; */ } } diff --git a/src/mesa/drivers/glide/fxtexman.c b/src/mesa/drivers/glide/fxtexman.c index 2ffaeadd7e..3944ea2ef6 100644 --- a/src/mesa/drivers/glide/fxtexman.c +++ b/src/mesa/drivers/glide/fxtexman.c @@ -1,4 +1,3 @@ -/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */ /* * Mesa 3-D graphics library @@ -718,7 +717,7 @@ fxTMRestoreTextures_NoLock(fxMesaContext ctx) { ti=fxTMGetTexInfo(tObj); if (ti && ti->isInTM) { for (i=0; i<MAX_TEXTURE_UNITS; i++) - if (ctx->glCtx->Texture.Unit[i].Current==tObj) { + if (ctx->glCtx->Texture.Unit[i]._Current==tObj) { /* Force the texture onto the board, as it could be in use */ where=ti->whichTMU; fxTMMoveOutTM_NoLock(ctx, tObj); diff --git a/src/mesa/drivers/glide/fxwgl.c b/src/mesa/drivers/glide/fxwgl.c index 1f0e16a953..cff1e621a3 100644 --- a/src/mesa/drivers/glide/fxwgl.c +++ b/src/mesa/drivers/glide/fxwgl.c @@ -1,4 +1,3 @@ -/* -*- mode: C; tab-width:8; c-basic-offset:2 -*- */ /* * Mesa 3-D graphics library |