mesa/st: add force_compat_profile option to driconfig
authorTimothy Arceri <tarceri@itsqueeze.com>
Wed, 12 Sep 2018 00:52:06 +0000 (10:52 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Tue, 18 Sep 2018 09:34:54 +0000 (19:34 +1000)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
src/gallium/state_trackers/dri/dri_context.c
src/util/xmlpool/t_options.h

index 5f4305d91d71240baa21b4282fec3da2345f48d3..9db0dc01117329d2d3acd8cad8e9e3210b2c7283 100644 (file)
@@ -30,6 +30,7 @@ DRI_CONF_SECTION_DEBUG
    DRI_CONF_FORCE_GLSL_ABS_SQRT("false")
    DRI_CONF_GLSL_CORRECT_DERIVATIVES_AFTER_DISCARD("false")
    DRI_CONF_ALLOW_GLSL_LAYOUT_QUALIFIER_ON_FUNCTION_PARAMETERS("false")
+   DRI_CONF_FORCE_COMPAT_PROFILE("false")
 DRI_CONF_SECTION_END
 
 DRI_CONF_SECTION_MISCELLANEOUS
index fb307337a90565e55c19b0be13b9ef6ec6f3fd9a..af9e3325f98ec7a6ce711382bda4c80bc33e7d38 100644 (file)
@@ -62,6 +62,7 @@ dri_create_context(gl_api api, const struct gl_config * visual,
       __DRIVER_CONTEXT_ATTRIB_RELEASE_BEHAVIOR;
    const __DRIbackgroundCallableExtension *backgroundCallable =
       screen->sPriv->dri2.backgroundCallable;
+   const struct driOptionCache *optionCache = &screen->dev->option_cache;
 
    if (screen->has_reset_status_query) {
       allowed_flags |= __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS;
@@ -88,8 +89,13 @@ dri_create_context(gl_api api, const struct gl_config * visual,
       break;
    case API_OPENGL_COMPAT:
    case API_OPENGL_CORE:
-      attribs.profile = api == API_OPENGL_COMPAT ? ST_PROFILE_DEFAULT
-                                                 : ST_PROFILE_OPENGL_CORE;
+      if (driQueryOptionb(optionCache, "force_compat_profile")) {
+         attribs.profile = ST_PROFILE_DEFAULT;
+      } else {
+         attribs.profile = api == API_OPENGL_COMPAT ? ST_PROFILE_DEFAULT
+                                                    : ST_PROFILE_OPENGL_CORE;
+      }
+
       attribs.major = ctx_config->major_version;
       attribs.minor = ctx_config->minor_version;
 
index b6f7eed80b167b9d3aa4c4fb9465b828bc468cf1..446674b46abebaf3126a90eeeebbc63d58a0e6fe 100644 (file)
@@ -140,6 +140,11 @@ DRI_CONF_OPT_BEGIN_B(allow_glsl_layout_qualifier_on_function_parameters, def) \
         DRI_CONF_DESC(en,gettext("Allow layout qualifiers on function parameters.")) \
 DRI_CONF_OPT_END
 
+#define DRI_CONF_FORCE_COMPAT_PROFILE(def) \
+DRI_CONF_OPT_BEGIN_B(force_compat_profile, def) \
+        DRI_CONF_DESC(en,gettext("Force an OpenGL compatibility context")) \
+DRI_CONF_OPT_END
+
 /**
  * \brief Image quality-related options
  */