util/driconf: add Dune: Spice Wars workaround

As per the bug report the game does not correctly handle a uniform
index of -1 being returned for the unused array element, which
results in rendering issues. So here we skip the uniform array
resizing optimisation.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6397
Cc: mesa-stable

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20579>
This commit is contained in:
Timothy Arceri
2023-01-09 14:12:52 +11:00
committed by Marge Bot
parent e986d8c337
commit ac5af6c06d
8 changed files with 20 additions and 1 deletions

View File

@@ -1541,7 +1541,7 @@ gl_nir_link_uniforms(const struct gl_constants *consts,
/* Iterate through all linked shaders */
struct nir_link_uniforms_state state = {0,};
if (!prog->data->spirv) {
if (!prog->data->spirv && !consts->DisableUniformArrayResize) {
/* Gather information on uniform use */
for (unsigned stage = 0; stage < MESA_SHADER_STAGES; stage++) {
struct gl_linked_shader *sh = prog->_LinkedShaders[stage];

View File

@@ -18,6 +18,7 @@ DRI_CONF_SECTION_DEBUG
DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS(false)
DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED(false)
DRI_CONF_DISABLE_ARB_GPU_SHADER5(false)
DRI_CONF_DISABLE_UNIFORM_ARRAY_RESIZE(false)
DRI_CONF_FORCE_GLSL_VERSION(0)
DRI_CONF_ALLOW_EXTRA_PP_TOKENS(false)
DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER(false)

View File

@@ -41,6 +41,7 @@ u_driconf_fill_st_options(struct st_config_options *options,
query_bool_option(disable_blend_func_extended);
query_bool_option(disable_arb_gpu_shader5);
query_bool_option(disable_glsl_line_continuations);
query_bool_option(disable_uniform_array_resize);
query_bool_option(force_compat_shaders);
query_bool_option(force_glsl_extensions_warn);
query_int_option(force_glsl_version);

View File

@@ -170,6 +170,7 @@ struct st_config_options
bool disable_blend_func_extended;
bool disable_glsl_line_continuations;
bool disable_arb_gpu_shader5;
bool disable_uniform_array_resize;
bool force_compat_shaders;
bool force_glsl_extensions_warn;
unsigned force_glsl_version;

View File

@@ -794,6 +794,11 @@ struct gl_constants
*/
GLboolean DisableTransformFeedbackPacking;
/**
* Disable the glsl optimisation that resizes uniform arrays.
*/
bool DisableUniformArrayResize;
/**
* Align varyings to POT in a slot
*

View File

@@ -1471,6 +1471,9 @@ void st_init_extensions(struct pipe_screen *screen,
if (options->disable_glsl_line_continuations)
consts->DisableGLSLLineContinuations = 1;
if (options->disable_uniform_array_resize)
consts->DisableUniformArrayResize = 1;
if (options->allow_glsl_extension_directive_midshader)
consts->AllowGLSLExtensionDirectiveMidShader = GL_TRUE;

View File

@@ -149,6 +149,10 @@ TODO: document the other workarounds.
<option name="force_glsl_extensions_warn" value="true" />
</application>
<application name="Dune: Spice Wars" executable="D4X.exe">
<option name="disable_uniform_array_resize" value="true" />
</application>
<application name="Dying Light" executable="DyingLightGame">
<option name="allow_glsl_builtin_variable_redeclaration" value="true" />
</application>

View File

@@ -164,6 +164,10 @@
DRI_CONF_OPT_B(disable_glsl_line_continuations, def, \
"Disable backslash-based line continuations in GLSL source")
#define DRI_CONF_DISABLE_UNIFORM_ARRAY_RESIZE(def) \
DRI_CONF_OPT_B(disable_uniform_array_resize, def, \
"Disable the glsl optimisation that resizes uniform arrays")
#define DRI_CONF_FORCE_GLSL_VERSION(def) \
DRI_CONF_OPT_I(force_glsl_version, def, 0, 999, \
"Force a default GLSL version for shaders that lack an explicit #version line")