[Mesa-dev] [RFC PATCH 1/1] st/dri: add a new driconf option override_glsl_version for ARK games
Ian Romanick
idr at freedesktop.org
Thu Feb 9 12:40:05 UTC 2017
On 02/05/2017 02:13 PM, Samuel Pitoiset wrote:
>
>
> On 02/03/2017 07:24 PM, Jason Ekstrand wrote:
>> On Fri, Feb 3, 2017 at 9:23 AM, Samuel Pitoiset
>> <samuel.pitoiset at gmail.com <mailto:samuel.pitoiset at gmail.com>> wrote:
>>
>> This is similar to the MESA_GLSL_VERSION_OVERRIDE envvar (mainly
>> for developers). But this one has the advantage to be configured
>> for specific apps which require a context with an explicit version.
>>
>> For example, when an app requires a 3.2 core context, RadeonSI
>> will return a 4.5 context but this might fail (eg. ARK games).
>>
>>
>> Why is returning a 4.5 context a problem? It's supposed to be
>> more-or-less backwards compatible.
>>
>> 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?
>
> I think the best approach would be to return the context requested by
> the app. If it's 3.2 we should return a 3.2 context, not a 4.5. But the
> spec is a bit unclear about that...
There is 25 years of OpenGL history that you get the highest backwards
compatible version the implementation supports. The spec is quite clear:
If version 3.2 or greater is requested, the context returned may
implement any of the following versions:
* The requested profile of the requested version.
* The requested profile of any later version, so long as no
features have been removed from that later version and profile.
>> No need to add both "ARK: Survival Evolved" and "ARK: Survival
>> Of The Fittest" because the executable name is the same.
>>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com
>> <mailto:samuel.pitoiset at gmail.com>>
>> ---
>> src/gallium/include/state_tracker/st_api.h | 1 +
>> src/gallium/state_trackers/dri/dri_screen.c | 3 +++
>> src/gallium/state_trackers/osmesa/osmesa.c | 1 +
>> src/mesa/drivers/dri/common/drirc | 4 ++++
>> src/mesa/drivers/dri/common/xmlpool/t_options.h | 5 +++++
>> src/mesa/drivers/dri/i965/brw_context.c | 3 +++
>> src/mesa/state_tracker/st_extensions.c | 3 +++
>> 7 files changed, 20 insertions(+)
>>
>> diff --git a/src/gallium/include/state_tracker/st_api.h
>> b/src/gallium/include/state_tracker/st_api.h
>> index a2e37d2e48..e0a73d74ad 100644
>> --- a/src/gallium/include/state_tracker/st_api.h
>> +++ b/src/gallium/include/state_tracker/st_api.h
>> @@ -246,6 +246,7 @@ struct st_config_options
>> boolean force_s3tc_enable;
>> boolean allow_glsl_extension_directive_midshader;
>> boolean glsl_zero_init;
>> + unsigned override_glsl_version;
>> };
>>
>> /**
>> diff --git a/src/gallium/state_trackers/dri/dri_screen.c
>> b/src/gallium/state_trackers/dri/dri_screen.c
>> index a950f5241d..a1fa0a3be3 100644
>> --- a/src/gallium/state_trackers/dri/dri_screen.c
>> +++ b/src/gallium/state_trackers/dri/dri_screen.c
>> @@ -70,6 +70,7 @@ const __DRIconfigOptionsExtension
>> gallium_config_options = {
>> DRI_CONF_DISABLE_SHADER_BIT_ENCODING("false")
>> DRI_CONF_FORCE_GLSL_VERSION(0)
>> DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("false")
>> + DRI_CONF_OVERRIDE_GLSL_VERSION(0)
>> DRI_CONF_SECTION_END
>>
>> DRI_CONF_SECTION_MISCELLANEOUS
>> @@ -100,6 +101,8 @@ dri_fill_st_options(struct st_config_options
>> *options,
>> options->allow_glsl_extension_directive_midshader =
>> driQueryOptionb(optionCache,
>> "allow_glsl_extension_directive_midshader");
>> options->glsl_zero_init = driQueryOptionb(optionCache,
>> "glsl_zero_init");
>> + options->override_glsl_version =
>> + driQueryOptioni(optionCache, "override_glsl_version");
>> }
>>
>> static const __DRIconfig **
>> diff --git a/src/gallium/state_trackers/osmesa/osmesa.c
>> b/src/gallium/state_trackers/osmesa/osmesa.c
>> index 18f1b88128..8102be14ed 100644
>> --- a/src/gallium/state_trackers/osmesa/osmesa.c
>> +++ b/src/gallium/state_trackers/osmesa/osmesa.c
>> @@ -679,6 +679,7 @@ OSMesaCreateContextAttribs(const int
>> *attribList, OSMesaContext sharelist)
>> attribs.options.disable_shader_bit_encoding = FALSE;
>> attribs.options.force_s3tc_enable = FALSE;
>> attribs.options.force_glsl_version = 0;
>> + attribs.options.override_glsl_version = 0;
>>
>> osmesa_init_st_visual(&attribs.visual,
>> PIPE_FORMAT_R8G8B8A8_UNORM,
>> diff --git a/src/mesa/drivers/dri/common/drirc
>> b/src/mesa/drivers/dri/common/drirc
>> index 20fd8123e4..52c121a064 100644
>> --- a/src/mesa/drivers/dri/common/drirc
>> +++ b/src/mesa/drivers/dri/common/drirc
>> @@ -104,5 +104,9 @@ TODO: document the other workarounds.
>> <application name="Divinity: Original Sin Enhanced Edition"
>> executable="EoCApp">
>> <option name="allow_glsl_extension_directive_midshader"
>> value="true" />
>> </application>
>> +
>> + <application name="ARK: Survival Evolved"
>> executable="ShooterGame">
>> + <option name="override_glsl_version" value="320" />
>> + </application>
>> </device>
>> </driconf>
>> diff --git a/src/mesa/drivers/dri/common/xmlpool/t_options.h
>> b/src/mesa/drivers/dri/common/xmlpool/t_options.h
>> index a189bbedec..fb9ecbe3e7 100644
>> --- a/src/mesa/drivers/dri/common/xmlpool/t_options.h
>> +++ b/src/mesa/drivers/dri/common/xmlpool/t_options.h
>> @@ -110,6 +110,11 @@ DRI_CONF_OPT_BEGIN_V(force_glsl_version, int,
>> def, "0:999") \
>> DRI_CONF_DESC(en,gettext("Force a default GLSL version for
>> shaders that lack an explicit #version line")) \
>> DRI_CONF_OPT_END
>>
>> +#define DRI_CONF_OVERRIDE_GLSL_VERSION(def) \
>> +DRI_CONF_OPT_BEGIN_V(override_glsl_version, int, def, "0:999") \
>> + DRI_CONF_DESC(en,gettext("Override the GLSL version for
>> apps that require an explicit version")) \
>> +DRI_CONF_OPT_END
>> +
>> #define DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER(def) \
>> DRI_CONF_OPT_BEGIN_B(allow_glsl_extension_directive_midshader,
>> def) \
>> DRI_CONF_DESC(en,gettext("Allow GLSL #extension directives
>> in the middle of shaders")) \
>> diff --git a/src/mesa/drivers/dri/i965/brw_context.c
>> b/src/mesa/drivers/dri/i965/brw_context.c
>> index 7240b1f445..373985ceb8 100644
>> --- a/src/mesa/drivers/dri/i965/brw_context.c
>> +++ b/src/mesa/drivers/dri/i965/brw_context.c
>> @@ -910,6 +910,9 @@ brw_process_driconf_options(struct brw_context
>> *brw)
>> ctx->Const.ForceGLSLVersion =
>> driQueryOptioni(options, "force_glsl_version");
>>
>> + ctx->Const.GLSLVersion =
>> + driQueryOptioni(options, "override_glsl_version");
>> +
>> ctx->Const.DisableGLSLLineContinuations =
>> driQueryOptionb(options, "disable_glsl_line_continuations");
>>
>> diff --git a/src/mesa/state_tracker/st_extensions.c
>> b/src/mesa/state_tracker/st_extensions.c
>> index 293814e3ae..d534e8e5dc 100644
>> --- a/src/mesa/state_tracker/st_extensions.c
>> +++ b/src/mesa/state_tracker/st_extensions.c
>> @@ -874,6 +874,9 @@ void st_init_extensions(struct pipe_screen
>> *screen,
>>
>> _mesa_override_glsl_version(consts);
>>
>> + if (options->override_glsl_version > 0)
>> + consts->GLSLVersion = options->override_glsl_version;
>> +
>> if (options->force_glsl_version > 0 &&
>> options->force_glsl_version <= consts->GLSLVersion) {
>> consts->ForceGLSLVersion = options->force_glsl_version;
>> --
>> 2.11.0
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> <mailto:mesa-dev at lists.freedesktop.org>
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>> <https://lists.freedesktop.org/mailman/listinfo/mesa-dev>
>>
>>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
More information about the mesa-dev
mailing list