diff options
Diffstat (limited to 'src/mesa/drivers/dri')
-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 | 41 | ||||
-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 |
7 files changed, 113 insertions, 102 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index ec95f05e6ef..ca6ce4974ae 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -151,10 +151,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 f2abaff3afb..0263d009026 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" @@ -316,9 +315,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, @@ -333,7 +329,7 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs ) case 3: vfmt0 |= R200_VTX_Z0; case 2: default: - break; + break; } component[nr++] = &rmesa->tcl.obj; } @@ -353,60 +349,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; } @@ -455,8 +435,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 dd4025235b6..48b438cc292 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.c +++ b/src/mesa/drivers/dri/r200/r200_swtcl.c @@ -48,7 +48,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" @@ -538,7 +537,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, @@ -550,7 +549,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; } @@ -632,7 +631,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); @@ -660,18 +659,22 @@ 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 ); @@ -682,35 +685,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 | @@ -1231,7 +1234,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 9869ad61963..71e3d5256a9 100644 --- a/src/mesa/drivers/dri/r200/r200_tcl.c +++ b/src/mesa/drivers/dri/r200/r200_tcl.c @@ -255,7 +255,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); @@ -278,24 +278,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 */ @@ -304,7 +299,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; @@ -360,13 +355,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; } @@ -374,7 +369,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 5a4f59d9763..824216eb350 100644 --- a/src/mesa/drivers/dri/r200/r200_vtxfmt.c +++ b/src/mesa/drivers/dri/r200/r200_vtxfmt.c @@ -75,10 +75,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 ); @@ -468,7 +468,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) { @@ -482,7 +485,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] ); @@ -1006,13 +1011,14 @@ void r200VtxfmtInit( GLcontext *ctx ) 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 b7f3fec43e0..bdda60eea09 100644 --- a/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c +++ b/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c @@ -827,16 +827,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; @@ -851,6 +845,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 } |