[gtk/wip/chergert/glproto] ensure context before atlas uploads



commit 94aa7d3f2e081aa775f07a899cf6a9ad7a1581a6
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jan 21 16:46:09 2021 -0800

    ensure context before atlas uploads

 gsk/next/gskglglyphlibrary.c | 6 ++++++
 gsk/next/gskgliconlibrary.c  | 6 ++++++
 2 files changed, 12 insertions(+)
---
diff --git a/gsk/next/gskglglyphlibrary.c b/gsk/next/gskglglyphlibrary.c
index f527948d16..9187692567 100644
--- a/gsk/next/gskglglyphlibrary.c
+++ b/gsk/next/gskglglyphlibrary.c
@@ -23,6 +23,7 @@
 #include <gdk/gdkglcontextprivate.h>
 #include <gdk/gdkmemorytextureprivate.h>
 
+#include "gskglcommandqueueprivate.h"
 #include "gskgldriverprivate.h"
 #include "gskglglyphlibraryprivate.h"
 
@@ -187,6 +188,7 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary     *self,
   cairo_scaled_font_t *scaled_font;
   GskGLTextureAtlas *atlas;
   cairo_surface_t *surface;
+  GdkGLContext *context;
   guchar *pixel_data;
   guchar *free_data = NULL;
   guint gl_format;
@@ -199,6 +201,8 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary     *self,
   g_assert (key != NULL);
   g_assert (value != NULL);
 
+  context = GSK_GL_TEXTURE_LIBRARY (self)->driver->command_queue->context;
+
   scaled_font = pango_cairo_font_get_scaled_font ((PangoCairoFont *)key->font);
   if G_UNLIKELY (scaled_font == NULL ||
                  cairo_scaled_font_status (scaled_font) != CAIRO_STATUS_SUCCESS)
@@ -218,6 +222,8 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary     *self,
 
   g_assert (texture_id > 0);
 
+  gdk_gl_context_make_current (context);
+
   glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / 4);
   glBindTexture (GL_TEXTURE_2D, texture_id);
 
diff --git a/gsk/next/gskgliconlibrary.c b/gsk/next/gskgliconlibrary.c
index e177aaf7b1..940cb76493 100644
--- a/gsk/next/gskgliconlibrary.c
+++ b/gsk/next/gskgliconlibrary.c
@@ -24,6 +24,7 @@
 #include <gdk/gdkmemorytextureprivate.h>
 #include <gdk/gdktextureprivate.h>
 
+#include "gskglcommandqueueprivate.h"
 #include "gskgldriverprivate.h"
 #include "gskgliconlibraryprivate.h"
 
@@ -75,6 +76,7 @@ gsk_gl_icon_library_add (GskGLIconLibrary     *self,
   GskGLTextureAtlas *atlas;
   cairo_surface_t *surface;
   GskGLIconData *icon_data;
+  GdkGLContext *context;
   guint8 *pixel_data;
   guint8 *surface_data;
   guint8 *free_data = NULL;
@@ -90,6 +92,8 @@ gsk_gl_icon_library_add (GskGLIconLibrary     *self,
   g_return_if_fail (GDK_IS_TEXTURE (key));
   g_return_if_fail (out_value != NULL);
 
+  context = GSK_GL_TEXTURE_LIBRARY (self)->driver->command_queue->context;
+
   width = key->width;
   height = key->height;
 
@@ -138,6 +142,8 @@ gsk_gl_icon_library_add (GskGLIconLibrary     *self,
 
   texture_id = GSK_GL_TEXTURE_ATLAS_ENTRY_TEXTURE (icon_data);
 
+  gdk_gl_context_make_current (context);
+
   glBindTexture (GL_TEXTURE_2D, texture_id);
 
   glTexSubImage2D (GL_TEXTURE_2D, 0,


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