[gtk/matthiasc/color-profile-rebased: 43/57] gsk: Fix caching of textures




commit e078f2abfbcdcd683c514954c9a6025727db4b93
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun May 8 14:11:48 2022 -0400

    gsk: Fix caching of textures

 gsk/gl/gskgldriver.c | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)
---
diff --git a/gsk/gl/gskgldriver.c b/gsk/gl/gskgldriver.c
index b4fa083f04..b97335080e 100644
--- a/gsk/gl/gskgldriver.c
+++ b/gsk/gl/gskgldriver.c
@@ -800,6 +800,12 @@ gsk_gl_driver_load_texture (GskGLDriver *self,
 
   format = gdk_memory_format_prefers_high_depth (gdk_texture_get_format (texture)) ? GL_RGBA16F : 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;
@@ -868,25 +874,11 @@ gsk_gl_driver_load_texture (GskGLDriver *self,
               return texture_id;
             }
         }
-      else
-        {
-          downloaded_texture = gdk_memory_texture_from_texture (texture,
-                                                                gdk_texture_get_format (texture),
-                                                                gdk_texture_get_color_space (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_memory_texture_from_texture (texture,
-                                                            gdk_texture_get_format (texture),
-                                                            gdk_texture_get_color_space (texture));
-    }
+  downloaded_texture = gdk_memory_texture_from_texture (texture,
+                                                        gdk_texture_get_format (texture),
+                                                        gdk_texture_get_color_space (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]