summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo/vbo_exec_array.c
diff options
context:
space:
mode:
authorMathias Fröhlich <mathias.froehlich@web.de>2016-06-17 08:09:05 +0200
committerMathias Fröhlich <mathias.froehlich@web.de>2016-07-31 10:05:45 +0200
commit144737a4988ebca0649c0d1d9ddba4a391757b86 (patch)
tree07e62f5244adec869696499c5d6dd39a4ab6036b /src/mesa/vbo/vbo_exec_array.c
parent3f5e5696feb10ec9c779c30a84ce9b367db081fd (diff)
downloadexternal_mesa3d-144737a4988ebca0649c0d1d9ddba4a391757b86.zip
external_mesa3d-144737a4988ebca0649c0d1d9ddba4a391757b86.tar.gz
external_mesa3d-144737a4988ebca0649c0d1d9ddba4a391757b86.tar.bz2
vbo: Walk the VAO to check for mapped buffers.
Similarily to _mesa_all_varyings_in_vbos walk the VAO to check if we have an illegal mapped buffer object instead of walking all gl_client_arrays. Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de> Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'src/mesa/vbo/vbo_exec_array.c')
-rw-r--r--src/mesa/vbo/vbo_exec_array.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index b75c772..2d5b0dc 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -47,16 +47,29 @@
* to draw.
*/
static bool
-check_input_buffers_are_unmapped(const struct gl_client_array **inputs)
+check_input_buffers_are_unmapped(const struct gl_vertex_array_object *vao)
{
- GLuint i;
-
- for (i = 0; i < VERT_ATTRIB_MAX; i++) {
- if (inputs[i]) {
- struct gl_buffer_object *obj = inputs[i]->BufferObj;
- if (_mesa_check_disallowed_mapping(obj))
- return false;
- }
+ /* Walk the enabled arrays that have a vbo attached */
+ GLbitfield64 mask = vao->_Enabled & vao->VertexAttribBufferMask;
+
+ while (mask) {
+ int i = ffsll(mask) - 1;
+ const struct gl_vertex_attrib_array *attrib_array =
+ &vao->VertexAttrib[i];
+ const struct gl_vertex_buffer_binding *buffer_binding =
+ &vao->VertexBinding[attrib_array->VertexBinding];
+
+ /* Only enabled arrays shall appear in the _Enabled bitmask */
+ assert(attrib_array->Enabled);
+ /* We have already masked with vao->VertexAttribBufferMask */
+ assert(_mesa_is_bufferobj(buffer_binding->BufferObj));
+
+ /* Bail out once we find the first disallowed mapping */
+ if (_mesa_check_disallowed_mapping(buffer_binding->BufferObj))
+ return false;
+
+ /* We have handled everything that is bound to this buffer_binding. */
+ mask &= ~buffer_binding->_BoundArrays;
}
return true;
@@ -75,7 +88,7 @@ check_buffers_are_unmapped(struct gl_context *ctx)
/* check the current vertex arrays */
return !_mesa_check_disallowed_mapping(exec->vtx.bufferobj) &&
- check_input_buffers_are_unmapped(exec->array.inputs);
+ check_input_buffers_are_unmapped(ctx->Array.VAO);
}