From 8846a7002c1cfd9a13ef97304c31a9a874b9e77c Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 28 Jan 2015 19:04:22 +0000 Subject: [PATCH] gl: Drop OpenGL legacy profile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We simply don't want to care about legacy OpenGL. All supported platforms also have support for OpenGL ≥ 3.2; it would complicate the internal code; and would force us to use legacy GL contexts internally if the first context created by the user is a legacy GL context, and disable creation of core-3.2 contexts after that. We will need to fix all our code examples to use the Core 3.2 profile. https://bugzilla.gnome.org/show_bug.cgi?id=741946 --- gdk/gdkglcontext.c | 12 +----------- gdk/gdktypes.h | 20 +++++++++++++++----- gdk/gdkwindow.c | 14 +------------- gdk/x11/gdkglcontext-x11.c | 6 +----- 4 files changed, 18 insertions(+), 34 deletions(-) diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c index 55ee9f1ca6..3ffaf8f8c2 100644 --- a/gdk/gdkglcontext.c +++ b/gdk/gdkglcontext.c @@ -553,11 +553,6 @@ gdk_gl_context_get_required_version (GdkGLContext *context, switch (priv->profile) { case GDK_GL_PROFILE_DEFAULT: - case GDK_GL_PROFILE_LEGACY: - if (major != NULL) - *major = 1; - break; - case GDK_GL_PROFILE_3_2_CORE: if (major != NULL) *major = 3; @@ -572,11 +567,6 @@ gdk_gl_context_get_required_version (GdkGLContext *context, switch (priv->profile) { case GDK_GL_PROFILE_DEFAULT: - case GDK_GL_PROFILE_LEGACY: - if (minor != NULL) - *minor = 0; - break; - case GDK_GL_PROFILE_3_2_CORE: if (minor != NULL) *minor = 2; @@ -740,7 +730,7 @@ gdk_gl_context_get_profile (GdkGLContext *context) { GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context); - g_return_val_if_fail (GDK_IS_GL_CONTEXT (context), GDK_GL_PROFILE_LEGACY); + g_return_val_if_fail (GDK_IS_GL_CONTEXT (context), GDK_GL_PROFILE_DEFAULT); return priv->profile; } diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h index 5b0a656fa1..2a377d8230 100644 --- a/gdk/gdktypes.h +++ b/gdk/gdktypes.h @@ -435,18 +435,28 @@ struct _GdkPoint /** * GdkGLProfile: - * @GDK_GL_PROFILE_DEFAULT: ... - * @GDK_GL_PROFILE_LEGACY: ... - * @GDK_GL_PROFILE_3_2_CORE: ... + * @GDK_GL_PROFILE_DEFAULT: The default profile. + * @GDK_GL_PROFILE_3_2_CORE: Use core 3.2 GL profiles * - * ... + * The profile to be used when creating a #GdkGLContext. + * + * Since: 3.16 */ typedef enum { GDK_GL_PROFILE_DEFAULT, - GDK_GL_PROFILE_LEGACY, GDK_GL_PROFILE_3_2_CORE } GdkGLProfile; +/** + * GdkGLError: + * @GDK_GL_ERROR_NOT_AVAILABLE: OpenGL support is not available + * @GDK_GL_ERROR_UNSUPPORTED_FORMAT: The requested visual format is not supported + * @GDK_GL_ERROR_UNSUPPORTED_PROFILE: The requested profile is not supported + * + * Error enumeration for #GdkGLContext. + * + * Since: 3.16 + */ typedef enum { GDK_GL_ERROR_NOT_AVAILABLE, GDK_GL_ERROR_UNSUPPORTED_FORMAT, diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 9cc257b49a..94a09c78d0 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -2742,21 +2742,9 @@ gdk_window_get_paint_gl_context (GdkWindow *window, window->impl_window->gl_paint_context = GDK_WINDOW_IMPL_GET_CLASS (window->impl)->create_gl_context (window->impl_window, TRUE, - GDK_GL_PROFILE_3_2_CORE, + GDK_GL_PROFILE_DEFAULT, NULL, &internal_error); - if (window->impl_window->gl_paint_context == NULL && - g_error_matches (internal_error, GDK_GL_ERROR, - GDK_GL_ERROR_UNSUPPORTED_PROFILE)) - { - g_clear_error (&internal_error); - window->impl_window->gl_paint_context = - GDK_WINDOW_IMPL_GET_CLASS (window->impl)->create_gl_context (window->impl_window, - TRUE, - GDK_GL_PROFILE_DEFAULT, - NULL, - &internal_error); - } } if (internal_error != NULL) diff --git a/gdk/x11/gdkglcontext-x11.c b/gdk/x11/gdkglcontext-x11.c index 8b11c82c6c..cde1e09331 100644 --- a/gdk/x11/gdkglcontext-x11.c +++ b/gdk/x11/gdkglcontext-x11.c @@ -609,10 +609,6 @@ gdk_x11_gl_context_realize (GdkGLContext *context, profile = gdk_gl_context_get_profile (context); share = gdk_gl_context_get_shared_context (context); - /* GDK_GL_PROFILE_DEFAULT is currently equivalent to the LEGACY profile */ - if (profile == GDK_GL_PROFILE_DEFAULT) - profile = GDK_GL_PROFILE_LEGACY; - /* we check for the presence of the GLX_ARB_create_context_profile * extension before checking for a GLXFBConfig. */ @@ -1193,7 +1189,7 @@ gdk_x11_window_create_gl_context (GdkWindow *window, display = gdk_window_get_display (window); - /* GDK_GL_PROFILE_DEFAULT is currently equivalent to the LEGACY profile */ + /* GDK_GL_PROFILE_DEFAULT is currently equivalent to the 3_2_CORE profile */ if (profile == GDK_GL_PROFILE_DEFAULT) profile = GDK_GL_PROFILE_3_2_CORE;