protonscr

VKD3D_SWAPCHAIN_LATENCY_FRAMES causes bottleneck?

vkd3dclosed
HansKristian-Work/vkd3d-proton#1377 · opened 2023-01-14 by somewhatfrog · updated 2023-01-17 · 9 comments · github
Ssomewhatfrog 2023-01-14 github

Setting VKD3D_SWAPCHAIN_LATENCY_FRAMES=1 hits Elden Ring's performance and causes additional frame of input delay. Sadly I don't have any onther DX12 title to test this.

Tested at 4K resolution, so effect can be seen in framerate.
VKD3D_SWAPCHAIN_LATENCY_FRAMES=0 (or not set at all):
GPU ~93%
CPU ~16%
Avg. fps ~57

VKD3D_SWAPCHAIN_LATENCY_FRAMES=1:
GPU ~76%
CPU ~10%
Avg. fps ~43

Lowering the resolution to 1440p gives stable 60fps and allows for testing of input delay, setting this variable to 1 adds exactly 1 frame of input delay. (script in verbose mode simulates input of shield block, both kitty terminal window and game window are recorded with OBS, then the pause between the input and beginning of animation is manually counted in mpv)

Specs:
GPU 3060Ti (525.78)
CPU 5800X3D
Arch Zen 6.1.5
Proton Experimental (VKD3D 2.8.0/1.3.224)
i3wm
VSYNC OFF (no compositor and composition pipeline disabled)

HHansKristian-Work maintainer 2023-01-17 github

VKD3D_SWAPCHAIN_LATENCY_FRAMES=1 means there is no GPU <-> CPU overlap, so poor performance is expected.

VKD3D_SWAPCHAIN_LATENCY_FRAMES=0 disables the override.

Are you sure you're using a vkd3d-proton build that did not force-disable VK_KHR_present_wait on nvidia? Also, note that if you're not vsync bound (i.e. 1440p), LATENCY_FRAMES is not going to meaningfully reduce latency for you.

Ssomewhatfrog 2023-01-17 github

Are you sure you're using a vkd3d-proton build that did not force-disable VK_KHR_present_wait on nvidia?

Sorry, I don't know how to check, but I use the one provided by Proton Experimental.

Also, note that if you're not vsync bound (i.e. 1440p), LATENCY_FRAMES is not going to meaningfully reduce latency for you.

I have vsync disabled in both cases and LATENCY_FRAMES=1 increases the input delay. Which is opposite of what it should do.

HHansKristian-Work maintainer 2023-01-17 github

I have vsync disabled in both cases and LATENCY_FRAMES=1 increases the input delay. Which is opposite of what it should do.

Disabling vsync makes all of this somewhat moot. We use fallback paths to pump latency fences when vsync is disabled since it's not all that meaningful.

Mmbriar 2023-01-17 github

Doesn't it just increase delay for you because it (expectedly) reduces performance? I think the only case where setting it to 1 will reduce delay is if you are running vsynced and it is still rendering fast enough to hit the monitor's max refresh.

17 Jan 2023, 16:52 by @.***:

I have vsync disabled in both cases and LATENCY_FRAMES=1 increases the input delay. Which is opposite of what it should do.

Disabling vsync makes all of this somewhat moot.


Reply to this email directly, > view it on GitHub https://github.com/HansKristian-Work/vkd3d-proton/issues/1377#issuecomment-1385635376> , or > unsubscribe https://github.com/notifications/unsubscribe-auth/A3G6J6NEVEAOU27HITBCDZDWS252RANCNFSM6AAAAAAT3K6KVY> .
You are receiving this because you are subscribed to this thread.> Message ID: > <HansKristian-Work/vkd3d-proton/issues/1377/1385635376> @> github> .> com>

Ssomewhatfrog 2023-01-17 github

I see, so that means that as long as vsync is off it is better to not touch this variable at all.

I undestand that vkd3d and dxvk are completely different projects, just dxgi.maxFrameLatency = 1 didn't cause increase of input delay and I was confused when VKD3D_SWAPCHAIN_LATENCY_FRAMES=1 for some reason did.

Is there actually a benefit of using it with vsync compared to let's say just adding fps limit to prevent buffer from piling up https://blurbusters.com/howto-low-lag-vsync-on/ ?

HHansKristian-Work maintainer 2023-01-17 github

dxgi.maxFrameLatency = 1 didn't cause increase of input delay

DXVK and vkd3d-proton implementations of frame latency are very different.

Doesn't it just increase delay for you because it (expectedly) reduces performance?

Yes, that's where you get latency with IMMEDIATE in general.

HHansKristian-Work maintainer 2023-01-17 github

just adding fps limit to prevent buffer from piling up

If you have a CPU fps limiter that's below vsync rate, that's the most optimal way to get low latency, since you'll never build up a queue. The problem with that approach is horrible frame pacing usually, but a VRR monitor can clean that up.

Ssomewhatfrog 2023-01-17 github

Doesn't it just increase delay for you because it (expectedly) reduces performance? I think the only case where setting it to 1 will reduce delay is if you are running vsynced and it is still rendering fast enough to hit the monitor's max refresh. 17 Jan 2023, 16:52 by @.***:

I have vsync disabled in both cases and LATENCY_FRAMES=1 increases the input delay. Which is opposite of what it should do. > > Disabling vsync makes all of this somewhat moot. — Reply to this email directly, > view it on GitHub <[#1377 (comment)](https://github.com/HansKristian-Work/vkd3d-proton/issues/1377#issuecomment-1385635376)>> , or > unsubscribe https://github.com/notifications/unsubscribe-auth/A3G6J6NEVEAOU27HITBCDZDWS252RANCNFSM6AAAAAAT3K6KVY> . You are receiving this because you are subscribed to this thread.> Message ID: > <HansKristian-Work/vkd3d-proton/issues/1377/1385635376> @> github> .> com>

I did input lag tests when game has no issues running at 60fps with a huge headroom.

Ssomewhatfrog 2023-01-17 github

just adding fps limit to prevent buffer from piling up

If you have a CPU fps limiter that's below vsync rate, that's the most optimal way to get low latency, since you'll never build up a queue. The problem with that approach is horrible frame pacing usually, but a VRR monitor can clean that up.

Gotcha, thank you. I will close the issue then.