[gtk/wip/otte/gleanup: 55/59] gl: Fix issue with EGL + nvidia
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/gleanup: 55/59] gl: Fix issue with EGL + nvidia
- Date: Tue, 20 Jul 2021 03:21:21 +0000 (UTC)
commit 2b593c64a0bdc1574a3f2577dc49cff147d1b07d
Author: Benjamin Otte <otte redhat com>
Date: Sat Jul 10 02:29:17 2021 +0200
gl: Fix issue with EGL + nvidia
nvidia sets the default draw buffer to GL_NONE if EGL contexts are
initially bound to EGL_NO_SURFACE which is exactly what we are doing. So
bind them to GL_BACK when drawing, as they should be.
See https://phabricator.services.mozilla.com/D118743 for a discussion
about EGL_NO_CONTEXT and draw buffers.
gdk/wayland/gdkglcontext-wayland.c | 11 +++++++++++
gdk/x11/gdkglcontext-egl.c | 10 ++++++++++
2 files changed, 21 insertions(+)
---
diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c
index 558c9cfed0..0bc24824f6 100644
--- a/gdk/wayland/gdkglcontext-wayland.c
+++ b/gdk/wayland/gdkglcontext-wayland.c
@@ -276,6 +276,16 @@ gdk_wayland_gl_context_make_current (GdkGLContext *context,
egl_surface,
context_wayland->egl_context);
}
+
+static void
+gdk_wayland_gl_context_begin_frame (GdkDrawContext *draw_context,
+ cairo_region_t *region)
+{
+ GDK_DRAW_CONTEXT_CLASS (gdk_wayland_gl_context_parent_class)->begin_frame (draw_context, region);
+
+ glDrawBuffers (1, (GLenum[1]) { GL_BACK });
+}
+
static void
gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context,
cairo_region_t *painted)
@@ -337,6 +347,7 @@ gdk_wayland_gl_context_class_init (GdkWaylandGLContextClass *klass)
gobject_class->dispose = gdk_wayland_gl_context_dispose;
+ draw_context_class->begin_frame = gdk_wayland_gl_context_begin_frame;
draw_context_class->end_frame = gdk_wayland_gl_context_end_frame;
context_class->realize = gdk_wayland_gl_context_realize;
diff --git a/gdk/x11/gdkglcontext-egl.c b/gdk/x11/gdkglcontext-egl.c
index a4de68d228..eb5fd33724 100644
--- a/gdk/x11/gdkglcontext-egl.c
+++ b/gdk/x11/gdkglcontext-egl.c
@@ -312,6 +312,15 @@ gdk_x11_surface_destroy_egl_surface (GdkX11Surface *self)
self->egl_surface = NULL;
}
+static void
+gdk_x11_gl_context_egl_begin_frame (GdkDrawContext *draw_context,
+ cairo_region_t *region)
+{
+ GDK_DRAW_CONTEXT_CLASS (gdk_x11_gl_context_egl_parent_class)->begin_frame (draw_context, region);
+
+ glDrawBuffers (1, (GLenum[1]) { GL_BACK });
+}
+
static void
gdk_x11_gl_context_egl_end_frame (GdkDrawContext *draw_context,
cairo_region_t *painted)
@@ -638,6 +647,7 @@ gdk_x11_gl_context_egl_class_init (GdkX11GLContextEGLClass *klass)
context_class->clear_current = gdk_x11_gl_context_egl_clear_current;
context_class->get_damage = gdk_x11_gl_context_egl_get_damage;
+ draw_context_class->begin_frame = gdk_x11_gl_context_egl_begin_frame;
draw_context_class->end_frame = gdk_x11_gl_context_egl_end_frame;
gobject_class->dispose = gdk_x11_gl_context_egl_dispose;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]