summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo/vbo_exec_draw.c
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:07 +0100
commit3d4fb879ddbce1c5da7199ae74bc2e7ae98d1b70 (patch)
tree886e65a3a68bfd422e067e92caff2b4351d20134 /src/mesa/vbo/vbo_exec_draw.c
parentb4fd63015ac7fd73e0147ff078caec47be729e87 (diff)
vbo: Use static const VERT_ATTRIB->VBO_ATTRIB maps.
Instead of each context having its own map instance for this purpose, use a global static const map. v2: s,unsigned char,GLubyte,g s,_VP_MODE_MAX,VP_MODE_MAX,g Change comment style. Signed-off-by: Mathias Fröhlich <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/vbo/vbo_exec_draw.c')
-rw-r--r--src/mesa/vbo/vbo_exec_draw.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index bd82825b517..e3e050595c1 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -174,18 +174,20 @@ vbo_exec_bind_arrays(struct gl_context *ctx)
struct vbo_context *vbo = vbo_context(ctx);
struct vbo_exec_context *exec = &vbo->exec;
struct gl_vertex_array *arrays = exec->vtx.arrays;
- const GLubyte *map;
GLuint attr;
GLbitfield varying_inputs = 0x0;
bool swap_pos = false;
+ const enum vp_mode program_mode = get_vp_mode(exec->ctx);
+ const GLubyte * const map = _vbo_attribute_alias_map[program_mode];
+
/* Install the default (ie Current) attributes first */
for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) {
exec->vtx.inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr];
}
/* Overlay other active attributes */
- switch (get_vp_mode(exec->ctx)) {
+ switch (program_mode) {
case VP_FF:
for (attr = 0; attr < VERT_ATTRIB_MAT0; attr++) {
assert(VERT_ATTRIB_GENERIC(attr) < ARRAY_SIZE(exec->vtx.inputs));
@@ -197,7 +199,6 @@ vbo_exec_bind_arrays(struct gl_context *ctx)
exec->vtx.inputs[VERT_ATTRIB_MAT(attr)] =
&vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT+attr];
}
- map = vbo->map_vp_none;
break;
case VP_SHADER:
for (attr = 0; attr < VERT_ATTRIB_GENERIC_MAX; attr++) {
@@ -205,7 +206,6 @@ vbo_exec_bind_arrays(struct gl_context *ctx)
exec->vtx.inputs[VERT_ATTRIB_GENERIC(attr)] =
&vbo->currval[VBO_ATTRIB_GENERIC0+attr];
}
- map = vbo->map_vp_arb;
/* check if VERT_ATTRIB_POS is not read but VERT_BIT_GENERIC0 is read.
* In that case we effectively need to route the data from