diff options
author | Samuel Pitoiset <[email protected]> | 2017-07-19 11:55:05 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-07-31 13:53:39 +0200 |
commit | 488af1292ac4834fbd372ef45c87cb7fbc2b381c (patch) | |
tree | 809fea6a98591e564610877e53279e07903f1685 /src/mesa/main | |
parent | 8bf786d13d4e6b985aa0a2ef017ba6f5fc82c366 (diff) |
mesa: add delete_textures() helper
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/texobj.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index b698569509f..494ea25f803 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1447,26 +1447,15 @@ unbind_textures_from_unit(struct gl_context *ctx, GLuint unit) * Recall that texture objects can be shared among several rendering * contexts. */ -void GLAPIENTRY -_mesa_DeleteTextures( GLsizei n, const GLuint *textures) +static void +delete_textures(struct gl_context *ctx, GLsizei n, const GLuint *textures) { - GET_CURRENT_CONTEXT(ctx); - GLint i; - - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "glDeleteTextures %d\n", n); - - if (n < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteTextures(n < 0)"); - return; - } - FLUSH_VERTICES(ctx, 0); /* too complex */ if (!textures) return; - for (i = 0; i < n; i++) { + for (GLsizei i = 0; i < n; i++) { if (textures[i] > 0) { struct gl_texture_object *delObj = _mesa_lookup_texture(ctx, textures[i]); @@ -1515,6 +1504,23 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures) } +void GLAPIENTRY +_mesa_DeleteTextures(GLsizei n, const GLuint *textures) +{ + GET_CURRENT_CONTEXT(ctx); + + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glDeleteTextures %d\n", n); + + if (n < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteTextures(n < 0)"); + return; + } + + delete_textures(ctx, n, textures); +} + + /** * Convert a GL texture target enum such as GL_TEXTURE_2D or GL_TEXTURE_3D * into the corresponding Mesa texture target index. |