mesa: add delete_vertex_arrays() helper
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
@@ -466,17 +466,11 @@ _mesa_BindVertexArray(GLuint id)
|
|||||||
* \param n Number of array objects to delete.
|
* \param n Number of array objects to delete.
|
||||||
* \param ids Array of \c n array object IDs.
|
* \param ids Array of \c n array object IDs.
|
||||||
*/
|
*/
|
||||||
void GLAPIENTRY
|
static void
|
||||||
_mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids)
|
delete_vertex_arrays(struct gl_context *ctx, GLsizei n, const GLuint *ids)
|
||||||
{
|
{
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
|
||||||
GLsizei i;
|
GLsizei i;
|
||||||
|
|
||||||
if (n < 0) {
|
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glDeleteVertexArray(n)");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
struct gl_vertex_array_object *obj = _mesa_lookup_vao(ctx, ids[i]);
|
struct gl_vertex_array_object *obj = _mesa_lookup_vao(ctx, ids[i]);
|
||||||
|
|
||||||
@@ -488,7 +482,7 @@ _mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids)
|
|||||||
* becomes current."
|
* becomes current."
|
||||||
*/
|
*/
|
||||||
if (obj == ctx->Array.VAO)
|
if (obj == ctx->Array.VAO)
|
||||||
_mesa_BindVertexArray(0);
|
_mesa_BindVertexArray_no_error(0);
|
||||||
|
|
||||||
/* The ID is immediately freed for re-use */
|
/* The ID is immediately freed for re-use */
|
||||||
_mesa_HashRemoveLocked(ctx->Array.Objects, obj->Name);
|
_mesa_HashRemoveLocked(ctx->Array.Objects, obj->Name);
|
||||||
@@ -505,6 +499,20 @@ _mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GLAPIENTRY
|
||||||
|
_mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids)
|
||||||
|
{
|
||||||
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
|
||||||
|
if (n < 0) {
|
||||||
|
_mesa_error(ctx, GL_INVALID_VALUE, "glDeleteVertexArray(n)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete_vertex_arrays(ctx, n, ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a set of unique array object IDs and store them in \c arrays.
|
* Generate a set of unique array object IDs and store them in \c arrays.
|
||||||
* Helper for _mesa_GenVertexArrays() and _mesa_CreateVertexArrays()
|
* Helper for _mesa_GenVertexArrays() and _mesa_CreateVertexArrays()
|
||||||
|
Reference in New Issue
Block a user