summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Correa Gómez <ablocorrea@hotmail.com>2022-05-25 15:23:38 +0200
committerPablo Correa Gómez <ablocorrea@hotmail.com>2022-06-04 20:48:40 +0200
commit9426b20759d81673ccecf0de35d307878acdddcf (patch)
tree33bbd19fd0fd56d69737af1bc0044fc24509ea30
parentf97cff14541d0d24637a2971db1589e707baaedf (diff)
downloadgtk+-9426b20759d81673ccecf0de35d307878acdddcf.tar.gz
glcontext: Do not check for correctness in set_required_version
There are two reasons for this: * First, the refactored realize code now makes sure that no context with unsupported version is ever created. * Second, this code could bump into false possitives and negatives, since the user is not requested, nor expected to set_required_version in any specific order relative to set_allowed_apis. Therefore, some version could be rejected or accepted based on a set of allowed apis that the user has not yet correctly configured.
-rw-r--r--gdk/gdkglcontext.c41
1 files changed, 6 insertions, 35 deletions
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index 41f261f2d8..78080a236b 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -1009,7 +1009,10 @@ gdk_gl_context_get_matching_version (GdkGLAPI api,
*
* Setting @major and @minor to zero will use the default values.
*
- * The `GdkGLContext` must not be realized or made current prior to calling
+ * Setting @major and @minor lower than the minimum versions required
+ * by GTK will result in the context choosing the minimum version.
+ *
+ * The @context must not be realized or made current prior to calling
* this function.
*/
void
@@ -1018,44 +1021,12 @@ gdk_gl_context_set_required_version (GdkGLContext *context,
int minor)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
- gboolean force_gles = FALSE;
- int version, min_ver;
-#ifdef G_ENABLE_DEBUG
- GdkDisplay *display;
-#endif
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
g_return_if_fail (!gdk_gl_context_is_realized (context));
- /* this will take care of the default */
- if (major == 0 && minor == 0)
- {
- priv->major = 0;
- priv->minor = 0;
- return;
- }
-
- version = (major * 100) + minor;
-
-#ifdef G_ENABLE_DEBUG
- display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
- force_gles = GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES);
-#endif
- /* Enforce a minimum context version number of 3.2 for desktop GL,
- * and 2.0 for GLES
- */
- if (gdk_gl_context_get_use_es (context) || force_gles)
- min_ver = 200;
- else
- min_ver = 302;
-
- if (version < min_ver)
- {
- g_warning ("gdk_gl_context_set_required_version - GL context versions less than 3.2 are not supported.");
- version = min_ver;
- }
- priv->major = version / 100;
- priv->minor = version % 100;
+ priv->major = major;
+ priv->minor = minor;
}
gboolean