<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Feb 3, 2017 at 9:23 AM, Samuel Pitoiset <span dir="ltr"><<a href="mailto:samuel.pitoiset@gmail.com" target="_blank">samuel.pitoiset@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is similar to the MESA_GLSL_VERSION_OVERRIDE envvar (mainly<br>
for developers). But this one has the advantage to be configured<br>
for specific apps which require a context with an explicit version.<br>
<br>
For example, when an app requires a 3.2 core context, RadeonSI<br>
will return a 4.5 context but this might fail (eg. ARK games).<br></blockquote><div><br></div><div>Why is returning a 4.5 context a problem?  It's supposed to be more-or-less backwards compatible.<br><br></div><div>I'm also a bit concerned about making this driconf option be global across drivers without it being just a maximum.  Suppose someone sets it to 4.3 for some app that doesn't like 4.5.  What happens if they try to run that app on hardware that doesn't support 4.3?  Do they get a 4.3 context that just doesn't work?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
No need to add both "ARK: Survival Evolved" and "ARK: Survival<br>
Of The Fittest" because the executable name is the same.<br>
<br>
Signed-off-by: Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com">samuel.pitoiset@gmail.com</a>><br>
---<br>
 src/gallium/include/state_<wbr>tracker/st_api.h      | 1 +<br>
 src/gallium/state_trackers/<wbr>dri/dri_screen.c     | 3 +++<br>
 src/gallium/state_trackers/<wbr>osmesa/osmesa.c      | 1 +<br>
 src/mesa/drivers/dri/common/<wbr>drirc               | 4 ++++<br>
 src/mesa/drivers/dri/common/<wbr>xmlpool/t_options.h | 5 +++++<br>
 src/mesa/drivers/dri/i965/brw_<wbr>context.c         | 3 +++<br>
 src/mesa/state_tracker/st_<wbr>extensions.c          | 3 +++<br>
 7 files changed, 20 insertions(+)<br>
<br>
diff --git a/src/gallium/include/state_<wbr>tracker/st_api.h b/src/gallium/include/state_<wbr>tracker/st_api.h<br>
index a2e37d2e48..e0a73d74ad 100644<br>
--- a/src/gallium/include/state_<wbr>tracker/st_api.h<br>
+++ b/src/gallium/include/state_<wbr>tracker/st_api.h<br>
@@ -246,6 +246,7 @@ struct st_config_options<br>
    boolean force_s3tc_enable;<br>
    boolean allow_glsl_extension_<wbr>directive_midshader;<br>
    boolean glsl_zero_init;<br>
+   unsigned override_glsl_version;<br>
 };<br>
<br>
 /**<br>
diff --git a/src/gallium/state_trackers/<wbr>dri/dri_screen.c b/src/gallium/state_trackers/<wbr>dri/dri_screen.c<br>
index a950f5241d..a1fa0a3be3 100644<br>
--- a/src/gallium/state_trackers/<wbr>dri/dri_screen.c<br>
+++ b/src/gallium/state_trackers/<wbr>dri/dri_screen.c<br>
@@ -70,6 +70,7 @@ const __DRIconfigOptionsExtension gallium_config_options = {<br>
          DRI_CONF_DISABLE_SHADER_BIT_<wbr>ENCODING("false")<br>
          DRI_CONF_FORCE_GLSL_VERSION(0)<br>
          DRI_CONF_ALLOW_GLSL_EXTENSION_<wbr>DIRECTIVE_MIDSHADER("false")<br>
+         DRI_CONF_OVERRIDE_GLSL_<wbr>VERSION(0)<br>
       DRI_CONF_SECTION_END<br>
<br>
       DRI_CONF_SECTION_MISCELLANEOUS<br>
@@ -100,6 +101,8 @@ dri_fill_st_options(struct st_config_options *options,<br>
    options->allow_glsl_extension_<wbr>directive_midshader =<br>
       driQueryOptionb(optionCache, "allow_glsl_extension_<wbr>directive_midshader");<br>
    options->glsl_zero_init = driQueryOptionb(optionCache, "glsl_zero_init");<br>
+   options->override_glsl_version =<br>
+      driQueryOptioni(optionCache, "override_glsl_version");<br>
 }<br>
<br>
 static const __DRIconfig **<br>
diff --git a/src/gallium/state_trackers/<wbr>osmesa/osmesa.c b/src/gallium/state_trackers/<wbr>osmesa/osmesa.c<br>
index 18f1b88128..8102be14ed 100644<br>
--- a/src/gallium/state_trackers/<wbr>osmesa/osmesa.c<br>
+++ b/src/gallium/state_trackers/<wbr>osmesa/osmesa.c<br>
@@ -679,6 +679,7 @@ OSMesaCreateContextAttribs(<wbr>const int *attribList, OSMesaContext sharelist)<br>
    attribs.options.disable_<wbr>shader_bit_encoding = FALSE;<br>
    attribs.options.force_s3tc_<wbr>enable = FALSE;<br>
    attribs.options.force_glsl_<wbr>version = 0;<br>
+   attribs.options.override_glsl_<wbr>version = 0;<br>
<br>
    osmesa_init_st_visual(&<wbr>attribs.visual,<br>
                          PIPE_FORMAT_R8G8B8A8_UNORM,<br>
diff --git a/src/mesa/drivers/dri/common/<wbr>drirc b/src/mesa/drivers/dri/common/<wbr>drirc<br>
index 20fd8123e4..52c121a064 100644<br>
--- a/src/mesa/drivers/dri/common/<wbr>drirc<br>
+++ b/src/mesa/drivers/dri/common/<wbr>drirc<br>
@@ -104,5 +104,9 @@ TODO: document the other workarounds.<br>
         <application name="Divinity: Original Sin Enhanced Edition" executable="EoCApp"><br>
             <option name="allow_glsl_extension_<wbr>directive_midshader" value="true" /><br>
         </application><br>
+<br>
+        <application name="ARK: Survival Evolved" executable="ShooterGame"><br>
+            <option name="override_glsl_version" value="320" /><br>
+        </application><br>
     </device><br>
 </driconf><br>
diff --git a/src/mesa/drivers/dri/common/<wbr>xmlpool/t_options.h b/src/mesa/drivers/dri/common/<wbr>xmlpool/t_options.h<br>
index a189bbedec..fb9ecbe3e7 100644<br>
--- a/src/mesa/drivers/dri/common/<wbr>xmlpool/t_options.h<br>
+++ b/src/mesa/drivers/dri/common/<wbr>xmlpool/t_options.h<br>
@@ -110,6 +110,11 @@ DRI_CONF_OPT_BEGIN_V(force_<wbr>glsl_version, int, def, "0:999") \<br>
         DRI_CONF_DESC(en,gettext("<wbr>Force a default GLSL version for shaders that lack an explicit #version line")) \<br>
 DRI_CONF_OPT_END<br>
<br>
+#define DRI_CONF_OVERRIDE_GLSL_<wbr>VERSION(def) \<br>
+DRI_CONF_OPT_BEGIN_V(<wbr>override_glsl_version, int, def, "0:999") \<br>
+        DRI_CONF_DESC(en,gettext("<wbr>Override the GLSL version for apps that require an explicit version")) \<br>
+DRI_CONF_OPT_END<br>
+<br>
 #define DRI_CONF_ALLOW_GLSL_EXTENSION_<wbr>DIRECTIVE_MIDSHADER(def) \<br>
 DRI_CONF_OPT_BEGIN_B(allow_<wbr>glsl_extension_directive_<wbr>midshader, def) \<br>
         DRI_CONF_DESC(en,gettext("<wbr>Allow GLSL #extension directives in the middle of shaders")) \<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_context.c b/src/mesa/drivers/dri/i965/<wbr>brw_context.c<br>
index 7240b1f445..373985ceb8 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_context.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_context.c<br>
@@ -910,6 +910,9 @@ brw_process_driconf_options(<wbr>struct brw_context *brw)<br>
    ctx->Const.ForceGLSLVersion =<br>
       driQueryOptioni(options, "force_glsl_version");<br>
<br>
+   ctx->Const.GLSLVersion =<br>
+      driQueryOptioni(options, "override_glsl_version");<br>
+<br>
    ctx->Const.<wbr>DisableGLSLLineContinuations =<br>
       driQueryOptionb(options, "disable_glsl_line_<wbr>continuations");<br>
<br>
diff --git a/src/mesa/state_tracker/st_<wbr>extensions.c b/src/mesa/state_tracker/st_<wbr>extensions.c<br>
index 293814e3ae..d534e8e5dc 100644<br>
--- a/src/mesa/state_tracker/st_<wbr>extensions.c<br>
+++ b/src/mesa/state_tracker/st_<wbr>extensions.c<br>
@@ -874,6 +874,9 @@ void st_init_extensions(struct pipe_screen *screen,<br>
<br>
    _mesa_override_glsl_version(<wbr>consts);<br>
<br>
+   if (options->override_glsl_<wbr>version > 0)<br>
+      consts->GLSLVersion = options->override_glsl_<wbr>version;<br>
+<br>
    if (options->force_glsl_version > 0 &&<br>
        options->force_glsl_version <= consts->GLSLVersion) {<br>
       consts->ForceGLSLVersion = options->force_glsl_version;<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.11.0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>