From 9c47c39687a320bedcc0d674ab963c38390ab5c5 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Wed, 29 Aug 2018 15:48:47 +1000 Subject: [PATCH] st/mesa, gallium: add a workaround for No Mans Sky MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The spec seems clear this is not allowed but the Nvidia binary forces apps to add layout qualifiers so this works around the issue for No Mans Sky until the CTS can be sorted out. Reviewed-by: Marek Olšák --- src/gallium/auxiliary/pipe-loader/driinfo_gallium.h | 1 + src/gallium/include/state_tracker/st_api.h | 1 + src/gallium/state_trackers/dri/dri_screen.c | 2 ++ src/mesa/state_tracker/st_extensions.c | 3 +++ src/util/00-mesa-defaults.conf | 1 + src/util/xmlpool/t_options.h | 5 +++++ 6 files changed, 13 insertions(+) diff --git a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h index b8f0fe64098..5f4305d91d7 100644 --- a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h +++ b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h @@ -29,6 +29,7 @@ DRI_CONF_SECTION_DEBUG DRI_CONF_ALLOW_HIGHER_COMPAT_VERSION("false") 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_SECTION_END DRI_CONF_SECTION_MISCELLANEOUS diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h index 8d386a82a63..61152e35468 100644 --- a/src/gallium/include/state_tracker/st_api.h +++ b/src/gallium/include/state_tracker/st_api.h @@ -228,6 +228,7 @@ struct st_config_options boolean glsl_zero_init; boolean force_glsl_abs_sqrt; boolean allow_glsl_cross_stage_interpolation_mismatch; + boolean allow_glsl_layout_qualifier_on_function_parameters; unsigned char config_options_sha1[20]; }; diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c index 3e4de59a433..027e85024f0 100644 --- a/src/gallium/state_trackers/dri/dri_screen.c +++ b/src/gallium/state_trackers/dri/dri_screen.c @@ -85,6 +85,8 @@ dri_fill_st_options(struct dri_screen *screen) driQueryOptionb(optionCache, "force_glsl_abs_sqrt"); options->allow_glsl_cross_stage_interpolation_mismatch = driQueryOptionb(optionCache, "allow_glsl_cross_stage_interpolation_mismatch"); + options->allow_glsl_layout_qualifier_on_function_parameters = + driQueryOptionb(optionCache, "allow_glsl_layout_qualifier_on_function_parameters"); driComputeOptionsSha1(optionCache, options->config_options_sha1); } diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 8483f7a2a72..29a32513085 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -1255,6 +1255,9 @@ void st_init_extensions(struct pipe_screen *screen, if (options->allow_glsl_relaxed_es) consts->AllowGLSLRelaxedES = GL_TRUE; + if (options->allow_glsl_layout_qualifier_on_function_parameters) + consts->AllowLayoutQualifiersOnFunctionParameters = GL_TRUE; + consts->MinMapBufferAlignment = screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT); diff --git a/src/util/00-mesa-defaults.conf b/src/util/00-mesa-defaults.conf index 5d15b3819fb..a68bc03027a 100644 --- a/src/util/00-mesa-defaults.conf +++ b/src/util/00-mesa-defaults.conf @@ -195,6 +195,7 @@ TODO: document the other workarounds.