Page 1 of 1

Vulkan API "tearFree" method

Posted: 13 May 2020, 17:49
by xyGvot
Hi there!
Long time lurker, finally decided to make an account just to bring your attention to this interesting development.

As some of you know, DXVK is a juggernaut effort made primarily by doitsujin and Joshua Ashton among others, even banked by Valve itself (it is afterall, the backbone upon which Proton runs); its main purpose is to translate D3D9, D3D10 and D3D11/DXGI to Vulkan via a layer/wrapper and allow 3D apps to run natively on Linux.

A few months ago, a Windows 10 user, frustrated by how his Radeon 5700 XT was performing on Sekiro, grabbed the latest release of DXVK then and just threw the dlls in the game's folder, to his surprise, the game ran and performed way better than previously.
It's not a silver bullet to bad performance, but it's worth a shot if you're struggling or suspect bad optimization (it works wonders in the Borderlands games, haha!).

Note: The project is not aimed at Windows nor offers support for users running the OS, it's not their focus.

With the surprising performance benefits on Windows and almost universal compatibility (most Unity games won't launch in my testing since they still call to native System32/SysWOW64 DirectX libraries, crashing), I started to follow the project closely out of curiosity.

Just the most recent version (1.6.1) added a new setting called "tearFree" that calls a particular Vulkan function; from their release log:
Added dxgi.tearFree option to enforce the Mailbox present mode when Vsync is disabled, which should prevent tearing. May not work on all setups.
The setting was only available for DXGI/10/11 games, but almost 2 weeks ago, another contributor opened the option for D3D9, which is already merged in the daily builds.

DXVK uses a configuration file which you put, along with the dlls, next to the game's exe.

tearFree's entry in the config file reads as follows:
# True enables the mailbox present mode in case regular Vsync is disabled.
# This should avoid tearing, but may be unsupported on some systems
# or require setting dxgi.numBackBuffers to a higher value in order
# to work properly.
#
# False enables the relaxed fifo present mode in case regular Vsync is enabled.
# This should result in tearing but reduce stutter if FPS are too low,
# but may be unsupported on some systems.
#
# Please do not report issues with this option.
#
# Supported values: Auto, True, False
I've been testing the setting on True, forcing VSync to off in NVCP and running games on my TV which is not VRR and it works!
I do have to limit the framerate to my refreshrate via RTSS, otherwise there's tearing, but the result is impressive!
Edit: I was wrong, frame limiting isn't necessary, presentation still shows no tearing when framerate is above the refresh rate.

My limited knowledge in the matter tells me it works in a way similar to Fastsync without the penalties that that method incurs, since it's part of the API itself and not an external solution, and I do wonder if DX12 has some such option in its code.

And well, that's about it, I invite you to give it a shot.

PD: I think it's obvious, but don't try to use it on multiplayer games/games with anti-cheat.

Vulkan API "tearFree" method

Posted: 17 May 2020, 14:07
by Chief Blur Buster
xyGvot wrote:
13 May 2020, 17:49
Hi there!
Long time lurker, finally decided to make an account just to bring your attention to this interesting development.
Appreciate you posting this!

I have moved this to the Programming forum, since this is a programming topic, and will probably get more reads/viewership there. Many lurkers are probably interested in this finding;
xyGvot wrote:
13 May 2020, 17:49
My limited knowledge in the matter tells me it works in a way similar to Fastsync without the penalties that that method incurs, since it's part of the API itself and not an external solution, and I do wonder if DX12 has some such option in its code.
Yes, the tear-free method would be similar to Fast Sync or Enhanced Sync.

Very interesting development; appreciate you for posting this!

Re: Vulkan API "tearFree" method

Posted: 17 May 2020, 19:02
by nuninho1980
Yeah but we think this method software may impact performance of CPU and/or GPU. Therefore, I stay VSYNC enabled. You enable G-SYNC or FreeSync, if you don't want method software. ;)