diff options
author | Mathias Fröhlich <[email protected]> | 2018-01-27 16:07:22 +0100 |
---|---|---|
committer | Mathias Fröhlich <[email protected]> | 2018-02-01 22:39:06 +0100 |
commit | 38b41fd718cfffd11dab637d9d0cbd6c2a30b2c2 (patch) | |
tree | 24910d5640ca92b20285f40cda11279fca976468 /src/mesa/vbo | |
parent | f37e29ac224887f1b4f0cb7c61e47fb4bc6671e1 (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/vbo')
-rw-r--r-- | src/mesa/vbo/vbo_context.c | 4 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_array.c | 10 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_draw.c | 10 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save_draw.c | 9 |
4 files changed, 20 insertions, 13 deletions
diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index 3f55e27f9be..4fa6f62ad09 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -249,8 +249,8 @@ _vbo_CreateContext(struct gl_context *ctx) for (i = 0; i < ARRAY_SIZE(vbo->map_vp_none); i++) vbo->map_vp_none[i] = i; /* map material attribs to generic slots */ - for (i = 0; i < MAT_ATTRIB_MAX; i++) - vbo->map_vp_none[VERT_ATTRIB_GENERIC(i)] + for (i = 0; i < VERT_ATTRIB_MAT_MAX; i++) + vbo->map_vp_none[VERT_ATTRIB_MAT(i)] = VBO_ATTRIB_MAT_FRONT_AMBIENT + i; for (i = 0; i < ARRAY_SIZE(vbo->map_vp_arb); i++) diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index fc0d4890655..d1f4da0c0e7 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -331,20 +331,20 @@ recalculate_input_bindings(struct gl_context *ctx) inputs[i] = &vertexAttrib[VERT_ATTRIB_FF(i)]; else { inputs[i] = &vbo->currval[VBO_ATTRIB_POS + i]; - const_inputs |= VERT_BIT(i); + const_inputs |= VERT_BIT_FF(i); } } - for (i = 0; i < MAT_ATTRIB_MAX; i++) { - inputs[VERT_ATTRIB_GENERIC(i)] = + for (i = 0; i < VERT_ATTRIB_MAT_MAX; i++) { + inputs[VERT_ATTRIB_MAT(i)] = &vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT + i]; - const_inputs |= VERT_BIT_GENERIC(i); + const_inputs |= VERT_BIT_MAT(i); } /* Could use just about anything, just to fill in the empty * slots: */ - for (i = MAT_ATTRIB_MAX; i < VERT_ATTRIB_GENERIC_MAX; i++) { + for (i = VERT_ATTRIB_MAT_MAX; i < VERT_ATTRIB_GENERIC_MAX; i++) { inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->currval[VBO_ATTRIB_GENERIC0 + i]; const_inputs |= VERT_BIT_GENERIC(i); diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 5cea7fe8793..2b7784694f7 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -187,11 +187,15 @@ vbo_exec_bind_arrays(struct gl_context *ctx) /* Overlay other active attributes */ switch (get_vp_mode(exec->ctx)) { case VP_FF: - /* Point the generic attributes at the legacy material values */ - for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) { + for (attr = 0; attr < VERT_ATTRIB_MAT_MAX; attr++) { + assert(VERT_ATTRIB_MAT(attr) < ARRAY_SIZE(exec->vtx.inputs)); + exec->vtx.inputs[VERT_ATTRIB_MAT(attr)] = + &vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT+attr]; + } + for (attr = VERT_ATTRIB_MAT_MAX; attr < VERT_ATTRIB_GENERIC_MAX; attr++) { assert(VERT_ATTRIB_GENERIC(attr) < ARRAY_SIZE(exec->vtx.inputs)); exec->vtx.inputs[VERT_ATTRIB_GENERIC(attr)] = - &vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT+attr]; + &vbo->currval[VBO_ATTRIB_GENERIC0+attr]; } map = vbo->map_vp_none; break; diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index 486247f7441..bbc2d0dfedf 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -151,11 +151,14 @@ bind_vertex_list(struct gl_context *ctx, /* Overlay other active attributes */ switch (get_vp_mode(ctx)) { case VP_FF: - /* Point the generic attributes at the legacy material values */ - for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) { - save->inputs[VERT_ATTRIB_GENERIC(attr)] = + for (attr = 0; attr < VERT_ATTRIB_MAT_MAX; attr++) { + save->inputs[VERT_ATTRIB_MAT(attr)] = &vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT+attr]; } + for (attr = VERT_ATTRIB_MAT_MAX; attr < VERT_ATTRIB_GENERIC_MAX; attr++) { + save->inputs[VERT_ATTRIB_GENERIC(attr)] = + &vbo->currval[VBO_ATTRIB_GENERIC0+attr]; + } map = vbo->map_vp_none; break; case VP_SHADER: |