From 0ea45b1ad822ebdce2af3faef77ed776ca32d46b Mon Sep 17 00:00:00 2001 From: Stephane Marchesin Date: Tue, 21 Nov 2006 12:43:16 +0000 Subject: Add the state caching mechanism. It seems to work, from what I can see. --- src/mesa/drivers/dri/nouveau/nv10_swtcl.c | 53 ++++++++++++++++--------------- 1 file changed, 28 insertions(+), 25 deletions(-) (limited to 'src/mesa/drivers/dri/nouveau/nv10_swtcl.c') diff --git a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c index 832ce4ad21..198e3a2668 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c +++ b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c @@ -61,6 +61,7 @@ static void nv10ResetLineStipple( GLcontext *ctx ); static inline void nv10StartPrimitive(struct nouveau_context* nmesa,uint32_t primitive,uint32_t size) { + // FIXME the primitive type can probably go trough the caching system as well if (nmesa->screen->card->type==NV_10) BEGIN_RING_SIZE(NvSub3D,NV10_TCL_PRIMITIVE_3D_BEGIN_END,1); else if (nmesa->screen->card->type==NV_20) @@ -79,6 +80,7 @@ static inline void nv10StartPrimitive(struct nouveau_context* nmesa,uint32_t pri inline void nv10FinishPrimitive(struct nouveau_context *nmesa) { + // FIXME this is probably not needed if (nmesa->screen->card->type==NV_10) BEGIN_RING_SIZE(NvSub3D,NV10_TCL_PRIMITIVE_3D_BEGIN_END,1); else if (nmesa->screen->card->type==NV_20) @@ -216,23 +218,6 @@ static void nv10_render_noop_verts(GLcontext *ctx,GLuint start,GLuint count,GLui { } -static inline void nv10_render_generic_primitive_elts(GLcontext *ctx,GLuint start,GLuint count,GLuint flags,GLuint prim) -{ - struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); - GLubyte *vertptr = (GLubyte *)nmesa->verts; - GLuint vertsize = nmesa->vertex_size; - GLuint size_dword = vertsize*(count-start); - const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; - GLuint j; - - nv10ExtendPrimitive(nmesa, size_dword); - nv10StartPrimitive(nmesa,prim+1,size_dword); - for (j=start; jverts; + GLuint vertsize = nmesa->vertex_size; + GLuint size_dword = vertsize*(count-start); + const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; + GLuint j; + + nv10ExtendPrimitive(nmesa, size_dword); + nv10StartPrimitive(nmesa,prim+1,size_dword); + for (j=start; jscreen->card->type==NV_20) { for(i=0;i<16;i++) { int size=attr_size[i]; - BEGIN_RING_SIZE(NvSub3D,NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR(i),1); - OUT_RING(NV_VERTEX_ATTRIBUTE_TYPE_FLOAT|(size*0x10)); + BEGIN_RING_CACHE(NvSub3D,NV20_TCL_PRIMITIVE_3D_VERTEX_ATTR(i),1); + OUT_RING_CACHE(NV_VERTEX_ATTRIBUTE_TYPE_FLOAT|(size*0x10)); } } else { - BEGIN_RING_SIZE(NvSub3D,NV30_TCL_PRIMITIVE_3D_VERTEX_ATTR0_POS,slots); + BEGIN_RING_CACHE(NvSub3D,NV30_TCL_PRIMITIVE_3D_VERTEX_ATTR0_POS,slots); for(i=0;i