[Mesa-dev] [PATCH 3/5] st/dri: add a drirc workaround for Rocket League

Marek Olšák maraeo at gmail.com
Tue Jun 20 22:54:39 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

This needs to be passed to gallium drivers.
---
 src/gallium/include/pipe/p_defines.h            | 6 ++++++
 src/gallium/state_trackers/dri/dri_screen.c     | 5 +++++
 src/mesa/drivers/dri/common/drirc               | 4 ++++
 src/mesa/drivers/dri/common/xmlpool/t_options.h | 4 ++++
 4 files changed, 19 insertions(+)

diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index b195af4..2ccdf44 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -383,20 +383,26 @@ enum pipe_flush_flags
  */
 #define PIPE_CONTEXT_ROBUST_BUFFER_ACCESS (1 << 2)
 
 /**
  * Prefer threaded pipe_context. It also implies that video codec functions
  * will not be used. (they will be either no-ops or NULL when threading is
  * enabled)
  */
 #define PIPE_CONTEXT_PREFER_THREADED   (1 << 3)
 
+/**
+ * Implicit and explicit derivatives after KILL behave as if KILL didn't
+ * happen.
+ */
+#define PIPE_SCREEN_ENABLE_CORRECT_TGSI_DERIVATIVES_AFTER_KILL (1 << 0)
+
 
 /**
  * Flags for pipe_context::memory_barrier.
  */
 #define PIPE_BARRIER_MAPPED_BUFFER     (1 << 0)
 #define PIPE_BARRIER_SHADER_BUFFER     (1 << 1)
 #define PIPE_BARRIER_QUERY_BUFFER      (1 << 2)
 #define PIPE_BARRIER_VERTEX_BUFFER     (1 << 3)
 #define PIPE_BARRIER_INDEX_BUFFER      (1 << 4)
 #define PIPE_BARRIER_CONSTANT_BUFFER   (1 << 5)
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index 1b414b2..aa215b0 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -73,20 +73,21 @@ const __DRIconfigOptionsExtension gallium_config_options = {
       DRI_CONF_SECTION_DEBUG
          DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN("false")
          DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS("false")
          DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED("false")
          DRI_CONF_DISABLE_SHADER_BIT_ENCODING("false")
          DRI_CONF_FORCE_GLSL_VERSION(0)
          DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER("false")
          DRI_CONF_ALLOW_GLSL_BUILTIN_VARIABLE_REDECLARATION("false")
          DRI_CONF_ALLOW_HIGHER_COMPAT_VERSION("false")
          DRI_CONF_FORCE_GLSL_ABS_SQRT("false")
+         DRI_CONF_GLSL_CORRECT_DERIVATIVES_AFTER_DISCARD("false")
       DRI_CONF_SECTION_END
 
       DRI_CONF_SECTION_MISCELLANEOUS
          DRI_CONF_ALWAYS_HAVE_DEPTH_BUFFER("false")
          DRI_CONF_GLSL_ZERO_INIT("false")
       DRI_CONF_SECTION_END
    DRI_CONF_END
 };
 
 #define false 0
@@ -466,20 +467,24 @@ dri_init_options_get_screen_flags(struct dri_screen *screen,
 {
    unsigned flags = 0;
 
    driParseOptionInfo(&screen->optionCacheDefaults, gallium_config_options.xml);
    driParseConfigFiles(&screen->optionCache,
                        &screen->optionCacheDefaults,
                        screen->sPriv->myNum,
                        driver_name);
    dri_fill_st_options(screen);
 
+   if (driQueryOptionb(&screen->optionCache,
+                       "glsl_correct_derivatives_after_discard"))
+      flags |= PIPE_SCREEN_ENABLE_CORRECT_TGSI_DERIVATIVES_AFTER_KILL;
+
    return flags;
 }
 
 const __DRIconfig **
 dri_init_screen_helper(struct dri_screen *screen,
                        struct pipe_screen *pscreen)
 {
    screen->base.screen = pscreen;
    screen->base.get_egl_image = dri_get_egl_image;
    screen->base.get_param = dri_get_param;
diff --git a/src/mesa/drivers/dri/common/drirc b/src/mesa/drivers/dri/common/drirc
index 5152b20..7d73b12 100644
--- a/src/mesa/drivers/dri/common/drirc
+++ b/src/mesa/drivers/dri/common/drirc
@@ -144,20 +144,24 @@ TODO: document the other workarounds.
             <option name="force_glsl_abs_sqrt" value="true" />
         </application>
 
         <application name="Kerbal Space Program (32-bit)" executable="KSP.x86">
             <option name="glsl_zero_init" value="true"/>
         </application>
 
         <application name="Kerbal Space Program (64-bit)" executable="KSP.x86_64">
             <option name="glsl_zero_init" value="true"/>
         </application>
+
+        <application name="Rocket League" executable="RocketLeague">
+            <option name="glsl_correct_derivatives_after_discard" value="true"/>
+        </application>
     </device>
     <!-- vmwgfx doesn't like full buffer swaps and can't sync to vertical retraces.-->
     <device driver="vmwgfx">
         <application name="gnome-shell" executable="gnome-shell">
             <option name="glx_disable_ext_buffer_age" value="true" />
             <option name="glx_disable_oml_sync_control" value="true" />
         </application>
 	<application name="Compiz" executable="Compiz">
             <option name="glx_disable_ext_buffer_age" value="true" />
 	    <option name="glx_disable_oml_sync_control" value="true" />
diff --git a/src/mesa/drivers/dri/common/xmlpool/t_options.h b/src/mesa/drivers/dri/common/xmlpool/t_options.h
index 8a7d04f..9aa1798 100644
--- a/src/mesa/drivers/dri/common/xmlpool/t_options.h
+++ b/src/mesa/drivers/dri/common/xmlpool/t_options.h
@@ -123,20 +123,24 @@ DRI_CONF_OPT_END
 #define DRI_CONF_ALLOW_HIGHER_COMPAT_VERSION(def) \
 DRI_CONF_OPT_BEGIN_B(allow_higher_compat_version, def) \
         DRI_CONF_DESC(en,gettext("Allow a higher compat profile (version 3.1+) for apps that request it")) \
 DRI_CONF_OPT_END
 
 #define DRI_CONF_FORCE_GLSL_ABS_SQRT(def) \
 DRI_CONF_OPT_BEGIN_B(force_glsl_abs_sqrt, def) \
         DRI_CONF_DESC(en,gettext("Force computing the absolute value for sqrt() and inversesqrt()")) \
 DRI_CONF_OPT_END
 
+#define DRI_CONF_GLSL_CORRECT_DERIVATIVES_AFTER_DISCARD(def) \
+DRI_CONF_OPT_BEGIN_B(glsl_correct_derivatives_after_discard, def) \
+        DRI_CONF_DESC(en,gettext("Implicit and explicit derivatives after a discard behave as if the discard didn't happen")) \
+DRI_CONF_OPT_END
 
 
 /**
  * \brief Image quality-related options
  */
 #define DRI_CONF_SECTION_QUALITY \
 DRI_CONF_SECTION_BEGIN \
 	DRI_CONF_DESC(en,gettext("Image Quality"))
 
 #define DRI_CONF_EXCESS_MIPMAP(def) \
-- 
2.7.4



More information about the mesa-dev mailing list