diff options
author | Mathias Fröhlich <[email protected]> | 2016-08-14 14:03:58 +0200 |
---|---|---|
committer | Mathias Fröhlich <[email protected]> | 2016-08-15 07:10:39 +0200 |
commit | b7b0c51f1fd54c666e9520e1166e24216cc72211 (patch) | |
tree | 3c13b12f3272bf21e4de0341fd7428f151705227 /src/mesa/main/arrayobj.c | |
parent | c17cf1c8f5c4553780a9dba761e5e089ae3d3b01 (diff) |
mesa: Move _mesa_all_buffers_are_unmapped to arrayobj.c.
Move the function to check if all vao buffers are
unmapped into the vao implementation file.
Rename the function to _mesa_all_buffers_are_unmapped.
Signed-off-by: Mathias Fröhlich <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/main/arrayobj.c')
-rw-r--r-- | src/mesa/main/arrayobj.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index becf32f5cda..2d3b69cd8de 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -393,6 +393,34 @@ _mesa_all_varyings_in_vbos(const struct gl_vertex_array_object *vao) return true; } +bool +_mesa_all_buffers_are_unmapped(const struct gl_vertex_array_object *vao) +{ + /* Walk the enabled arrays that have a vbo attached */ + GLbitfield64 mask = vao->_Enabled & vao->VertexAttribBufferMask; + + while (mask) { + const 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; +} /**********************************************************************/ /* API Functions */ |