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



commit 14101901e111fa54312ea09d2b1a93350d15f27a
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]