From 57c9814b9e87924696df4c741861c29d4236d1eb Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 24 Nov 2003 15:21:14 +0000 Subject: Import vtx-0-2-branch --- src/mesa/drivers/dri/radeon/Makefile.X11 | 1 - src/mesa/drivers/dri/radeon/radeon_context.c | 13 +- src/mesa/drivers/dri/radeon/radeon_context.h | 13 +- src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h | 214 +++++++----------------- src/mesa/drivers/dri/radeon/radeon_maos_verts.c | 38 ++++- src/mesa/drivers/dri/radeon/radeon_state.c | 26 ++- src/mesa/drivers/dri/radeon/radeon_swtcl.c | 55 +++--- src/mesa/drivers/dri/radeon/radeon_tcl.c | 27 ++- src/mesa/drivers/dri/radeon/radeon_vtxfmt.c | 5 +- src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c | 15 +- 10 files changed, 189 insertions(+), 218 deletions(-) (limited to 'src/mesa/drivers/dri/radeon') diff --git a/src/mesa/drivers/dri/radeon/Makefile.X11 b/src/mesa/drivers/dri/radeon/Makefile.X11 index 19dabce262c..fd379e9a0d6 100644 --- a/src/mesa/drivers/dri/radeon/Makefile.X11 +++ b/src/mesa/drivers/dri/radeon/Makefile.X11 @@ -1,4 +1,3 @@ -# $Id: Makefile.X11,v 1.3 2003/10/21 06:05:49 jonsmirl Exp $ # Mesa 3-D graphics library # Version: 5.0 diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index 5604d9c8c21..02bfb23ca59 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -165,11 +165,11 @@ static const char * const card_extensions[] = NULL }; -extern const struct gl_pipeline_stage _radeon_texrect_stage; -extern const struct gl_pipeline_stage _radeon_render_stage; -extern const struct gl_pipeline_stage _radeon_tcl_stage; +extern const struct tnl_pipeline_stage _radeon_texrect_stage; +extern const struct tnl_pipeline_stage _radeon_render_stage; +extern const struct tnl_pipeline_stage _radeon_tcl_stage; -static const struct gl_pipeline_stage *radeon_pipeline[] = { +static const struct tnl_pipeline_stage *radeon_pipeline[] = { /* Try and go straight to t&l */ @@ -412,6 +412,9 @@ radeonCreateContext( const __GLcontextModes *glVisual, radeonInitState( rmesa ); radeonInitSwtcl( ctx ); + _mesa_vector4f_alloc( &rmesa->tcl.ObjClean, 0, + ctx->Const.MaxArrayLockSize, 32 ); + fthrottle_mode = driQueryOptioni(&rmesa->optionCache, "fthrottle_mode"); rmesa->iw.irq_seq = -1; rmesa->irqsEmitted = 0; @@ -505,6 +508,8 @@ void radeonDestroyContext( __DRIcontextPrivate *driContextPriv ) rmesa->glCtx->DriverCtx = NULL; _mesa_destroy_context( rmesa->glCtx ); + _mesa_vector4f_free( &rmesa->tcl.ObjClean ); + if (rmesa->state.scissor.pClipRects) { FREE(rmesa->state.scissor.pClipRects); rmesa->state.scissor.pClipRects = 0; diff --git a/src/mesa/drivers/dri/radeon/radeon_context.h b/src/mesa/drivers/dri/radeon/radeon_context.h index 69808837ea4..b0c3c1919e1 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_context.h @@ -57,6 +57,8 @@ typedef struct radeon_context *radeonContextPtr; #include "radeon_screen.h" #include "mm.h" +#include "math/m_vector.h" + /* Flags for software fallback cases */ /* See correponding strings in radeon_swtcl.c */ #define RADEON_FALLBACK_TEXTURE 0x0001 @@ -503,6 +505,11 @@ struct radeon_tcl_info { GLint last_offset; GLuint hw_primitive; + /* Temporary for cases where incoming vertex data is incompatible + * with maos code. + */ + GLvector4f ObjClean; + struct radeon_dma_region *aos_components[8]; GLuint nr_aos_components; @@ -699,12 +706,6 @@ struct radeon_context { GLuint Fallback; GLuint NewGLState; - - /* Temporaries for translating away float colors: - */ - struct gl_client_array UbyteColor; - struct gl_client_array UbyteSecondaryColor; - /* Vertex buffers */ struct radeon_ioctl ioctl; diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h index b379bad985f..c16234a9437 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h +++ b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h @@ -39,13 +39,14 @@ static void TAG(emit)( GLcontext *ctx, void *dest ) { LOCALVARS - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLuint (*tc0)[4], (*tc1)[4], (*tc2)[4]; + GLfloat (*col)[4], (*spec)[4]; GLfloat (*fog)[4]; GLuint (*norm)[4]; - GLubyte (*col)[4], (*spec)[4]; GLuint tc0_stride, tc1_stride, col_stride, spec_stride, fog_stride; GLuint tc2_stride, norm_stride; + GLuint fill_tex = 0; GLuint (*coord)[4]; GLuint coord_stride; /* object coordinates */ GLubyte dummy[4]; @@ -56,36 +57,20 @@ static void TAG(emit)( GLcontext *ctx, if (RADEON_DEBUG & DEBUG_VERTS) fprintf(stderr, "%s\n", __FUNCTION__); - /* The vertex code expects Obj to be clean to element 3. To fix - * this, add more vertex code (for obj-2, obj-3) or preferably move - * to maos. - */ - if (VB->ObjPtr->size < 3) { - if (VB->ObjPtr->flags & VEC_NOT_WRITEABLE) { - VB->import_data( ctx, VERT_BIT_POS, VEC_NOT_WRITEABLE ); - } - _mesa_vector4f_clean_elem( VB->ObjPtr, VB->Count, 2 ); - } - - if (DO_W && VB->ObjPtr->size < 4) { - if (VB->ObjPtr->flags & VEC_NOT_WRITEABLE) { - VB->import_data( ctx, VERT_BIT_POS, VEC_NOT_WRITEABLE ); - } - _mesa_vector4f_clean_elem( VB->ObjPtr, VB->Count, 3 ); - } - coord = (GLuint (*)[4])VB->ObjPtr->data; coord_stride = VB->ObjPtr->stride; if (DO_TEX2) { - const GLuint t2 = GET_TEXSOURCE(2); - tc2 = (GLuint (*)[4])VB->TexCoordPtr[t2]->data; - tc2_stride = VB->TexCoordPtr[t2]->stride; - if (DO_PTEX && VB->TexCoordPtr[t2]->size < 4) { - if (VB->TexCoordPtr[t2]->flags & VEC_NOT_WRITEABLE) { - VB->import_data( ctx, VERT_BIT_TEX2, VEC_NOT_WRITEABLE ); + if (VB->TexCoordPtr[2]) { + const GLuint t2 = GET_TEXSOURCE(2); + tc2 = (GLuint (*)[4])VB->TexCoordPtr[t2]->data; + tc2_stride = VB->TexCoordPtr[t2]->stride; + if (DO_PTEX && VB->TexCoordPtr[t2]->size < 4) { + fill_tex |= (1<<2); } - _mesa_vector4f_clean_elem( VB->TexCoordPtr[t2], VB->Count, 3 ); + } else { + tc2 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX2]; + tc2_stride = 0; } } @@ -95,13 +80,10 @@ static void TAG(emit)( GLcontext *ctx, tc1 = (GLuint (*)[4])VB->TexCoordPtr[t1]->data; tc1_stride = VB->TexCoordPtr[t1]->stride; if (DO_PTEX && VB->TexCoordPtr[t1]->size < 4) { - if (VB->TexCoordPtr[t1]->flags & VEC_NOT_WRITEABLE) { - VB->import_data( ctx, VERT_BIT_TEX1, VEC_NOT_WRITEABLE ); - } - _mesa_vector4f_clean_elem( VB->TexCoordPtr[t1], VB->Count, 3 ); + fill_tex |= (1<<1); } } else { - tc1 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX1]; /* could be anything, really */ + tc1 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX1]; tc1_stride = 0; } } @@ -112,13 +94,10 @@ static void TAG(emit)( GLcontext *ctx, tc0_stride = VB->TexCoordPtr[t0]->stride; tc0 = (GLuint (*)[4])VB->TexCoordPtr[t0]->data; if (DO_PTEX && VB->TexCoordPtr[t0]->size < 4) { - if (VB->TexCoordPtr[t0]->flags & VEC_NOT_WRITEABLE) { - VB->import_data( ctx, VERT_BIT_TEX0, VEC_NOT_WRITEABLE ); - } - _mesa_vector4f_clean_elem( VB->TexCoordPtr[t0], VB->Count, 3 ); + fill_tex |= (1<<0); } } else { - tc0 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX0]; /* could be anything, really */ + tc0 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX0]; tc0_stride = 0; } @@ -136,28 +115,20 @@ static void TAG(emit)( GLcontext *ctx, if (DO_RGBA) { if (VB->ColorPtr[0]) { - /* This is incorrect when colormaterial is enabled: - */ - if (VB->ColorPtr[0]->Type != GL_UNSIGNED_BYTE) { - if (0) fprintf(stderr, "IMPORTING FLOAT COLORS\n"); - IMPORT_FLOAT_COLORS( ctx ); - } - col = (GLubyte (*)[4])VB->ColorPtr[0]->Ptr; - col_stride = VB->ColorPtr[0]->StrideB; + col = VB->ColorPtr[0]->data; + col_stride = VB->ColorPtr[0]->stride; } else { - col = &dummy; /* any old memory is fine */ + col = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; col_stride = 0; } } if (DO_SPEC) { if (VB->SecondaryColorPtr[0]) { - if (VB->SecondaryColorPtr[0]->Type != GL_UNSIGNED_BYTE) - IMPORT_FLOAT_SPEC_COLORS( ctx ); - spec = (GLubyte (*)[4])VB->SecondaryColorPtr[0]->Ptr; - spec_stride = VB->SecondaryColorPtr[0]->StrideB; + spec = VB->SecondaryColorPtr[0]->data; + spec_stride = VB->SecondaryColorPtr[0]->stride; } else { - spec = &dummy; + spec = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; spec_stride = 0; } } @@ -173,33 +144,33 @@ static void TAG(emit)( GLcontext *ctx, } - if (VB->importable_data) { - if (start) { - coord = (GLuint (*)[4])((GLubyte *)coord + start * coord_stride); - if (DO_TEX0) - tc0 = (GLuint (*)[4])((GLubyte *)tc0 + start * tc0_stride); - if (DO_TEX1) - tc1 = (GLuint (*)[4])((GLubyte *)tc1 + start * tc1_stride); - if (DO_TEX2) - tc2 = (GLuint (*)[4])((GLubyte *)tc2 + start * tc2_stride); - if (DO_NORM) - norm = (GLuint (*)[4])((GLubyte *)norm + start * norm_stride); - if (DO_RGBA) - STRIDE_4UB(col, start * col_stride); - if (DO_SPEC) - STRIDE_4UB(spec, start * spec_stride); - if (DO_FOG) - fog = (GLfloat (*)[4])((GLubyte *)fog + start * fog_stride); - } + if (start) { + coord = (GLuint (*)[4])((GLubyte *)coord + start * coord_stride); + if (DO_TEX0) + tc0 = (GLuint (*)[4])((GLubyte *)tc0 + start * tc0_stride); + if (DO_TEX1) + tc1 = (GLuint (*)[4])((GLubyte *)tc1 + start * tc1_stride); + if (DO_TEX2) + tc2 = (GLuint (*)[4])((GLubyte *)tc2 + start * tc2_stride); + if (DO_NORM) + norm = (GLuint (*)[4])((GLubyte *)norm + start * norm_stride); + if (DO_RGBA) + STRIDE_4F(col, start * col_stride); + if (DO_SPEC) + STRIDE_4F(spec, start * spec_stride); + if (DO_FOG) + STRIDE_4F(fog, start * fog_stride); + } + + { for (i=start; i < end; i++) { + v[0].ui = coord[0][0]; v[1].ui = coord[0][1]; v[2].ui = coord[0][2]; - if (TCL_DEBUG) fprintf(stderr, "%d: %.2f %.2f %.2f ", i, v[0].f, v[1].f, v[2].f); if (DO_W) { v[3].ui = coord[0][3]; - if (TCL_DEBUG) fprintf(stderr, "%.2f ", v[3].f); v += 4; } else @@ -210,26 +181,27 @@ static void TAG(emit)( GLcontext *ctx, v[0].ui = norm[0][0]; v[1].ui = norm[0][1]; v[2].ui = norm[0][2]; - if (TCL_DEBUG) fprintf(stderr, "norm: %.2f %.2f %.2f ", v[0].f, v[1].f, v[2].f); v += 3; norm = (GLuint (*)[4])((GLubyte *)norm + norm_stride); } if (DO_RGBA) { - v[0].ui = LE32_TO_CPU(*(GLuint *)&col[0]); - STRIDE_4UB(col, col_stride); - if (TCL_DEBUG) fprintf(stderr, "%x ", v[0].ui); + UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.red, col[0][0]); + UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.green, col[0][1]); + UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.blue, col[0][2]); + UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.alpha, col[0][3]); + STRIDE_4F(col, col_stride); v++; } if (DO_SPEC || DO_FOG) { if (DO_SPEC) { - v[0].specular.red = spec[0][0]; - v[0].specular.green = spec[0][1]; - v[0].specular.blue = spec[0][2]; - STRIDE_4UB(spec, spec_stride); + UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.red, spec[0][0]); + UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.green, spec[0][1]); + UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.blue, spec[0][2]); + STRIDE_4F(spec, spec_stride); } if (DO_FOG) { - v[0].specular.alpha = fog[0][0] * 255.0; - fog = (GLfloat (*)[4])((GLubyte *)fog + fog_stride); + UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.alpha, fog[0][0]); + fog = (GLfloat (*)[4])((GLubyte *)fog + fog_stride); } if (TCL_DEBUG) fprintf(stderr, "%x ", v[0].ui); v++; @@ -239,7 +211,10 @@ static void TAG(emit)( GLcontext *ctx, v[1].ui = tc0[0][1]; if (TCL_DEBUG) fprintf(stderr, "t0: %.2f %.2f ", v[0].f, v[1].f); if (DO_PTEX) { - v[2].ui = tc0[0][3]; + if (fill_tex & (1<<0)) + v[2].f = 1.0; + else + v[2].ui = tc0[0][3]; if (TCL_DEBUG) fprintf(stderr, "%.2f ", v[2].f); v += 3; } @@ -252,7 +227,10 @@ static void TAG(emit)( GLcontext *ctx, v[1].ui = tc1[0][1]; if (TCL_DEBUG) fprintf(stderr, "t1: %.2f %.2f ", v[0].f, v[1].f); if (DO_PTEX) { - v[2].ui = tc1[0][3]; + if (fill_tex & (1<<1)) + v[2].f = 1.0; + else + v[2].ui = tc1[0][3]; if (TCL_DEBUG) fprintf(stderr, "%.2f ", v[2].f); v += 3; } @@ -264,7 +242,10 @@ static void TAG(emit)( GLcontext *ctx, v[0].ui = tc2[0][0]; v[1].ui = tc2[0][1]; if (DO_PTEX) { - v[2].ui = tc2[0][3]; + if (fill_tex & (1<<2)) + v[2].f = 1.0; + else + v[2].ui = tc2[0][3]; v += 3; } else @@ -273,71 +254,6 @@ static void TAG(emit)( GLcontext *ctx, } if (TCL_DEBUG) fprintf(stderr, "\n"); } - } else { - for (i=start; i < end; i++) { - v[0].ui = coord[i][0]; - v[1].ui = coord[i][1]; - v[2].ui = coord[i][2]; - if (DO_W) { - v[3].ui = coord[i][3]; - v += 4; - } - else - v += 3; - - if (DO_NORM) { - v[0].ui = norm[i][0]; - v[1].ui = norm[i][1]; - v[2].ui = norm[i][2]; - v += 3; - } - if (DO_RGBA) { - v[0].ui = LE32_TO_CPU(*(GLuint *)&col[i]); - v++; - } - if (DO_SPEC || DO_FOG) { - if (DO_SPEC) { - v[0].specular.red = spec[i][0]; - v[0].specular.green = spec[i][1]; - v[0].specular.blue = spec[i][2]; - } - if (DO_FOG) { - GLfloat *f = (GLfloat *) ((GLubyte *)fog + fog_stride); - v[0].specular.alpha = *f * 255.0; - } - v++; - } - if (DO_TEX0) { - v[0].ui = tc0[i][0]; - v[1].ui = tc0[i][1]; - if (DO_PTEX) { - v[2].ui = tc0[i][3]; - v += 3; - } - else - v += 2; - } - if (DO_TEX1) { - v[0].ui = tc1[i][0]; - v[1].ui = tc1[i][1]; - if (DO_PTEX) { - v[2].ui = tc1[i][3]; - v += 3; - } - else - v += 2; - } - if (DO_TEX2) { - v[0].ui = tc2[i][0]; - v[1].ui = tc2[i][1]; - if (DO_PTEX) { - v[2].ui = tc2[i][3]; - v += 3; - } - else - v += 2; - } - } } } diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c index b32fd624fa3..5e63e6e880f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c @@ -40,7 +40,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "array_cache/acache.h" #include "tnl/tnl.h" #include "tnl/t_pipeline.h" -#include "tnl/t_imm_debug.h" #include "radeon_context.h" #include "radeon_state.h" @@ -53,7 +52,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define RADEON_TCL_MAX_SETUP 13 -union emit_union { float f; GLuint ui; radeon_color_t specular; }; +union emit_union { float f; GLuint ui; radeon_color_t rgba; }; static struct { void (*emit)( GLcontext *, GLuint, GLuint, void * ); @@ -308,6 +307,41 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs ) setup_tab[i].vertex_size * 4, 4); + /* The vertex code expects Obj to be clean to element 3. To fix + * this, add more vertex code (for obj-2, obj-3) or preferably move + * to maos. + */ + if (VB->ObjPtr->size < 3 || + (VB->ObjPtr->size == 3 && + (setup_tab[i].vertex_format & RADEON_CP_VC_FRMT_W0))) { + + _math_trans_4f( rmesa->tcl.ObjClean.data, + VB->ObjPtr->data, + VB->ObjPtr->stride, + GL_FLOAT, + VB->ObjPtr->size, + 0, + VB->Count ); + + switch (VB->ObjPtr->size) { + case 1: + _mesa_vector4f_clean_elem(&rmesa->tcl.ObjClean, VB->Count, 1); + case 2: + _mesa_vector4f_clean_elem(&rmesa->tcl.ObjClean, VB->Count, 2); + case 3: + if (setup_tab[i].vertex_format & RADEON_CP_VC_FRMT_W0) { + _mesa_vector4f_clean_elem(&rmesa->tcl.ObjClean, VB->Count, 3); + } + case 4: + default: + break; + } + + VB->ObjPtr = &rmesa->tcl.ObjClean; + } + + + setup_tab[i].emit( ctx, 0, VB->Count, rmesa->tcl.indexed_verts.address + rmesa->tcl.indexed_verts.start ); diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index 7b1bbe75fd2..c15f3417bb9 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -2115,10 +2115,30 @@ static void radeonInvalidateState( GLcontext *ctx, GLuint new_state ) radeonVtxfmtInvalidate( ctx ); } + +/* A hack. Need a faster way to find this out. + */ +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 radeonWrapRunPipeline( GLcontext *ctx ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); + GLboolean has_material; if (0) fprintf(stderr, "%s, newstate: %x\n", __FUNCTION__, rmesa->NewGLState); @@ -2128,7 +2148,9 @@ static void radeonWrapRunPipeline( GLcontext *ctx ) if (rmesa->NewGLState) radeonValidateState( ctx ); - if (tnl->vb.Material) { + has_material = (ctx->Light.Enabled && check_material( ctx )); + + if (has_material) { TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_MATERIAL, GL_TRUE ); } @@ -2136,7 +2158,7 @@ static void radeonWrapRunPipeline( GLcontext *ctx ) */ _tnl_run_pipeline( ctx ); - if (tnl->vb.Material) { + if (has_material) { TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_MATERIAL, GL_FALSE ); radeonUpdateMaterial( ctx ); /* not needed any more? */ } diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/src/mesa/drivers/dri/radeon/radeon_swtcl.c index 89db677392d..157a863e328 100644 --- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c +++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c @@ -44,8 +44,8 @@ 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 "tnl/t_vtx_api.h" /* for _tnl_FlushVertices */ #include "radeon_context.h" #include "radeon_ioctl.h" @@ -521,7 +521,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 ); - RADEON_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_CLIP; + RADEON_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_POS; } static void ELT_FALLBACK( GLcontext *ctx, @@ -533,7 +533,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 ); - RADEON_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_CLIP; + RADEON_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_POS; } @@ -621,7 +621,7 @@ do { \ static GLboolean radeon_run_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -646,18 +646,22 @@ static GLboolean radeon_run_render( GLcontext *ctx, return GL_TRUE; /* too many vertices */ } - 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 (RADEON_DEBUG & DEBUG_PRIMS) - fprintf(stderr, "radeon_render.c: prim %s %d..%d\n", - _mesa_lookup_enum_by_nr(flags & PRIM_MODE_MASK), - i, i+length); + fprintf(stderr, "r200_render.c: prim %s %d..%d\n", + _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 ); @@ -668,9 +672,9 @@ static GLboolean radeon_run_render( GLcontext *ctx, static void radeon_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 = VERT_BIT_POS | VERT_BIT_COLOR0; if (ctx->RenderMode == GL_RENDER) { if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) @@ -690,13 +694,13 @@ static void radeon_check_render( GLcontext *ctx, } -static void dtr( struct gl_pipeline_stage *stage ) +static void dtr( struct tnl_pipeline_stage *stage ) { (void)stage; } -const struct gl_pipeline_stage _radeon_render_stage = +const struct tnl_pipeline_stage _radeon_render_stage = { "radeon render", (_DD_NEW_SEPARATE_SPECULAR | @@ -729,7 +733,7 @@ struct texrect_stage_data { static GLboolean run_texrect_stage( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { struct texrect_stage_data *store = TEXRECT_STAGE_DATA(stage); radeonContextPtr rmesa = RADEON_CONTEXT(ctx); @@ -771,7 +775,7 @@ static GLboolean run_texrect_stage( GLcontext *ctx, /* Called the first time stage->run() is invoked. */ static GLboolean alloc_texrect_data( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct texrect_stage_data *store; @@ -793,7 +797,7 @@ static GLboolean alloc_texrect_data( GLcontext *ctx, static void check_texrect( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { GLuint flags = 0; @@ -809,7 +813,7 @@ static void check_texrect( GLcontext *ctx, } -static void free_texrect_data( struct gl_pipeline_stage *stage ) +static void free_texrect_data( struct tnl_pipeline_stage *stage ) { struct texrect_stage_data *store = TEXRECT_STAGE_DATA(stage); GLuint i; @@ -824,7 +828,7 @@ static void free_texrect_data( struct gl_pipeline_stage *stage ) } -const struct gl_pipeline_stage _radeon_texrect_stage = +const struct tnl_pipeline_stage _radeon_texrect_stage = { "radeon texrect stage", /* name */ _NEW_TEXTURE, /* check_state */ @@ -1193,7 +1197,7 @@ void radeonFallback( GLcontext *ctx, GLuint bit, GLboolean mode ) void radeonFlushVertices( GLcontext *ctx, GLuint flags ) { - _tnl_flush_vertices( ctx, flags ); + _tnl_FlushVertices( ctx, flags ); if (flags & FLUSH_STORED_VERTICES) RADEON_NEWPRIM( RADEON_CONTEXT( ctx ) ); @@ -1242,13 +1246,4 @@ void radeonDestroySwtcl( GLcontext *ctx ) rmesa->swtcl.verts = 0; } - if (rmesa->UbyteSecondaryColor.Ptr) { - ALIGN_FREE(rmesa->UbyteSecondaryColor.Ptr); - rmesa->UbyteSecondaryColor.Ptr = 0; - } - - if (rmesa->UbyteColor.Ptr) { - ALIGN_FREE(rmesa->UbyteColor.Ptr); - rmesa->UbyteColor.Ptr = 0; - } } diff --git a/src/mesa/drivers/dri/radeon/radeon_tcl.c b/src/mesa/drivers/dri/radeon/radeon_tcl.c index 651194a8047..ffa09d15dac 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tcl.c +++ b/src/mesa/drivers/dri/radeon/radeon_tcl.c @@ -277,7 +277,7 @@ void radeonTclPrimitive( GLcontext *ctx, /* TCL render. */ static GLboolean radeon_run_tcl_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -297,24 +297,19 @@ static GLboolean radeon_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 (RADEON_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) - radeonEmitEltPrimitive( ctx, i, i+length, flags ); + radeonEmitEltPrimitive( ctx, start, start+length, prim ); else - radeonEmitPrimitive( ctx, i, i+length, flags ); + radeonEmitPrimitive( ctx, start, start+length, prim ); } return GL_FALSE; /* finished the pipe */ @@ -323,7 +318,7 @@ static GLboolean radeon_run_tcl_render( GLcontext *ctx, static void radeon_check_tcl_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); GLuint inputs = VERT_BIT_POS; @@ -374,13 +369,13 @@ static void radeon_check_tcl_render( GLcontext *ctx, } static void radeon_init_tcl_render( GLcontext *ctx, - struct gl_pipeline_stage *stage ) + struct tnl_pipeline_stage *stage ) { stage->check = radeon_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; } @@ -388,7 +383,7 @@ static void dtr( struct gl_pipeline_stage *stage ) /* Initial state for tcl stage. */ -const struct gl_pipeline_stage _radeon_tcl_stage = +const struct tnl_pipeline_stage _radeon_tcl_stage = { "radeon render", (_DD_NEW_SEPARATE_SPECULAR | diff --git a/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c b/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c index 9af0942898d..4e27324807f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c +++ b/src/mesa/drivers/dri/radeon/radeon_vtxfmt.c @@ -973,13 +973,14 @@ void radeonVtxfmtInit( 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 = radeon_fallback_CallList; + vfmt->CallLists = radeon_fallback_CallLists; vfmt->EvalCoord1f = radeon_fallback_EvalCoord1f; vfmt->EvalCoord1fv = radeon_fallback_EvalCoord1fv; vfmt->EvalCoord2f = radeon_fallback_EvalCoord2f; diff --git a/src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c b/src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c index 04cffb77729..0bdb9a8bbd6 100644 --- a/src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c +++ b/src/mesa/drivers/dri/radeon/radeon_vtxfmt_c.c @@ -831,16 +831,10 @@ void radeonVtxfmtInitChoosers( 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; @@ -855,6 +849,15 @@ void radeonVtxfmtInitChoosers( GLvertexformat *vfmt ) vfmt->Vertex2fv = choose_Vertex2fv; vfmt->Vertex3f = choose_Vertex3f; vfmt->Vertex3fv = choose_Vertex3fv; + +#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 } -- cgit v1.2.3