[gtk/matthiasc/color-profiles] ngl: Fix caching for GL textures



commit 2fd9a5a252eb38c5e2eb15250c89c6a78718d476
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Oct 2 13:33:17 2021 -0400

    ngl: Fix caching for GL textures
    
    Now that GL textures can have render data,
    we need to check for that first.

 gsk/ngl/gskngldriver.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)
---
diff --git a/gsk/ngl/gskngldriver.c b/gsk/ngl/gskngldriver.c
index 8d23f9244b..721705ffab 100644
--- a/gsk/ngl/gskngldriver.c
+++ b/gsk/ngl/gskngldriver.c
@@ -822,6 +822,12 @@ gsk_ngl_driver_load_texture (GskNglDriver *self,
 
   format = GL_RGBA8;
 
+  if ((t = gdk_texture_get_render_data (texture, self)))
+    {
+      if (t->min_filter == min_filter && t->mag_filter == mag_filter)
+        return t->texture_id;
+    }
+
   if (GDK_IS_GL_TEXTURE (texture))
     {
       GdkGLTexture *gl_texture = (GdkGLTexture *) texture;
@@ -890,23 +896,9 @@ gsk_ngl_driver_load_texture (GskNglDriver *self,
               return texture_id;
             }
         }
-      else
-        {
-          downloaded_texture = gdk_texture_download_texture (texture);
-        }
-    }
-  else
-    {
-      if ((t = gdk_texture_get_render_data (texture, self)))
-        {
-          if (t->min_filter == min_filter && t->mag_filter == mag_filter)
-            return t->texture_id;
-        }
-
-      downloaded_texture = gdk_texture_download_texture (texture);
     }
 
-  g_assert (downloaded_texture && !texture_id);
+  downloaded_texture = gdk_texture_download_texture (texture);
 
   /* The download_texture() call may have switched the GL context. Make sure
    * the right context is at work again. */


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