[gtk/wip/chergert/glproto: 752/920] avoid save/restore of attachment state




commit eaec2a704fbd8bdf57c780167a3475986d686cac
Author: Christian Hergert <chergert redhat com>
Date:   Tue Jan 26 11:44:34 2021 -0800

    avoid save/restore of attachment state
    
    we don't really need to waste the allocation on this when we know the
    texture slot we modified.

 gsk/next/gskglcommandqueue.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gsk/next/gskglcommandqueue.c b/gsk/next/gskglcommandqueue.c
index 5edc473a98..4d31c9d2ed 100644
--- a/gsk/next/gskglcommandqueue.c
+++ b/gsk/next/gskglcommandqueue.c
@@ -991,7 +991,6 @@ gsk_gl_command_queue_create_texture (GskGLCommandQueue *self,
   if (width > self->max_texture_size || height > self->max_texture_size)
     return -1;
 
-  gsk_gl_command_queue_save (self);
   gsk_gl_command_queue_make_current (self);
 
   glGenTextures (1, &texture_id);
@@ -1009,7 +1008,9 @@ gsk_gl_command_queue_create_texture (GskGLCommandQueue *self,
   else
     glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
 
-  gsk_gl_command_queue_restore (self);
+  /* Restore the previous texture if it was set */
+  if (self->attachments->textures[0].id != 0)
+    glBindTexture (GL_TEXTURE_2D, self->attachments->textures[0].id);
 
   return (int)texture_id;
 }


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