On 23/05/17 20:41, Samuel Pitoiset wrote:
Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
---
src/mesa/main/texstate.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 1aac3cdbd8b..32d5c0b7f7c 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -279,6 +279,19 @@ calculate_derived_texenv( struct gl_tex_env_combine_state
*state,
}
+static void active_texture(struct gl_context *ctx, const GLuint texUnit)
+{
+ if (ctx->Texture.CurrentUnit == texUnit)
+ return;
+
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
+
+ ctx->Texture.CurrentUnit = texUnit;
+ if (ctx->Transform.MatrixMode == GL_TEXTURE) {
+ /* update current stack pointer */
+ ctx->CurrentStack = &ctx->TextureMatrixStack[texUnit];
+ }
+}
/* GL_ARB_multitexture */
@@ -293,9 +306,6 @@ _mesa_ActiveTexture(GLenum texture)
_mesa_debug(ctx, "glActiveTexture %s\n",
_mesa_enum_to_string(texture));
- if (ctx->Texture.CurrentUnit == texUnit)
- return;
Its not a big deal but it would be nice if we could leave this where it is.
Since _mesa_ActiveTexture is small maybe we could just move the entire
thing to a helper and use the ALWAYS_INLINE pattern used elsewhere.
Thoughts?
-
k = _mesa_max_tex_unit(ctx);
assert(k <= ARRAY_SIZE(ctx->Texture.Unit));
@@ -306,13 +316,7 @@ _mesa_ActiveTexture(GLenum texture)
return;
}
- FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
-
- ctx->Texture.CurrentUnit = texUnit;
- if (ctx->Transform.MatrixMode == GL_TEXTURE) {
- /* update current stack pointer */
- ctx->CurrentStack = &ctx->TextureMatrixStack[texUnit];
- }
+ active_texture(ctx, texUnit);
}
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev