summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texobj.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2015-10-03 07:55:32 -0600
committerBrian Paul <brianp@vmware.com>2015-10-08 13:53:33 -0600
commitb373c776933c4d2d00947d92d595368f6d36bc96 (patch)
tree7d91f01d99aeff2f65bf7e80d3a9fac38d00247d /src/mesa/main/texobj.c
parentc71f0d45e6d0081ea814fb0b16baec4e75a07bcb (diff)
downloadexternal_mesa3d-b373c776933c4d2d00947d92d595368f6d36bc96.zip
external_mesa3d-b373c776933c4d2d00947d92d595368f6d36bc96.tar.gz
external_mesa3d-b373c776933c4d2d00947d92d595368f6d36bc96.tar.bz2
mesa: remove unneeded error check in create_textures()
Callers of create_texture() will either pass target=0 or a validated GL texture target enum so no need to do another error check inside the loop. Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com> Tested-by: Mark Janes <mark.a.janes@intel.com>
Diffstat (limited to 'src/mesa/main/texobj.c')
-rw-r--r--src/mesa/main/texobj.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 173e43c..aa4b38c 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1211,6 +1211,7 @@ _mesa_create_nameless_texture(struct gl_context *ctx, GLenum target)
* glCreateTextures should throw errors if target = 0. This is not exposed to
* the rest of Mesa to encourage Mesa internals to use nameless textures,
* which do not require expensive hash lookups.
+ * \param target either 0 or a a valid / error-checked texture target enum
*/
static void
create_textures(struct gl_context *ctx, GLenum target,
@@ -1219,6 +1220,7 @@ create_textures(struct gl_context *ctx, GLenum target,
GLuint first;
GLint i;
const char *func = dsa ? "Create" : "Gen";
+ const GLint targetIndex = _mesa_tex_target_to_index(ctx, target);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
_mesa_debug(ctx, "gl%sTextures %d\n", func, n);
@@ -1241,7 +1243,6 @@ create_textures(struct gl_context *ctx, GLenum target,
/* Allocate new, empty texture objects */
for (i = 0; i < n; i++) {
struct gl_texture_object *texObj;
- GLint targetIndex;
GLuint name = first + i;
texObj = ctx->Driver.NewTextureObject(ctx, name, target);
if (!texObj) {
@@ -1252,14 +1253,6 @@ create_textures(struct gl_context *ctx, GLenum target,
/* Initialize the target index if target is non-zero. */
if (target != 0) {
- targetIndex = _mesa_tex_target_to_index(ctx, texObj->Target);
- if (targetIndex < 0) { /* Bad Target */
- mtx_unlock(&ctx->Shared->Mutex);
- _mesa_error(ctx, GL_INVALID_ENUM, "gl%sTextures(target = %s)",
- func, _mesa_enum_to_string(texObj->Target));
- return;
- }
- assert(targetIndex < NUM_TEXTURE_TARGETS);
texObj->TargetIndex = targetIndex;
}