summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo/vbo_exec_draw.c
diff options
context:
space:
mode:
authorMathias Fröhlich <[email protected]>2018-11-17 07:13:11 +0100
committerMathias Fröhlich <[email protected]>2018-11-21 06:27:19 +0100
commit1b743e29666fde9ddc38c447118ecdcc38989eb5 (patch)
treeacb145985d7c1c49cd5179e26d6f4669693f1b77 /src/mesa/vbo/vbo_exec_draw.c
parent3c46fa59888cf5c8ca36be849512b2ef0492760d (diff)
mesa: Work with bitmasks when en/dis-abling VAO arrays.
For enabling or disabling VAO arrays it is now possible to change a set of arrays with a single call without the need to iterate the attributes. Make use of this technique in the vao module. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
Diffstat (limited to 'src/mesa/vbo/vbo_exec_draw.c')
-rw-r--r--src/mesa/vbo/vbo_exec_draw.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index db95dbbc34e..87652d659d0 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -191,11 +191,7 @@ vbo_exec_bind_arrays(struct gl_context *ctx)
GLbitfield vao_enabled = _vbo_get_vao_enabled_from_vbo(mode, exec->vtx.enabled);
/* At first disable arrays no longer needed */
- GLbitfield mask = vao->Enabled & ~vao_enabled;
- while (mask) {
- const int vao_attr = u_bit_scan(&mask);
- _mesa_disable_vertex_array_attrib(ctx, vao, vao_attr);
- }
+ _mesa_disable_vertex_array_attribs(ctx, vao, VERT_BIT_ALL & ~vao_enabled);
assert((~vao_enabled & vao->Enabled) == 0);
/* Bind the buffer object */
@@ -208,7 +204,7 @@ vbo_exec_bind_arrays(struct gl_context *ctx)
*/
const GLubyte *const vao_to_vbo_map = _vbo_attribute_alias_map[mode];
/* Now set the enabled arrays */
- mask = vao_enabled;
+ GLbitfield mask = vao_enabled;
while (mask) {
const int vao_attr = u_bit_scan(&mask);
const GLubyte vbo_attr = vao_to_vbo_map[vao_attr];
@@ -222,12 +218,11 @@ vbo_exec_bind_arrays(struct gl_context *ctx)
/* Set and enable */
_vbo_set_attrib_format(ctx, vao, vao_attr, buffer_offset,
size, type, offset);
- if ((vao->Enabled & VERT_BIT(vao_attr)) == 0)
- _mesa_enable_vertex_array_attrib(ctx, vao, vao_attr);
/* The vao is initially created with all bindings set to 0. */
assert(vao->VertexAttrib[vao_attr].BufferBindingIndex == 0);
}
+ _mesa_enable_vertex_array_attribs(ctx, vao, vao_enabled);
assert(vao_enabled == vao->Enabled);
assert(!_mesa_is_bufferobj(exec->vtx.bufferobj) ||
(vao_enabled & ~vao->VertexAttribBufferMask) == 0);