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 <Mathias.Froehlich@web.de> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
@@ -393,6 +393,34 @@ _mesa_all_varyings_in_vbos(const struct gl_vertex_array_object *vao)
|
|||||||
return true;
|
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 */
|
/* API Functions */
|
||||||
|
@@ -85,6 +85,10 @@ _mesa_update_vao_client_arrays(struct gl_context *ctx,
|
|||||||
extern bool
|
extern bool
|
||||||
_mesa_all_varyings_in_vbos(const struct gl_vertex_array_object *vao);
|
_mesa_all_varyings_in_vbos(const struct gl_vertex_array_object *vao);
|
||||||
|
|
||||||
|
/* Returns true if all vbos are unmapped */
|
||||||
|
extern bool
|
||||||
|
_mesa_all_buffers_are_unmapped(const struct gl_vertex_array_object *vao);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* API functions
|
* API functions
|
||||||
*/
|
*/
|
||||||
|
@@ -42,40 +42,6 @@
|
|||||||
#include "vbo_context.h"
|
#include "vbo_context.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* All vertex buffers should be in an unmapped state when we're about
|
|
||||||
* to draw.
|
|
||||||
*/
|
|
||||||
static bool
|
|
||||||
check_input_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) {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that element 'j' of the array has reasonable data.
|
* Check that element 'j' of the array has reasonable data.
|
||||||
* Map VBO if needed.
|
* Map VBO if needed.
|
||||||
@@ -430,7 +396,7 @@ vbo_bind_arrays(struct gl_context *ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!check_input_buffers_are_unmapped(ctx->Array.VAO)) {
|
if (!_mesa_all_buffers_are_unmapped(ctx->Array.VAO)) {
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||||
"draw call (vertex buffers are mapped)");
|
"draw call (vertex buffers are mapped)");
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user