diff options
author | Niels Nesse <nnesse@sonic.net> | 2015-02-10 20:35:01 -0800 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2015-03-06 14:02:55 +0100 |
commit | b87715973f43ada48805bd0b22bd83eb4993d315 (patch) | |
tree | 9ab9139255a9690bdd332217157d3f8bcd0129f9 /gdk | |
parent | 064f4db0129b3fd845eb221b099e8638fd32e873 (diff) | |
download | gtk+-b87715973f43ada48805bd0b22bd83eb4993d315.tar.gz |
gl: Warn the user if they request a GL context version less than 3.2
If the user requests a version less than 3.2 the version is forced to 3.2.
Previous checking code have an inconsistent behavior depending on which
minor version number was specified. This is avoided now by temporarily
converting the major/minor pair into a single integer.
https://bugzilla.gnome.org/show_bug.cgi?id=744288
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/gdkglcontext.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c index 1d88a48fc1..306e0ae37e 100644 --- a/gdk/gdkglcontext.c +++ b/gdk/gdkglcontext.c @@ -492,6 +492,7 @@ gdk_gl_context_set_required_version (GdkGLContext *context, int major, int minor) { + int version; GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context); g_return_if_fail (GDK_IS_GL_CONTEXT (context)); @@ -505,13 +506,15 @@ gdk_gl_context_set_required_version (GdkGLContext *context, return; } - priv->major = MAX (major, 3); - - /* we only support versions ≥ 3.2 */ - if (priv->major == 3) - priv->minor = MAX (minor, 2); - else - priv->minor = minor; + /* Enforce a minimum context version number of 3.2 */ + version = (major * 100) + minor; + if (version < 302) + { + g_warning ("gdk_gl_context_set_required_version - GL context versions less than 3.2 are not supported."); + version = 302; + } + priv->major = version / 100; + priv->minor = version % 100; } /** |