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 9c4c4eaaa1 for a longer
discussion).

Fixes #4402
This commit is contained in:
Benjamin Otte
2021-11-03 19:49:57 +01:00
parent 37cbd0662e
commit bca77b5505
3 changed files with 5 additions and 15 deletions

View File

@@ -572,6 +572,11 @@ gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glViewport (0, 0, ww, wh);
#ifdef HAVE_EGL
if (priv->egl_context)
glDrawBuffers (1, (GLenum[1]) { GL_BACK_LEFT });
#endif
}
static void

View File

@@ -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

View File

@@ -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