st/mesa, gallium: add a workaround for No Mans Sky
authorTimothy Arceri <tarceri@itsqueeze.com>
Wed, 29 Aug 2018 05:48:47 +0000 (15:48 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Wed, 29 Aug 2018 23:54:40 +0000 (09:54 +1000)
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 <marek.olsak@amd.com>
src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
src/gallium/include/state_tracker/st_api.h
src/gallium/state_trackers/dri/dri_screen.c
src/mesa/state_tracker/st_extensions.c
src/util/00-mesa-defaults.conf
src/util/xmlpool/t_options.h

index b8f0fe640982e78ff756f4bc9b1189e636711d14..5f4305d91d71240baa21b4282fec3da2345f48d3 100644 (file)
@@ -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
index 8d386a82a63c878854cd34092de22ce048655bfd..61152e3546860930fa66fe0a8c37c265108f0953 100644 (file)
@@ -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];
 };
 
index 3e4de59a43340cadd56b03259e2df3d01f89a9ad..027e85024f02704b794eb53cb6e24a98b90783dd 100644 (file)
@@ -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);
 }
index 8483f7a2a72da9a03c671527a49f6a6fff6fd889..29a32513085b9decfe0ca4bc971430fd122841ba 100644 (file)
@@ -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);
 
index 5d15b3819fb6b6272abbbdb4a59751d7512c3e1f..a68bc03027a929833cd81836fa00a95f0a59d1b7 100644 (file)
@@ -195,6 +195,7 @@ TODO: document the other workarounds.
 
         <application name="No Mans Sky" executable="NMS.exe">
             <option name="force_glsl_extensions_warn" value="true" />
+            <option name="allow_glsl_layout_qualifier_on_function_parameters" value="true" />
         </application>
 
         <!-- The GL thread whitelist is below, workarounds are above.
index 945d0e60f901df3e260b95d4e565f0c72aebcfbf..b6f7eed80b167b9d3aa4c4fb9465b828bc468cf1 100644 (file)
@@ -135,6 +135,11 @@ DRI_CONF_OPT_BEGIN_B(allow_glsl_cross_stage_interpolation_mismatch, def) \
         DRI_CONF_DESC(en,gettext("Allow interpolation qualifier mismatch across shader stages")) \
 DRI_CONF_OPT_END
 
+#define DRI_CONF_ALLOW_GLSL_LAYOUT_QUALIFIER_ON_FUNCTION_PARAMETERS(def) \
+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
+
 /**
  * \brief Image quality-related options
  */