diff options
author | Brian Paul <brianp@vmware.com> | 2015-08-03 15:06:42 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2015-08-06 07:38:47 -0600 |
commit | 115964052b25a958b2ad4ec42ae07133b2768cf9 (patch) | |
tree | 5a68b50053060baf852b849f912b1b31073af9fc | |
parent | ee977183dcb543c919d0d70dde610cb191d5a3ea (diff) |
mesa: handle no-op cases sooner in _mesa_[Client]ActiveTexture()
If the new texture unit is the current texture unit, we can return
before error checking.
Reviewed-by: Eric Anholt <eric@anholt.net>
-rw-r--r-- | src/mesa/main/texstate.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 1e75e0a2ff1d..9b5928c4306d 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -289,23 +289,23 @@ _mesa_ActiveTexture(GLenum texture) GLuint k; GET_CURRENT_CONTEXT(ctx); - k = _mesa_max_tex_unit(ctx); - - assert(k <= ARRAY_SIZE(ctx->Texture.Unit)); - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glActiveTexture %s\n", _mesa_enum_to_string(texture)); + if (ctx->Texture.CurrentUnit == texUnit) + return; + + k = _mesa_max_tex_unit(ctx); + + assert(k <= ARRAY_SIZE(ctx->Texture.Unit)); + if (texUnit >= k) { _mesa_error(ctx, GL_INVALID_ENUM, "glActiveTexture(texture=%s)", _mesa_enum_to_string(texture)); return; } - if (ctx->Texture.CurrentUnit == texUnit) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); ctx->Texture.CurrentUnit = texUnit; @@ -327,14 +327,14 @@ _mesa_ClientActiveTexture(GLenum texture) _mesa_debug(ctx, "glClientActiveTexture %s\n", _mesa_enum_to_string(texture)); + if (ctx->Array.ActiveTexture == texUnit) + return; + if (texUnit >= ctx->Const.MaxTextureCoordUnits) { _mesa_error(ctx, GL_INVALID_ENUM, "glClientActiveTexture(texture)"); return; } - if (ctx->Array.ActiveTexture == texUnit) - return; - FLUSH_VERTICES(ctx, _NEW_ARRAY); ctx->Array.ActiveTexture = texUnit; } |