summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/nouveau/nv10_swtcl.c
diff options
context:
space:
mode:
authorPatrice Mandin <pmandin@caramail.com>2007-09-05 23:35:52 +0200
committerPatrice Mandin <pmandin@caramail.com>2007-09-05 23:37:18 +0200
commitdb9f97e2aeeee31f8a015b3f5f4fa80d9c0bfd2e (patch)
tree13298926d0d83ff477bcb9a0b1d051b5940f150b /src/mesa/drivers/dri/nouveau/nv10_swtcl.c
parent9ceff4ac4c1e0179ee5c0f5a1e5ffe8306068571 (diff)
nouveau: nv10: emit vertex data in proper order for nv1x hw
Diffstat (limited to 'src/mesa/drivers/dri/nouveau/nv10_swtcl.c')
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_swtcl.c78
1 files 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 e31faf21a7..be351df8f6 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];
}
}