summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/nouveau
diff options
context:
space:
mode:
authorMathias Fröhlich <[email protected]>2018-01-27 16:07:22 +0100
committerMathias Fröhlich <[email protected]>2018-02-01 22:39:06 +0100
commit38b41fd718cfffd11dab637d9d0cbd6c2a30b2c2 (patch)
tree24910d5640ca92b20285f40cda11279fca976468 /src/mesa/drivers/dri/nouveau
parentf37e29ac224887f1b4f0cb7c61e47fb4bc6671e1 (diff)
mesa: Use defines for the aliased material array attributes.
Instead of just assuming that the material attributes just overlap with the generic attributes 0-12, give them symbolic defines so that we can easier move them to an other range. Signed-off-by: Mathias Fröhlich <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/nouveau')
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_render_t.c2
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c8
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_render.c10
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_render.c20
4 files changed, 20 insertions, 20 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_render_t.c b/src/mesa/drivers/dri/nouveau/nouveau_render_t.c
index db60b59c8fc..5699f38f4dc 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_render_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_render_t.c
@@ -188,7 +188,7 @@ static void
TAG(emit_material)(struct gl_context *ctx, struct nouveau_array *a,
const void *v)
{
- int attr = a->attr - VERT_ATTRIB_GENERIC0;
+ int attr = a->attr - VERT_ATTRIB_MAT(0);
int state = ((int []) {
NOUVEAU_STATE_MATERIAL_FRONT_AMBIENT,
NOUVEAU_STATE_MATERIAL_BACK_AMBIENT,
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index fdd135c5d7d..b9145e6851a 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -118,8 +118,8 @@ vbo_choose_render_mode(struct gl_context *ctx, const struct gl_vertex_array **ar
render->mode = VBO;
if (ctx->Light.Enabled) {
- for (i = 0; i < MAT_ATTRIB_MAX; i++) {
- if (arrays[VERT_ATTRIB_GENERIC0 + i]->StrideB) {
+ for (i = 0; i < VERT_ATTRIB_MAT_MAX; i++) {
+ if (arrays[VERT_ATTRIB_MAT(i)]->StrideB) {
render->mode = IMM;
break;
}
@@ -138,7 +138,7 @@ vbo_emit_attr(struct gl_context *ctx, const struct gl_vertex_array **arrays,
RENDER_LOCALS(ctx);
if (!array->StrideB) {
- if (attr >= VERT_ATTRIB_GENERIC0)
+ if (attr >= VERT_ATTRIB_MAT(0))
/* nouveau_update_state takes care of materials. */
return;
@@ -165,7 +165,7 @@ vbo_emit_attr(struct gl_context *ctx, const struct gl_vertex_array **arrays,
}
}
-#define MAT(a) (VERT_ATTRIB_GENERIC0 + MAT_ATTRIB_##a)
+#define MAT(a) VERT_ATTRIB_MAT(MAT_ATTRIB_##a)
static void
vbo_choose_attrs(struct gl_context *ctx, const struct gl_vertex_array **arrays)
diff --git a/src/mesa/drivers/dri/nouveau/nv10_render.c b/src/mesa/drivers/dri/nouveau/nv10_render.c
index 701ba9a87a8..9b2cf229f85 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_render.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_render.c
@@ -72,19 +72,19 @@ static struct nouveau_attr_info nv10_vertex_attrs[VERT_ATTRIB_MAX] = {
.imm_method = NV10_3D_VERTEX_FOG_1F,
.imm_fields = 1,
},
- [VERT_ATTRIB_GENERIC0] = {
+ [VERT_ATTRIB_MAT(0)] = {
.emit = nv10_emit_material,
},
- [VERT_ATTRIB_GENERIC2] = {
+ [VERT_ATTRIB_MAT(2)] = {
.emit = nv10_emit_material,
},
- [VERT_ATTRIB_GENERIC4] = {
+ [VERT_ATTRIB_MAT(4)] = {
.emit = nv10_emit_material,
},
- [VERT_ATTRIB_GENERIC6] = {
+ [VERT_ATTRIB_MAT(6)] = {
.emit = nv10_emit_material,
},
- [VERT_ATTRIB_GENERIC8] = {
+ [VERT_ATTRIB_MAT(8)] = {
.emit = nv10_emit_material,
},
};
diff --git a/src/mesa/drivers/dri/nouveau/nv20_render.c b/src/mesa/drivers/dri/nouveau/nv20_render.c
index 2627bfa354f..9a426ccec07 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_render.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_render.c
@@ -82,34 +82,34 @@ static struct nouveau_attr_info nv20_vertex_attrs[VERT_ATTRIB_MAX] = {
.imm_method = NV20_3D_VERTEX_TX3_4F_S,
.imm_fields = 4,
},
- [VERT_ATTRIB_GENERIC0] = {
+ [VERT_ATTRIB_MAT(0)] = {
.emit = nv20_emit_material,
},
- [VERT_ATTRIB_GENERIC1] = {
+ [VERT_ATTRIB_MAT(1)] = {
.emit = nv20_emit_material,
},
- [VERT_ATTRIB_GENERIC2] = {
+ [VERT_ATTRIB_MAT(2)] = {
.emit = nv20_emit_material,
},
- [VERT_ATTRIB_GENERIC3] = {
+ [VERT_ATTRIB_MAT(3)] = {
.emit = nv20_emit_material,
},
- [VERT_ATTRIB_GENERIC4] = {
+ [VERT_ATTRIB_MAT(4)] = {
.emit = nv20_emit_material,
},
- [VERT_ATTRIB_GENERIC5] = {
+ [VERT_ATTRIB_MAT(5)] = {
.emit = nv20_emit_material,
},
- [VERT_ATTRIB_GENERIC6] = {
+ [VERT_ATTRIB_MAT(6)] = {
.emit = nv20_emit_material,
},
- [VERT_ATTRIB_GENERIC7] = {
+ [VERT_ATTRIB_MAT(7)] = {
.emit = nv20_emit_material,
},
- [VERT_ATTRIB_GENERIC8] = {
+ [VERT_ATTRIB_MAT(8)] = {
.emit = nv20_emit_material,
},
- [VERT_ATTRIB_GENERIC9] = {
+ [VERT_ATTRIB_MAT(9)] = {
.emit = nv20_emit_material,
},
};