[gtk/wip/otte/center-center-center: 2/5] gl: Call make_current() before doing any GL work
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/center-center-center: 2/5] gl: Call make_current() before doing any GL work
- Date: Fri, 22 Oct 2021 15:52:00 +0000 (UTC)
commit b912e84df7ef7c0a4c298ea9f712cc5bf5f4aa82
Author: Benjamin Otte <otte redhat com>
Date: Fri Oct 22 17:37:34 2021 +0200
gl: Call make_current() before doing any GL work
But don't call it too early, we only want to call it once we have
prepared the target.
This way, we guarantee that a GL context is always available and that it
is bound to the correct target.
gsk/gl/gskglrenderer.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index 0b1e9eddda..c11715ae9e 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -203,11 +203,12 @@ gsk_gl_renderer_render (GskRenderer *renderer,
viewport.size.width = gdk_surface_get_width (surface) * scale_factor;
viewport.size.height = gdk_surface_get_height (surface) * scale_factor;
- gdk_gl_context_make_current (self->context);
gdk_draw_context_begin_frame_full (GDK_DRAW_CONTEXT (self->context),
gsk_render_node_prefers_high_depth (root),
update_area);
+ gdk_gl_context_make_current (self->context);
+
/* Must be called *AFTER* gdk_draw_context_begin_frame() */
render_region = get_render_region (surface, self->context);
@@ -221,7 +222,6 @@ gsk_gl_renderer_render (GskRenderer *renderer,
gsk_gl_driver_end_frame (self->driver);
gsk_gl_render_job_free (job);
- gdk_gl_context_make_current (self->context);
gdk_draw_context_end_frame (GDK_DRAW_CONTEXT (self->context));
gsk_gl_driver_after_frame (self->driver);
@@ -251,6 +251,8 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
format = gsk_render_node_prefers_high_depth (root) ? GL_RGBA32F : GL_RGBA8;
+ gdk_gl_context_make_current (self->context);
+
if (gsk_gl_driver_create_render_target (self->driver,
width, height,
format,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]