On 05/26/2017 01:38 AM, Ian Romanick wrote:
On 05/23/2017 03:41 AM, 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)

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;
-

Removing this is going to hurt performance in the (common) case that
isn't using no_error.

There is a v2 for this patch, look for "mesa: add KHR_no_error support for glActiveTexture()".


     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

Reply via email to