diff options
author | Mathias Fröhlich <mathias.froehlich@web.de> | 2018-01-27 16:07:22 +0100 |
---|---|---|
committer | Mathias Fröhlich <Mathias.Froehlich@gmx.net> | 2018-02-01 22:39:08 +0100 |
commit | 5b3d58520f40d575adc83cbbcd1c1208932d16d1 (patch) | |
tree | c0b034efe431a0e0e74de303d3abc036360974d4 | |
parent | fb10a7b7b0da7b4965a60a9427bf295825bf78c8 (diff) |
vbo: Simplify input array distribution for dlist type draws.
Using the newly introduced VAO array maps, we can
simplify vbo_bind_vertex_list.
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
-rw-r--r-- | src/mesa/vbo/vbo_save_draw.c | 54 |
1 files changed, 8 insertions, 46 deletions
diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index ad45f4d050..96a9bab029 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -27,6 +27,7 @@ */ #include <stdbool.h> +#include "main/arrayobj.h" #include "main/glheader.h" #include "main/bufferobj.h" #include "main/context.h" @@ -140,54 +141,20 @@ bind_vertex_list(struct gl_context *ctx, struct gl_vertex_array *arrays = save->arrays; GLuint attr; GLbitfield varying_inputs = 0x0; - bool generic_from_pos = false; const enum vp_mode program_mode = get_vp_mode(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++) { - save->inputs[attr] = &vbo->currval[VBO_ATTRIB_POS + attr]; - } - - /* Overlay other active attributes */ - switch (program_mode) { - case VP_FF: - for (attr = 0; attr < VERT_ATTRIB_MAT0; attr++) { - save->inputs[VERT_ATTRIB_GENERIC(attr)] = - &vbo->currval[VBO_ATTRIB_GENERIC0+attr]; - } - for (attr = 0; attr < VERT_ATTRIB_MAT_MAX; attr++) { - save->inputs[VERT_ATTRIB_MAT(attr)] = - &vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT+attr]; - } - break; - case VP_SHADER: - for (attr = 0; attr < VERT_ATTRIB_GENERIC_MAX; attr++) { - save->inputs[VERT_ATTRIB_GENERIC(attr)] = - &vbo->currval[VBO_ATTRIB_GENERIC0+attr]; - } - - /* 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 - * glVertexAttrib(0, val) calls to feed into the GENERIC0 input. - */ - const GLbitfield64 inputs_read = - ctx->VertexProgram._Current->info.inputs_read; - if ((inputs_read & VERT_BIT_POS) == 0 && - (inputs_read & VERT_BIT_GENERIC0)) { - generic_from_pos = true; - } - break; - default: - unreachable("Bad vertex program mode"); - } - + /* Grab VERT_ATTRIB_{POS,GENERIC0} from VBO_ATTRIB_POS */ + const gl_attribute_map_mode mode = ATTRIBUTE_MAP_MODE_POSITION; + const GLubyte *const array_map = _mesa_vao_attribute_map[mode]; for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { - const GLuint src = map[attr]; + const GLuint src = map[array_map[attr]]; const GLubyte size = node->attrsz[src]; - if (size) { + if (size == 0) { + save->inputs[attr] = &vbo->currval[map[attr]]; + } else { struct gl_vertex_array *array = &arrays[attr]; const GLenum16 type = node->attrtype[src]; @@ -211,11 +178,6 @@ bind_vertex_list(struct gl_context *ctx, } } - if (generic_from_pos) { - varying_inputs |= (varying_inputs & VERT_BIT_POS) << VERT_ATTRIB_GENERIC0; - save->inputs[VERT_ATTRIB_GENERIC0] = save->inputs[VERT_ATTRIB_POS]; - } - _mesa_set_varying_vp_inputs(ctx, varying_inputs); ctx->NewDriverState |= ctx->DriverFlags.NewArray; } |