From db9f97e2aeeee31f8a015b3f5f4fa80d9c0bfd2e Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Wed, 5 Sep 2007 23:35:52 +0200 Subject: [PATCH] nouveau: nv10: emit vertex data in proper order for nv1x hw --- src/mesa/drivers/dri/nouveau/nv10_swtcl.c | 78 ++++++++++++++++------- 1 file changed, 56 insertions(+), 22 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c index e31faf21a78..be351df8f67 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c +++ b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c @@ -417,31 +417,65 @@ static inline void nv10OutputVertexFormat(struct nouveau_context* nmesa) /* * Tell t_vertex about the vertex format */ - for(i=0;i<16;i++) - { - if (RENDERINPUTS_TEST(index, i)) + if ((nmesa->screen->card->type>=NV_10) && (nmesa->screen->card->type<=NV_17)) { + +#define NV10_EMIT_VERTEX_ATTRIB(i) \ + do { \ + if (RENDERINPUTS_TEST(index, i)) { \ + switch(attr_size[i]) \ + { \ + case 1: \ + EMIT_ATTR(i,EMIT_1F); \ + break; \ + case 2: \ + EMIT_ATTR(i,EMIT_2F); \ + break; \ + case 3: \ + EMIT_ATTR(i,EMIT_3F); \ + break; \ + case 4: \ + EMIT_ATTR(i,EMIT_4F); \ + break; \ + } \ + total_size+=attr_size[i]; \ + } \ + } while (0) + + NV10_EMIT_VERTEX_ATTRIB(_TNL_ATTRIB_FOG); + NV10_EMIT_VERTEX_ATTRIB(_TNL_ATTRIB_WEIGHT); + NV10_EMIT_VERTEX_ATTRIB(_TNL_ATTRIB_NORMAL); + NV10_EMIT_VERTEX_ATTRIB(_TNL_ATTRIB_TEX1); + NV10_EMIT_VERTEX_ATTRIB(_TNL_ATTRIB_TEX0); + NV10_EMIT_VERTEX_ATTRIB(_TNL_ATTRIB_COLOR1); + NV10_EMIT_VERTEX_ATTRIB(_TNL_ATTRIB_COLOR0); + NV10_EMIT_VERTEX_ATTRIB(_TNL_ATTRIB_POS); + } else { + for(i=0;i<16;i++) { - slots=i+1; - switch(attr_size[i]) + if (RENDERINPUTS_TEST(index, i)) { - case 1: - EMIT_ATTR(i,EMIT_1F); - break; - case 2: - EMIT_ATTR(i,EMIT_2F); - break; - case 3: - EMIT_ATTR(i,EMIT_3F); - break; - case 4: - EMIT_ATTR(i,EMIT_4F); - break; + slots=i+1; + switch(attr_size[i]) + { + case 1: + EMIT_ATTR(i,EMIT_1F); + break; + case 2: + EMIT_ATTR(i,EMIT_2F); + break; + case 3: + EMIT_ATTR(i,EMIT_3F); + break; + case 4: + EMIT_ATTR(i,EMIT_4F); + break; + } + if (i==_TNL_ATTRIB_COLOR0) + nmesa->color_offset=total_size; + if (i==_TNL_ATTRIB_COLOR1) + nmesa->specular_offset=total_size; + total_size+=attr_size[i]; } - if (i==_TNL_ATTRIB_COLOR0) - nmesa->color_offset=total_size; - if (i==_TNL_ATTRIB_COLOR1) - nmesa->specular_offset=total_size; - total_size+=attr_size[i]; } } -- 2.30.2