[gtk/wip/otte/for-master: 1/2] egl: Set the draw buffer to GL_BACK_LEFT




commit 5055347d0063ff1e69ed298b1df4bd271c209777
Author: Benjamin Otte <otte redhat com>
Date:   Wed Nov 3 19:49:57 2021 +0100

    egl: Set the draw buffer to GL_BACK_LEFT
    
    Instead of using GL_BACK, use GL_BACK_LEFT, because the spec demands
    this (many drivers don't).
    
    Also move the call from the GDK backends into the GLContext code, as
    this is a generic EGL issue (nvidia being the main driver in need of
    this call, see 9c4c4eaaa121d784f591a591b95264647eaece96 for a longer
    discussion).
    
    Fixes #4402

 gdk/gdkglcontext.c                 |  3 +++
 gdk/wayland/gdkglcontext-wayland.c |  2 --
 gdk/x11/gdkglcontext-egl.c         | 13 -------------
 3 files changed, 3 insertions(+), 15 deletions(-)
---
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index 422e0a189e..6ce2195c56 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -572,6 +572,9 @@ gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
   glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
 
   glViewport (0, 0, ww, wh);
+
+  if (priv->egl_context)
+    glDrawBuffers (1, (GLenum[1]) { GL_BACK_LEFT });
 }
 
 static void
diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c
index d631816286..a7a51c535f 100644
--- a/gdk/wayland/gdkglcontext-wayland.c
+++ b/gdk/wayland/gdkglcontext-wayland.c
@@ -53,8 +53,6 @@ gdk_wayland_gl_context_begin_frame (GdkDrawContext *draw_context,
   gdk_wayland_surface_ensure_wl_egl_window (gdk_draw_context_get_surface (draw_context));
 
   GDK_DRAW_CONTEXT_CLASS (gdk_wayland_gl_context_parent_class)->begin_frame (draw_context, 
prefers_high_depth, region);
-
-  glDrawBuffers (1, (GLenum[1]) { GL_BACK });
 }
 
 static void
diff --git a/gdk/x11/gdkglcontext-egl.c b/gdk/x11/gdkglcontext-egl.c
index 67d730fcfb..6a6bf9a08b 100644
--- a/gdk/x11/gdkglcontext-egl.c
+++ b/gdk/x11/gdkglcontext-egl.c
@@ -59,16 +59,6 @@ gdk_x11_display_get_egl_display (GdkDisplay *display)
   return gdk_display_get_egl_display (display);
 }
 
-static void
-gdk_x11_gl_context_egl_begin_frame (GdkDrawContext *draw_context,
-                                    gboolean        prefers_high_depth,
-                                    cairo_region_t *region)
-{
-  GDK_DRAW_CONTEXT_CLASS (gdk_x11_gl_context_egl_parent_class)->begin_frame (draw_context, 
prefers_high_depth, region);
-
-  glDrawBuffers (1, (GLenum[1]) { GL_BACK });
-}
-
 static gboolean
 gdk_x11_gl_context_egl_make_current (GdkGLContext *context,
                                      gboolean      surfaceless)
@@ -107,13 +97,10 @@ static void
 gdk_x11_gl_context_egl_class_init (GdkX11GLContextEGLClass *klass)
 {
   GdkGLContextClass *context_class = GDK_GL_CONTEXT_CLASS (klass);
-  GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS (klass);
 
   context_class->backend_type = GDK_GL_EGL;
 
   context_class->make_current = gdk_x11_gl_context_egl_make_current;
-
-  draw_context_class->begin_frame = gdk_x11_gl_context_egl_begin_frame;
 }
 
 static void


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