drirc: Set vs_position_always_invariant for Shadow of Mordor on Intel
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 22 Nov 2019 09:37:02 +0000 (01:37 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 27 Nov 2019 18:48:04 +0000 (18:48 +0000)
When drawing the main character in Shadow of Mordor, the game appears
to draw Talion with one vertex shader, and the Wraith with another.
If the compiler optimizes those in different ways which lead to slight
imprecisions, then the resulting positions may not line up, leading to
Z-fighting occurring as the game decides which of the two are in front.

brw_nir_opt_peephole_ffma looks at usages of multiply adds across the
entire shader, and may make different decisions between the two, leading
to such imprecisions and Z-fighting.  This started happening recently
after a NIR change to eliminate unnecessary MOVs (7025dbe7), but that
change simply exposed the existing problem.

Improves performance on Skylake GT4e by 1.22945% +/- 0.398672% (n=3),
likely due to the fixed rendering.

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1985
Fixes: 7025dbe794b ("nir: Skip emitting no-op movs from the builder.")
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/util/00-mesa-defaults.conf

index 734161650b7d2a6782dba545f2d8713812bd3459..de1ef3d7131ecb33df34970742bc49a9f30469c9 100644 (file)
@@ -580,4 +580,14 @@ TODO: document the other workarounds.
             <option name="gles_emulate_bgra" value="true" />
         </application>
     </device>
+    <device driver="i965">
+        <application name="Middle Earth: Shadow of Mordor" executable="ShadowOfMordor">
+            <option name="vs_position_always_invariant" value="true" />
+        </application>
+    </device>
+    <device driver="iris">
+        <application name="Middle Earth: Shadow of Mordor" executable="ShadowOfMordor">
+            <option name="vs_position_always_invariant" value="true" />
+        </application>
+    </device>
 </driconf>