Mesa (master): st/dri: add a drirc workaround for Rocket League
Marek Olšák
mareko at kemper.freedesktop.org
Fri Jun 23 17:51:30 UTC 2017
Module: Mesa
Branch: master
Commit: 118b2008ba18d6cf5d511e0a0bacbb846aad6982
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=118b2008ba18d6cf5d511e0a0bacbb846aad6982
Author: Marek Olšák <marek.olsak at amd.com>
Date: Tue Jun 20 22:44:53 2017 +0200
st/dri: add a drirc workaround for Rocket League
This needs to be passed to gallium drivers.
No game fix is planned at this time.
The addition of glsl_correct_derivatives_after_discard is
generally a good thing for mesa compatibility with the broader GL
driver ecosystem.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100070
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
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 b195af4439..2ccdf44bfe 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -390,6 +390,12 @@ enum pipe_flush_flags
*/
#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.
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index 1b414b28d1..aa215b09a2 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -80,6 +80,7 @@ const __DRIconfigOptionsExtension gallium_config_options = {
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
@@ -473,6 +474,10 @@ dri_init_options_get_screen_flags(struct dri_screen *screen,
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;
}
diff --git a/src/mesa/drivers/dri/common/drirc b/src/mesa/drivers/dri/common/drirc
index 5152b207eb..7d73b1218b 100644
--- a/src/mesa/drivers/dri/common/drirc
+++ b/src/mesa/drivers/dri/common/drirc
@@ -151,6 +151,10 @@ TODO: document the other workarounds.
<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">
diff --git a/src/mesa/drivers/dri/common/xmlpool/t_options.h b/src/mesa/drivers/dri/common/xmlpool/t_options.h
index 8a7d04f00f..9aa1798b9d 100644
--- a/src/mesa/drivers/dri/common/xmlpool/t_options.h
+++ b/src/mesa/drivers/dri/common/xmlpool/t_options.h
@@ -130,6 +130,10 @@ 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
/**
More information about the mesa-commit
mailing list