[gtk/wip/chergert/glproto: 751/920] reset texture attachments when ending frame




commit 5f5d2108bbf730078235c84793833904ed9ccae4
Author: Christian Hergert <chergert redhat com>
Date:   Tue Jan 26 11:44:08 2021 -0800

    reset texture attachments when ending frame
    
    this just ensure we don't hold on to texturing slots across frames

 gsk/next/gskglcommandqueue.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/gsk/next/gskglcommandqueue.c b/gsk/next/gskglcommandqueue.c
index ad2ef21337..5edc473a98 100644
--- a/gsk/next/gskglcommandqueue.c
+++ b/gsk/next/gskglcommandqueue.c
@@ -905,8 +905,20 @@ gsk_gl_command_queue_end_frame (GskGLCommandQueue *self)
   g_return_if_fail (GSK_IS_GL_COMMAND_QUEUE (self));
   g_return_if_fail (self->saved_state->len == 0);
 
+  gsk_gl_command_queue_make_current (self);
+
   gsk_gl_uniform_state_end_frame (self->uniforms);
 
+  /* Reset attachments so we don't hold on to any textures
+   * that might be released after the frame.
+   */
+  for (guint i = 0; i < G_N_ELEMENTS (self->attachments->textures); i++)
+    {
+      glActiveTexture (GL_TEXTURE0 + i);
+      glBindTexture (GL_TEXTURE_2D, 0);
+      self->attachments->textures[i].id = 0;
+    }
+
   g_string_chunk_clear (self->debug_groups);
 
   self->batches->len = 0;


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