vbo: lift common code out of switch cases

Both switch cases began with the same code.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
This commit is contained in:
Brian Paul 2018-01-15 14:34:53 -07:00
parent 8e4efdc895
commit 5d78440d58
2 changed files with 12 additions and 18 deletions

View file

@ -180,14 +180,14 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
GLbitfield varying_inputs = 0x0;
bool swap_pos = false;
/* Install the default (ie Current) attributes first, then overlay
* all active ones.
*/
/* 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_program_mode(exec->ctx)) {
case VP_NONE:
for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) {
exec->vtx.inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr];
}
for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) {
assert(VERT_ATTRIB_GENERIC(attr) < ARRAY_SIZE(exec->vtx.inputs));
exec->vtx.inputs[VERT_ATTRIB_GENERIC(attr)] =
@ -196,9 +196,6 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
map = vbo->map_vp_none;
break;
case VP_ARB:
for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) {
exec->vtx.inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr];
}
for (attr = 0; attr < VERT_ATTRIB_GENERIC_MAX; attr++) {
assert(VERT_ATTRIB_GENERIC(attr) < ARRAY_SIZE(exec->vtx.inputs));
exec->vtx.inputs[VERT_ATTRIB_GENERIC(attr)] =

View file

@ -158,14 +158,14 @@ bind_vertex_list(struct gl_context *ctx,
buffer_offset = 0;
}
/* Install the default (ie Current) attributes first, then overlay
* all active ones.
*/
/* Install the default (ie Current) attributes first */
for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) {
save->inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr];
}
/* Overlay other active attributes */
switch (get_program_mode(ctx)) {
case VP_NONE:
for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) {
save->inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr];
}
for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) {
save->inputs[VERT_ATTRIB_GENERIC(attr)] =
&vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT+attr];
@ -173,9 +173,6 @@ bind_vertex_list(struct gl_context *ctx,
map = vbo->map_vp_none;
break;
case VP_ARB:
for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) {
save->inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr];
}
for (attr = 0; attr < VERT_ATTRIB_GENERIC_MAX; attr++) {
save->inputs[VERT_ATTRIB_GENERIC(attr)] =
&vbo->currval[VBO_ATTRIB_GENERIC0+attr];