[gtk/wip.win32.fixes: 15/23] glcontext: Do not check for correctness in set_required_version




commit 1b5197240b670c0cb4aa8ee87ada272d6ebe85b8
Author: Pablo Correa Gómez <ablocorrea hotmail com>
Date:   Wed May 25 15:23:38 2022 +0200

    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.

 gdk/gdkglcontext.c | 41 ++++++-----------------------------------
 1 file changed, 6 insertions(+), 35 deletions(-)
---
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index 1fe7b7b06b..17db00e8b3 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -1025,7 +1025,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
@@ -1034,44 +1037,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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]