[Mesa-dev] [PATCH 1/2] mesa: add active_texture() helper
Samuel Pitoiset
samuel.pitoiset at gmail.com
Tue May 23 10:41:31 UTC 2017
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at 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;
-
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);
}
--
2.13.0
More information about the mesa-dev
mailing list