[gtk+/wip/ebassi/gles: 14/26] wayland: Implement asking for a GLES context
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/ebassi/gles: 14/26] wayland: Implement asking for a GLES context
- Date: Sun, 24 Apr 2016 14:10:24 +0000 (UTC)
commit 4ca69ad0ad3ec350e3618ceb82c021abbf15c3dd
Author: Emmanuele Bassi <ebassi gnome org>
Date: Mon Apr 18 10:13:05 2016 +0100
wayland: Implement asking for a GLES context
Wayland uses EGL, which allows us to ask for a GLES context.
https://bugzilla.gnome.org/show_bug.cgi?id=743746
gdk/wayland/gdkglcontext-wayland.c | 36 ++++++++++++++++++++++++------------
1 files changed, 24 insertions(+), 12 deletions(-)
---
diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c
index b578d7a..1519e1a 100644
--- a/gdk/wayland/gdkglcontext-wayland.c
+++ b/gdk/wayland/gdkglcontext-wayland.c
@@ -114,7 +114,7 @@ gdk_wayland_gl_context_realize (GdkGLContext *context,
EGLContext ctx;
EGLint context_attribs[N_EGL_ATTRS];
int major, minor, flags;
- gboolean debug_bit, forward_bit, legacy_bit;
+ gboolean debug_bit, forward_bit, legacy_bit, use_es;
int i = 0;
gdk_gl_context_get_required_version (context, &major, &minor);
@@ -122,6 +122,7 @@ gdk_wayland_gl_context_realize (GdkGLContext *context,
forward_bit = gdk_gl_context_get_forward_compatible (context);
legacy_bit = (_gdk_gl_flags & GDK_GL_LEGACY) != 0 ||
(share != NULL && gdk_gl_context_is_legacy (share));
+ use_es = gdk_gl_context_get_use_es (context);
flags = 0;
@@ -130,17 +131,28 @@ gdk_wayland_gl_context_realize (GdkGLContext *context,
if (forward_bit)
flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
- /* We want a core profile, unless in legacy mode */
- context_attribs[i++] = EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR;
- context_attribs[i++] = legacy_bit
- ? EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR
- : EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
-
- /* Specify the version */
- context_attribs[i++] = EGL_CONTEXT_MAJOR_VERSION_KHR;
- context_attribs[i++] = legacy_bit ? 3 : major;
- context_attribs[i++] = EGL_CONTEXT_MINOR_VERSION_KHR;
- context_attribs[i++] = legacy_bit ? 0 : minor;
+ if (!use_es)
+ {
+ /* We want a core profile, unless in legacy mode */
+ context_attribs[i++] = EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR;
+ context_attribs[i++] = legacy_bit
+ ? EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR
+ : EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
+
+ /* Specify the version */
+ context_attribs[i++] = EGL_CONTEXT_MAJOR_VERSION_KHR;
+ context_attribs[i++] = legacy_bit ? 3 : major;
+ context_attribs[i++] = EGL_CONTEXT_MINOR_VERSION_KHR;
+ context_attribs[i++] = legacy_bit ? 0 : minor;
+ }
+ else
+ {
+ context_attribs[i++] = EGL_CONTEXT_CLIENT_VERSION;
+ if (major == 3)
+ context_attribs[i++] = 3;
+ else
+ context_attribs[i++] = 2;
+ }
/* Specify the flags */
context_attribs[i++] = EGL_CONTEXT_FLAGS_KHR;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]