anv: use D3D-compatible texturing for Proton

Intel & AMD Direct3D drivers modify their rounding behaviour for texturing to
match Direct3D expectations. Such behaviour is not conformant in Vulkan, and
Intel hardware lacks a reasonable way to get NVIDIA's behaviour (which uniquely
works for Vulkan & Direct3D). The second best choice is to use
Direct3D-compatible behaviour for Proton (via driconf) and our current
Vulkan-conformant behaviour everywhere else. Given the APIs diverge and there is
no Vulkan extension to control the behaviour explicitly, driconf'ing on the
engineName is the reasonable solution.

anv already has a anv_force_filter_addr_rounding driconf option to force
Direct3D behaviour for certain Direct3D titles. Here we simply apply it to all
D3D10+ titles, aligning us with the Windows driver.

Note that D3D9 does not have this behaviour. We therefore use standard Vulkan
behaviour for D3D9 to avoid breaking D3D9 titles, even though the engineName is
the same as D3D10+.

This is the same solution radv uses, they call it radv_disable_trunc_coord. We
could unify the driconf entries later.

See https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38098#note_3166306
for a more detailed analysis, as well as the linked references:

   https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27337
   https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25911
   https://github.com/HansKristian-Work/vkd3d-proton/pull/1884

This fixes misrendering in piles of Direct3D games run on anv via Proton,
including Assassin's Creed Valhalla.

Cc: mesa-stable
Closes: #13886
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Co-authored-by: Calder Young <cgiacun@gmail.com>
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38114>
This commit is contained in:
Alyssa Rosenzweig 2025-10-28 13:02:59 -04:00 committed by Marge Bot
parent ece66be5a1
commit 7a71952762
2 changed files with 14 additions and 11 deletions

View file

@ -221,6 +221,18 @@ anv_init_dri_options(struct anv_instance *instance)
instance->lower_terminate_to_discard =
driQueryOptionb(&instance->dri_options, "vk_lower_terminate_to_discard");
if (instance->vk.app_info.engine_name &&
!strcmp(instance->vk.app_info.engine_name, "DXVK")) {
/* Since 2.3.1+, DXVK uses the application version to signal D3D9. */
const bool is_d3d9 = instance->vk.app_info.app_version & 0x1;
/* This driconf bit enables D3D10+ behaviour for texture coordinate
* rounding. As D3D9 wants the Vulkan behaviour instead, apply the
* workaround only to D3D10+.
*/
instance->force_filter_addr_rounding &= !is_d3d9;
}
instance->stack_ids = driQueryOptioni(&instance->dri_options, "intel_stack_id");
switch (instance->stack_ids) {
case 256:

View file

@ -1009,18 +1009,9 @@ TODO: document the other workarounds.
<application name="Armored Core 6" executable="armoredcore6.exe">
<option name="fake_sparse" value="true" />
</application>
<application name="Age of Empires IV" executable="RelicCardinal.exe">
<engine engine_name_match="vkd3d|DXVK">
<option name="anv_force_filter_addr_rounding" value="true" />
</application>
<application name="Dynasty Warriors: Origins" executable="DWORIGINS.exe">
<option name="anv_force_filter_addr_rounding" value="true" />
</application>
<application name="EVE Online" executable="exefile.exe">
<option name="anv_force_filter_addr_rounding" value="true" />
</application>
<application name="Heroes Of Valor" executable="HeroesOfValor-Win64-Shipping.exe">
<option name="anv_force_filter_addr_rounding" value="true" />
</application>
</engine>
<!-- Needed to avoid XeSS code paths. -->
<application name="Marvel's Spider-Man Remastered" executable="Spider-Man.exe">
<option name="force_vk_vendor" value="-1" />