[gtk+] gl: Warn the user if they request a GL context version less than 3.2
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gl: Warn the user if they request a GL context version less than 3.2
- Date: Fri, 6 Mar 2015 13:05:30 +0000 (UTC)
commit b87715973f43ada48805bd0b22bd83eb4993d315
Author: Niels Nesse <nnesse sonic net>
Date: Tue Feb 10 20:35:01 2015 -0800
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
gdk/gdkglcontext.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index 1d88a48..306e0ae 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;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]