[gtk/wip/chergert/glproto: 882/920] call glActiveTexture less when executing




commit 08b3d1804c443834d53bfc6dd58a24aecfd48f43
Author: Christian Hergert <chergert redhat com>
Date:   Wed Feb 3 00:18:50 2021 -0800

    call glActiveTexture less when executing

 gsk/next/gskglcommandqueue.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/gsk/next/gskglcommandqueue.c b/gsk/next/gskglcommandqueue.c
index 5180ffe602..c4d9aba60f 100644
--- a/gsk/next/gskglcommandqueue.c
+++ b/gsk/next/gskglcommandqueue.c
@@ -785,6 +785,7 @@ gsk_gl_command_queue_execute (GskGLCommandQueue    *self,
   guint n_fbos = 0;
   guint n_uniforms = 0;
   guint vbo_id;
+  int active = -1;
 
   g_assert (GSK_IS_GL_COMMAND_QUEUE (self));
   g_assert (self->in_draw == FALSE);
@@ -908,7 +909,12 @@ gsk_gl_command_queue_execute (GskGLCommandQueue    *self,
                   guint index = batch->draw.bind_offset + i;
                   GskGLCommandBind *bind = &g_array_index (self->batch_binds, GskGLCommandBind, index);
 
-                  glActiveTexture (GL_TEXTURE0 + bind->texture);
+                  if (active != bind->texture)
+                    {
+                      active = bind->texture;
+                      glActiveTexture (GL_TEXTURE0 + bind->texture);
+                    }
+
                   glBindTexture (GL_TEXTURE_2D, bind->id);
                 }
             }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]