[gtk/wip/chergert/glproto: 441/526] call make current a bit less




commit 9314bce1ffa0ff118cdd255019c95c77d4621b36
Author: Christian Hergert <chergert redhat com>
Date:   Wed Feb 3 19:16:22 2021 -0800

    call make current a bit less

 gsk/next/gskglcommandqueue.c | 12 ++++--------
 gsk/next/gskgldriver.c       |  1 -
 gsk/next/gskglglyphlibrary.c |  5 -----
 gsk/next/gskgliconlibrary.c  |  5 -----
 gsk/next/gskglrenderjob.c    |  2 --
 5 files changed, 4 insertions(+), 21 deletions(-)
---
diff --git a/gsk/next/gskglcommandqueue.c b/gsk/next/gskglcommandqueue.c
index 6d43ccf21e..333cd6746b 100644
--- a/gsk/next/gskglcommandqueue.c
+++ b/gsk/next/gskglcommandqueue.c
@@ -628,7 +628,6 @@ gsk_gl_command_queue_delete_program (GskGLCommandQueue *self,
 {
   g_assert (GSK_IS_GL_COMMAND_QUEUE (self));
 
-  gsk_gl_command_queue_make_current (self);
   glDeleteProgram (program);
   gsk_gl_uniform_state_clear_program (self->uniforms, program);
 }
@@ -803,13 +802,13 @@ gsk_gl_command_queue_execute (GskGLCommandQueue    *self,
   if (self->batches->len == 0)
     return;
 
+  gsk_gl_command_queue_make_current (self);
+
 #ifdef G_ENABLE_DEBUG
   gsk_gl_profiler_begin_gpu_region (self->gl_profiler);
   gsk_profiler_timer_begin (self->profiler, self->metrics.cpu_time);
 #endif
 
-  gsk_gl_command_queue_make_current (self);
-
   glEnable (GL_DEPTH_TEST);
   glDepthFunc (GL_LEQUAL);
 
@@ -1004,6 +1003,8 @@ gsk_gl_command_queue_begin_frame (GskGLCommandQueue *self)
   g_assert (GSK_IS_GL_COMMAND_QUEUE (self));
   g_assert (self->batches->len == 0);
 
+  gsk_gl_command_queue_make_current (self);
+
   self->tail_batch_index = -1;
   self->in_frame = TRUE;
 }
@@ -1027,7 +1028,6 @@ gsk_gl_command_queue_end_frame (GskGLCommandQueue *self)
   g_assert (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
@@ -1120,8 +1120,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_make_current (self);
-
   glGenTextures (1, &texture_id);
 
   glActiveTexture (GL_TEXTURE0);
@@ -1151,8 +1149,6 @@ gsk_gl_command_queue_create_framebuffer (GskGLCommandQueue *self)
 
   g_return_val_if_fail (GSK_IS_GL_COMMAND_QUEUE (self), -1);
 
-  gsk_gl_command_queue_make_current (self);
-
   glGenFramebuffers (1, &fbo_id);
 
   return fbo_id;
diff --git a/gsk/next/gskgldriver.c b/gsk/next/gskgldriver.c
index 62d4d6df09..0dc776849d 100644
--- a/gsk/next/gskgldriver.c
+++ b/gsk/next/gskgldriver.c
@@ -518,7 +518,6 @@ gsk_next_driver_begin_frame (GskNextDriver     *self,
 
   g_set_object (&self->command_queue, command_queue);
 
-  gsk_gl_command_queue_make_current (self->command_queue);
   gsk_gl_command_queue_begin_frame (self->command_queue);
 
   gsk_gl_texture_library_begin_frame (GSK_GL_TEXTURE_LIBRARY (self->icons));
diff --git a/gsk/next/gskglglyphlibrary.c b/gsk/next/gskglglyphlibrary.c
index fffc83452f..ab68efbbac 100644
--- a/gsk/next/gskglglyphlibrary.c
+++ b/gsk/next/gskglglyphlibrary.c
@@ -190,7 +190,6 @@ 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;
@@ -203,8 +202,6 @@ 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)
@@ -224,8 +221,6 @@ 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 d0d9f150ed..86b1eca2ec 100644
--- a/gsk/next/gskgliconlibrary.c
+++ b/gsk/next/gskgliconlibrary.c
@@ -77,7 +77,6 @@ gsk_gl_icon_library_add (GskGLIconLibrary     *self,
   G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
   cairo_surface_t *surface;
   GskGLIconData *icon_data;
-  GdkGLContext *context;
   guint8 *pixel_data;
   guint8 *surface_data;
   guint8 *free_data = NULL;
@@ -93,8 +92,6 @@ 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;
 
@@ -130,8 +127,6 @@ 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,
diff --git a/gsk/next/gskglrenderjob.c b/gsk/next/gskglrenderjob.c
index 0e5dbabe23..6d5fb5bade 100644
--- a/gsk/next/gskglrenderjob.c
+++ b/gsk/next/gskglrenderjob.c
@@ -3067,8 +3067,6 @@ gsk_gl_render_job_upload_texture (GskGLRenderJob       *job,
       offscreen->texture_id = gsk_next_driver_load_texture (job->driver, texture, GL_LINEAR, GL_LINEAR);
       init_full_texture_region (offscreen);
     }
-
-  gsk_gl_command_queue_make_current (job->command_queue);
 }
 
 static void


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