diff options
author | Keith Whitwell <[email protected]> | 2003-11-24 15:21:14 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2003-11-24 15:21:14 +0000 |
commit | 57c9814b9e87924696df4c741861c29d4236d1eb (patch) | |
tree | 63c9139693032c681fad3e7b50d743b762e0a64d /src/mesa/drivers/dri/r200 | |
parent | 5b5cf9cb8b3f540365e3da8e4a70f6a5040a1c6c (diff) |
Import vtx-0-2-branch
Diffstat (limited to 'src/mesa/drivers/dri/r200')
-rw-r--r-- | src/mesa/drivers/dri/r200/Makefile.X11 | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_context.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_maos_arrays.c | 76 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_state.c | 26 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_swtcl.c | 42 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_tcl.c | 27 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_vtxfmt.c | 22 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_vtxfmt_c.c | 17 |
8 files changed, 113 insertions, 104 deletions
diff --git a/src/mesa/drivers/dri/r200/Makefile.X11 b/src/mesa/drivers/dri/r200/Makefile.X11 index aad26a70acc..bfa332af25e 100644 --- a/src/mesa/drivers/dri/r200/Makefile.X11 +++ b/src/mesa/drivers/dri/r200/Makefile.X11 @@ -1,4 +1,3 @@ -# $Id: Makefile.X11,v 1.6 2003/10/21 06:05:46 jonsmirl Exp $ # Mesa 3-D graphics library # Version: 5.0 diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index b64ee2b1f29..53aa711cc1e 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -169,10 +169,10 @@ static const char * const card_extensions[] = NULL }; -extern const struct gl_pipeline_stage _r200_render_stage; -extern const struct gl_pipeline_stage _r200_tcl_stage; +extern const struct tnl_pipeline_stage _r200_render_stage; +extern const struct tnl_pipeline_stage _r200_tcl_stage; -static const struct gl_pipeline_stage *r200_pipeline[] = { +static const struct tnl_pipeline_stage *r200_pipeline[] = { /* Try and go straight to t&l */ diff --git a/src/mesa/drivers/dri/r200/r200_maos_arrays.c b/src/mesa/drivers/dri/r200/r200_maos_arrays.c index 7842c0c594f..b442dce207a 100644 --- a/src/mesa/drivers/dri/r200/r200_maos_arrays.c +++ b/src/mesa/drivers/dri/r200/r200_maos_arrays.c @@ -43,7 +43,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "math/m_translate.h" #include "tnl/tnl.h" #include "tnl/t_context.h" -#include "tnl/t_imm_debug.h" #include "r200_context.h" #include "r200_ioctl.h" @@ -341,9 +340,6 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs ) GLuint vfmt0 = 0, vfmt1 = 0; GLuint count = VB->Count; - if (R200_DEBUG & DEBUG_VERTS) - _tnl_print_vert_flags( __FUNCTION__, inputs ); - if (1) { if (!rmesa->tcl.obj.buf) emit_vector( ctx, @@ -358,7 +354,7 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs ) case 3: vfmt0 |= R200_VTX_Z0; case 2: default: - break; + break; } component[nr++] = &rmesa->tcl.obj; } @@ -378,60 +374,44 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs ) } if (inputs & VERT_BIT_COLOR0) { - if (VB->ColorPtr[0]->Type == GL_UNSIGNED_BYTE) { - if (!rmesa->tcl.rgba.buf) - emit_ubyte_rgba( ctx, - &rmesa->tcl.rgba, - (char *)VB->ColorPtr[0]->Ptr, - VB->ColorPtr[0]->Size, - VB->ColorPtr[0]->StrideB, - count); - - vfmt0 |= R200_VTX_PK_RGBA << R200_VTX_COLOR_0_SHIFT; + int emitsize; + + if (VB->ColorPtr[0]->size == 4 && + (VB->ColorPtr[0]->stride != 0 || + VB->ColorPtr[0]->data[0][3] != 1.0)) { + vfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT; + emitsize = 4; } - else { - int emitsize; - - if (VB->ColorPtr[0]->Size == 4 && - (VB->ColorPtr[0]->StrideB != 0 || - ((GLfloat *)VB->ColorPtr[0]->Ptr)[3] != 1.0)) { - vfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT; - emitsize = 4; - } - else { - vfmt0 |= R200_VTX_FP_RGB << R200_VTX_COLOR_0_SHIFT; - emitsize = 3; - } - - if (!rmesa->tcl.rgba.buf) - emit_vector( ctx, - &(rmesa->tcl.rgba), - (char *)VB->ColorPtr[0]->Ptr, - emitsize, - VB->ColorPtr[0]->StrideB, - count); + else { + vfmt0 |= R200_VTX_FP_RGB << R200_VTX_COLOR_0_SHIFT; + emitsize = 3; } + if (!rmesa->tcl.rgba.buf) + emit_vector( ctx, + &(rmesa->tcl.rgba), + (char *)VB->ColorPtr[0]->data, + emitsize, + VB->ColorPtr[0]->stride, + count); + component[nr++] = &rmesa->tcl.rgba; } if (inputs & VERT_BIT_COLOR1) { if (!rmesa->tcl.spec.buf) { - if (VB->SecondaryColorPtr[0]->Type != GL_UNSIGNED_BYTE) - r200_import_float_spec_colors( ctx ); - - emit_ubyte_rgba( ctx, - &rmesa->tcl.spec, - (char *)VB->SecondaryColorPtr[0]->Ptr, - 3, - VB->SecondaryColorPtr[0]->StrideB, - count); + emit_vector( ctx, + &rmesa->tcl.spec, + (char *)VB->SecondaryColorPtr[0]->data, + 3, + VB->SecondaryColorPtr[0]->stride, + count); } /* How does this work? */ - vfmt0 |= R200_VTX_PK_RGBA << R200_VTX_COLOR_1_SHIFT; + vfmt0 |= R200_VTX_FP_RGB << R200_VTX_COLOR_1_SHIFT; component[nr++] = &rmesa->tcl.spec; } @@ -480,8 +460,8 @@ void r200ReleaseArrays( GLcontext *ctx, GLuint newinputs ) { r200ContextPtr rmesa = R200_CONTEXT( ctx ); - if (R200_DEBUG & DEBUG_VERTS) - _tnl_print_vert_flags( __FUNCTION__, newinputs ); +/* if (R200_DEBUG & DEBUG_VERTS) */ +/* _tnl_print_vert_flags( __FUNCTION__, newinputs ); */ if (newinputs & VERT_BIT_POS) r200ReleaseDmaRegion( rmesa, &rmesa->tcl.obj, __FUNCTION__ ); diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 55a00cd4de7..27dc6fd1f2b 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -2089,10 +2089,30 @@ static void r200InvalidateState( GLcontext *ctx, GLuint new_state ) r200VtxfmtInvalidate( ctx ); } +/* A hack. The r200 can actually cope just fine with materials + * between begin/ends, so fix this. + */ +static GLboolean check_material( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLint i; + + for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT; + i < _TNL_ATTRIB_MAT_BACK_INDEXES; + i++) + if (tnl->vb.AttribPtr[i] && + tnl->vb.AttribPtr[i]->stride) + return GL_TRUE; + + return GL_FALSE; +} + + static void r200WrapRunPipeline( GLcontext *ctx ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); + GLboolean has_material; if (0) fprintf(stderr, "%s, newstate: %x\n", __FUNCTION__, rmesa->NewGLState); @@ -2102,7 +2122,9 @@ static void r200WrapRunPipeline( GLcontext *ctx ) if (rmesa->NewGLState) r200ValidateState( ctx ); - if (tnl->vb.Material) { + has_material = (ctx->Light.Enabled && check_material( ctx )); + + if (has_material) { TCL_FALLBACK( ctx, R200_TCL_FALLBACK_MATERIAL, GL_TRUE ); } @@ -2110,7 +2132,7 @@ static void r200WrapRunPipeline( GLcontext *ctx ) */ _tnl_run_pipeline( ctx ); - if (tnl->vb.Material) { + if (has_material) { TCL_FALLBACK( ctx, R200_TCL_FALLBACK_MATERIAL, GL_FALSE ); r200UpdateMaterial( ctx ); /* not needed any more? */ } diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c index 9d98358d45e..ca5c456889d 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.c +++ b/src/mesa/drivers/dri/r200/r200_swtcl.c @@ -47,7 +47,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "math/m_translate.h" #include "tnl/tnl.h" #include "tnl/t_context.h" -#include "tnl/t_imm_exec.h" #include "tnl/t_pipeline.h" #include "r200_context.h" @@ -537,7 +536,7 @@ static void VERT_FALLBACK( GLcontext *ctx, tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK ); tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 ); tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start, count, flags ); - R200_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_CLIP; + R200_CONTEXT(ctx)->swtcl.SetupNewInputs = _TNL_BIT_POS; } static void ELT_FALLBACK( GLcontext *ctx, @@ -549,7 +548,7 @@ static void ELT_FALLBACK( GLcontext *ctx, tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK ); tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 ); tnl->Driver.Render.PrimTabElts[flags&PRIM_MODE_MASK]( ctx, start, count, flags ); - R200_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_CLIP; + R200_CONTEXT(ctx)->swtcl.SetupNewInputs = _TNL_BIT_POS; } @@ -631,7 +630,7 @@ do { \ static GLboolean r200_run_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -659,18 +658,21 @@ static GLboolean r200_run_render( GLcontext *ctx, tnl->Driver.Render.Start( ctx ); - for (i = 0 ; !(flags & PRIM_LAST) ; i += length) + for (i = 0 ; i < VB->PrimitiveCount ; i++) { - flags = VB->Primitive[i]; - length = VB->PrimitiveLength[i]; + GLuint prim = VB->Primitive[i].mode; + GLuint start = VB->Primitive[i].start; + GLuint length = VB->Primitive[i].count; + + if (!length) + continue; if (R200_DEBUG & DEBUG_PRIMS) fprintf(stderr, "r200_render.c: prim %s %d..%d\n", - _mesa_lookup_enum_by_nr(flags & PRIM_MODE_MASK), - i, i+length); + _mesa_lookup_enum_by_nr(prim & PRIM_MODE_MASK), + start, start+length); - if (length) - tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags ); + tab[prim & PRIM_MODE_MASK]( ctx, start, start + length, flags ); } tnl->Driver.Render.Finish( ctx ); @@ -681,35 +683,35 @@ static GLboolean r200_run_render( GLcontext *ctx, static void r200_check_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { - GLuint inputs = VERT_BIT_POS | VERT_BIT_CLIP | VERT_BIT_COLOR0; + GLuint inputs = _TNL_BIT_POS | _TNL_BIT_COLOR0; if (ctx->RenderMode == GL_RENDER) { if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) - inputs |= VERT_BIT_COLOR1; + inputs |= _TNL_BIT_COLOR1; if (ctx->Texture.Unit[0]._ReallyEnabled) - inputs |= VERT_BIT_TEX0; + inputs |= _TNL_BIT_TEX0; if (ctx->Texture.Unit[1]._ReallyEnabled) - inputs |= VERT_BIT_TEX1; + inputs |= _TNL_BIT_TEX1; if (ctx->Fog.Enabled) - inputs |= VERT_BIT_FOG; + inputs |= _TNL_BIT_FOG; } stage->inputs = inputs; } -static void dtr( struct gl_pipeline_stage *stage ) +static void dtr( struct tnl_pipeline_stage *stage ) { (void)stage; } -const struct gl_pipeline_stage _r200_render_stage = +const struct tnl_pipeline_stage _r200_render_stage = { "r200 render", (_DD_NEW_SEPARATE_SPECULAR | @@ -1230,7 +1232,7 @@ r200PointsBitmap( GLcontext *ctx, GLint px, GLint py, void r200FlushVertices( GLcontext *ctx, GLuint flags ) { - _tnl_flush_vertices( ctx, flags ); + _tnl_FlushVertices( ctx, flags ); if (flags & FLUSH_STORED_VERTICES) R200_NEWPRIM( R200_CONTEXT( ctx ) ); diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c index b02a7cc559b..60e281ffaf3 100644 --- a/src/mesa/drivers/dri/r200/r200_tcl.c +++ b/src/mesa/drivers/dri/r200/r200_tcl.c @@ -254,7 +254,7 @@ void r200TclPrimitive( GLcontext *ctx, /* TCL render. */ static GLboolean r200_run_tcl_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -277,24 +277,19 @@ static GLboolean r200_run_tcl_render( GLcontext *ctx, rmesa->tcl.Elts = VB->Elts; - for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length) + for (i = 0 ; i < VB->PrimitiveCount ; i++) { - flags = VB->Primitive[i]; - length = VB->PrimitiveLength[i]; - - if (R200_DEBUG & DEBUG_PRIMS) - fprintf(stderr, "%s: prim %s %d..%d\n", - __FUNCTION__, - _mesa_lookup_enum_by_nr(flags & PRIM_MODE_MASK), - i, i+length); + GLuint prim = VB->Primitive[i].mode; + GLuint start = VB->Primitive[i].start; + GLuint length = VB->Primitive[i].count; if (!length) continue; if (rmesa->tcl.Elts) - r200EmitEltPrimitive( ctx, i, i+length, flags ); + r200EmitEltPrimitive( ctx, start, start+length, prim ); else - r200EmitPrimitive( ctx, i, i+length, flags ); + r200EmitPrimitive( ctx, start, start+length, prim ); } return GL_FALSE; /* finished the pipe */ @@ -303,7 +298,7 @@ static GLboolean r200_run_tcl_render( GLcontext *ctx, static void r200_check_tcl_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); GLuint inputs = VERT_BIT_POS; @@ -359,13 +354,13 @@ static void r200_check_tcl_render( GLcontext *ctx, } static void r200_init_tcl_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { stage->check = r200_check_tcl_render; stage->check( ctx, stage ); } -static void dtr( struct gl_pipeline_stage *stage ) +static void dtr( struct tnl_pipeline_stage *stage ) { (void)stage; } @@ -373,7 +368,7 @@ static void dtr( struct gl_pipeline_stage *stage ) /* Initial state for tcl stage. */ -const struct gl_pipeline_stage _r200_tcl_stage = +const struct tnl_pipeline_stage _r200_tcl_stage = { "r200 render", (_DD_NEW_SEPARATE_SPECULAR | diff --git a/src/mesa/drivers/dri/r200/r200_vtxfmt.c b/src/mesa/drivers/dri/r200/r200_vtxfmt.c index a617d3f0290..2e742d4d04f 100644 --- a/src/mesa/drivers/dri/r200/r200_vtxfmt.c +++ b/src/mesa/drivers/dri/r200/r200_vtxfmt.c @@ -74,10 +74,10 @@ static void count_funcs( r200ContextPtr rmesa ) count_func( "Vertex2fv", &rmesa->vb.dfn_cache.Vertex2fv ); count_func( "Vertex3f", &rmesa->vb.dfn_cache.Vertex3f ); count_func( "Vertex3fv", &rmesa->vb.dfn_cache.Vertex3fv ); - count_func( "Color4ub", &rmesa->vb.dfn_cache.Color4ub ); - count_func( "Color4ubv", &rmesa->vb.dfn_cache.Color4ubv ); - count_func( "Color3ub", &rmesa->vb.dfn_cache.Color3ub ); - count_func( "Color3ubv", &rmesa->vb.dfn_cache.Color3ubv ); + count_func( "Color4ub", &rmesa->vb.dfn_cache.Color4ub ); + count_func( "Color4ubv", &rmesa->vb.dfn_cache.Color4ubv ); + count_func( "Color3ub", &rmesa->vb.dfn_cache.Color3ub ); + count_func( "Color3ubv", &rmesa->vb.dfn_cache.Color3ubv ); count_func( "Color4f", &rmesa->vb.dfn_cache.Color4f ); count_func( "Color4fv", &rmesa->vb.dfn_cache.Color4fv ); count_func( "Color3f", &rmesa->vb.dfn_cache.Color3f ); @@ -467,7 +467,10 @@ static void VFMT_FALLBACK( const char *caller ) glNormal3fv( rmesa->vb.normalptr ); if (VTX_COLOR(ind0, 0) == R200_VTX_PK_RGBA) - glColor4ub( rmesa->vb.colorptr->red, rmesa->vb.colorptr->green, rmesa->vb.colorptr->blue, rmesa->vb.colorptr->alpha ); + glColor4ub( rmesa->vb.colorptr->red, + rmesa->vb.colorptr->green, + rmesa->vb.colorptr->blue, + rmesa->vb.colorptr->alpha ); else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGBA) glColor4fv( rmesa->vb.floatcolorptr ); else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGB) { @@ -481,7 +484,9 @@ static void VFMT_FALLBACK( const char *caller ) } if (VTX_COLOR(ind0, 1) == R200_VTX_PK_RGBA) - _glapi_Dispatch->SecondaryColor3ubEXT( rmesa->vb.specptr->red, rmesa->vb.specptr->green, rmesa->vb.specptr->blue ); + _glapi_Dispatch->SecondaryColor3ubEXT( rmesa->vb.specptr->red, + rmesa->vb.specptr->green, + rmesa->vb.specptr->blue ); if (ind1 & (7 << R200_VTX_TEX0_COMP_CNT_SHIFT)) glTexCoord2fv( rmesa->vb.texcoordptr[0] ); @@ -1005,13 +1010,14 @@ void r200VtxfmtInit( GLcontext *ctx, GLboolean useCodegen ) vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT; vfmt->EdgeFlag = _mesa_noop_EdgeFlag; vfmt->EdgeFlagv = _mesa_noop_EdgeFlagv; - vfmt->Indexi = _mesa_noop_Indexi; - vfmt->Indexiv = _mesa_noop_Indexiv; + vfmt->Indexf = _mesa_noop_Indexf; + vfmt->Indexfv = _mesa_noop_Indexfv; /* Active but unsupported -- fallback if we receive these: */ vfmt->CallList = r200_fallback_CallList; + vfmt->CallLists = r200_fallback_CallLists; vfmt->EvalCoord1f = r200_fallback_EvalCoord1f; vfmt->EvalCoord1fv = r200_fallback_EvalCoord1fv; vfmt->EvalCoord2f = r200_fallback_EvalCoord2f; diff --git a/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c b/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c index efef751a616..6f38fffc276 100644 --- a/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c +++ b/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c @@ -826,16 +826,10 @@ void r200VtxfmtInitChoosers( GLvertexformat *vfmt ) { vfmt->Color3f = choose_Color3f; vfmt->Color3fv = choose_Color3fv; - vfmt->Color3ub = choose_Color3ub; - vfmt->Color3ubv = choose_Color3ubv; vfmt->Color4f = choose_Color4f; vfmt->Color4fv = choose_Color4fv; - vfmt->Color4ub = choose_Color4ub; - vfmt->Color4ubv = choose_Color4ubv; vfmt->SecondaryColor3fEXT = choose_SecondaryColor3fEXT; vfmt->SecondaryColor3fvEXT = choose_SecondaryColor3fvEXT; - vfmt->SecondaryColor3ubEXT = choose_SecondaryColor3ubEXT; - vfmt->SecondaryColor3ubvEXT = choose_SecondaryColor3ubvEXT; vfmt->MultiTexCoord1fARB = choose_MultiTexCoord1fARB; vfmt->MultiTexCoord1fvARB = choose_MultiTexCoord1fvARB; vfmt->MultiTexCoord2fARB = choose_MultiTexCoord2fARB; @@ -850,6 +844,17 @@ void r200VtxfmtInitChoosers( GLvertexformat *vfmt ) vfmt->Vertex2fv = choose_Vertex2fv; vfmt->Vertex3f = choose_Vertex3f; vfmt->Vertex3fv = choose_Vertex3fv; + + /* TODO: restore ubyte colors to vtxfmt. + */ +#if 0 + vfmt->Color3ub = choose_Color3ub; + vfmt->Color3ubv = choose_Color3ubv; + vfmt->Color4ub = choose_Color4ub; + vfmt->Color4ubv = choose_Color4ubv; + vfmt->SecondaryColor3ubEXT = choose_SecondaryColor3ubEXT; + vfmt->SecondaryColor3ubvEXT = choose_SecondaryColor3ubvEXT; +#endif } |