Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Framerate locked at 59 FPS. #4548

Open
TheDeeGee opened this issue Dec 24, 2024 · 22 comments
Open

Framerate locked at 59 FPS. #4548

TheDeeGee opened this issue Dec 24, 2024 · 22 comments
Labels

Comments

@TheDeeGee
Copy link

Framerate is locked at 59 FPS regardless of settings.

Disabling the FPS limiter and V-Sync in the NVIDIA Control Panel does nothing, nor does setting the game to Unlimited and disabling V-Sync there.

Software information

Borderlands 2, maximum settings.

System information

  • GPU: 4070 Ti
  • Driver: 566.36
  • DXVK version: 2.5.2
  • OS: Windows 10 Pro 22H2
@Blisto91
Copy link
Contributor

Hi there. Please attach the log that appears next to the exe

@qinlili23333
Copy link
Contributor

You are using 60HZ display as main display on Windows, right? That should be the normal behavior. On my 64hz display it runs at 63.9fps which is the same behavior. And if I set my 240hz display as main display it can go up to 241fps.
Currently, DXVK only use DWM GDI Copy compose for d3d9 since #4485. In this mode, the frame is rendered and then copied by DWM to display. DWM copy rate is limited by refresh rate, so sometimes DWM may also limit the application to its copy rate since all frames exceed DWM copy rate are dropped and useless.

If your system has multiple displays with different refresh rate and you are using the highest one for gaming, ensure you set the one with highest refresh rate as main display in system settings. Main display is the default display for your system. Your current main display should have a grey tick for "Mak this my main display".
image

If you are using the system I said above, then this is not DXVK's bug and this issue can be closed.

@TheDeeGee
Copy link
Author

You are using 60HZ display as main display on Windows, right? That should be the normal behavior. On my 64hz display it runs at 63.9fps which is the same behavior. And if I set my 240hz display as main display it can go up to 241fps. Currently, DXVK only use DWM GDI Copy compose for d3d9 since #4485. In this mode, the frame is rendered and then copied by DWM to display. DWM copy rate is limited by refresh rate, so sometimes DWM may also limit the application to its copy rate since all frames exceed DWM copy rate are dropped and useless.

If your system has multiple displays with different refresh rate and you are using the highest one for gaming, ensure you set the one with highest refresh rate as main display in system settings. Main display is the default display for your system. Your current main display should have a grey tick for "Mak this my main display". image

If you are using the system I said above, then this is not DXVK's bug and this issue can be closed.

My Display is 60 HZ (59.950) yes, it's a EIZO CX240.

NVIDIA RTX Remix also uses Vulkan and does not have this behaviour.

If this is the default behaviour of the wrapper, then i'll just ignore that this wrapper exists as it's pretty useless for me then.

Thanks anyway for the explanation.

@Blisto91
Copy link
Contributor

Blisto91 commented Dec 26, 2024

It isn't unless vsync is enabled.

Edit: I did a quick check here on Windows with Intel and it seems to be working fine.

Screenshot

image

@TheDeeGee
Copy link
Author

It isn't unless vsync is enabled.

Edit: I did a quick check here on Windows with Intel and it seems to be working fine.

Screenshot
image

Maybe it's an NVIDIA issue then.

@Blisto91
Copy link
Contributor

You can force vsync off by putting d3d9.presentInterval = 0 in a dxvk.conf file next to the exe

@TheDeeGee
Copy link
Author

You can force vsync off by putting d3d9.presentInterval = 0 in a dxvk.conf file next to the exe

Yeah well, that will mean screen tearing anyways, which is even worse.

I'll just stick to DX9, i have a 4070 Ti anyways, it runs just fine in 4K.

@qinlili23333
Copy link
Contributor

Maybe it's an NVIDIA issue then.

Probably. I can reproduce same behavior on my two NVIDIA devices.
NVIDIA drivers will detect DXVK and apply some "optimization" (you can find DXVK strings in driver files), maybe that's why Intel systems won't have same behavior.
I didn't test on Intel systems as my Intel device is heavily throttled and cannot reach 60 FPS.

@Blisto91
Copy link
Contributor

Blisto91 commented Dec 27, 2024

I am not reproducing any issues on Nvidia Windows either fwiw

Screenshot

image

@K0bin
Copy link
Collaborator

K0bin commented Dec 27, 2024

Make sure you're not running any additional overlays or other applications that somehow hook into games.

@TheDeeGee
Copy link
Author

Make sure you're not running any additional overlays or other applications that somehow hook into games.

When i first noticed (felt it) no overlay was running. Then the second time i used RTSS to confirm my findings.

Also Vulkan in GZDoom doesn't suffer from this either, it's purely this wrapper.

@TheDeeGee
Copy link
Author

TheDeeGee commented Dec 27, 2024

I think i found out the what the problem was/is.

A mod to change the viewmodel of weapons (make them smaller), which also comes with ddraw.dll in the Win32 folder.

It's not super smooth though, there is camera skipping with mouse movement, which isn't present in DX9.

@qinlili23333
Copy link
Contributor

qinlili23333 commented Dec 28, 2024

I have found why I can reproduce this issue.
I am using GSYNC monitors for my system and I have enabled GSYNC support for both window and fullscreen mode. So NVIDIA driver actively limit DWM render rate to ensure GSYNC working in windowed mode since composition is done by DWM.
Move the window to another monitor without GSYNC or disable GSYNC for windowed mode can solve this.
GSYNC is not binded to normal vsync, so vsync off won't solve this issue. In exclusive fullscreen, GYSNC uses another way since DWM won't compose the output (hardware composed or legacy flip) so this limit won't appear.
After disabling GSYNC, the game can now reach over 100 fps on my system.
This won't happen on most native Vulkan games, since NVIDIA put Vulkan games on DXGI swapchain by default now, which makes these games in hardware composed output instead of GDI copy.
Reference: https://forums.blurbusters.com/viewtopic.php?t=10099

@TheDeeGee Are you also using GSYNC?

@TheDeeGee
Copy link
Author

TheDeeGee commented Dec 28, 2024

I have found why I can reproduce this issue. I am using GSYNC monitors for my system and I have enabled GSYNC support for both window and fullscreen mode. So NVIDIA driver actively limit DWM render rate to ensure GSYNC working in windowed mode since composition is done by DWM. Move the window to another monitor without GSYNC or disable GSYNC for windowed mode can solve this. GSYNC is not binded to normal vsync, so vsync off won't solve this issue. In exclusive fullscreen, GYSNC uses another way since DWM won't compose the output (hardware composed or legacy flip) so this limit won't appear. After disabling GSYNC, the game can now reach over 100 fps on my system. This won't happen on most native Vulkan games, since NVIDIA put Vulkan games on DXGI swapchain by default now, which makes these games in hardware composed output instead of GDI copy. Reference: https://forums.blurbusters.com/viewtopic.php?t=10099

@TheDeeGee Are you also using GSYNC?

EIZO CX240, which doesn't have any gaming features. It's 60 Hz photo editing minitor.

Anyways, the problem was a mod for Borderlands 2.

Still isn't smooth though, there is camera skipping with mouse movement, which doesn't happen in DX9.

@De-M-oN
Copy link

De-M-oN commented Jan 1, 2025

You are using 60HZ display as main display on Windows, right? That should be the normal behavior. On my 64hz display it runs at 63.9fps which is the same behavior. And if I set my 240hz display as main display it can go up to 241fps. Currently, DXVK only use DWM GDI Copy compose for d3d9 since #4485. In this mode, the frame is rendered and then copied by DWM to display. DWM copy rate is limited by refresh rate, so sometimes DWM may also limit the application to its copy rate since all frames exceed DWM copy rate are dropped and useless.

If your system has multiple displays with different refresh rate and you are using the highest one for gaming, ensure you set the one with highest refresh rate as main display in system settings. Main display is the default display for your system. Your current main display should have a grey tick for "Mak this my main display". image

If you are using the system I said above, then this is not DXVK's bug and this issue can be closed.

this issue doesnt exist at exclusive fullscreen mode.
I've seen in changelog of 2.5.2 that you now force borderless. If that is the case I hope we can force it back to exclusive or we have to stay at 2.5.1

edit: I didnt read the thread fully yet. Ok apparently there might be still a chance to get uncapped fps despite borderless with the vulkan api?
I will check later then. At the moment my pc is busy with a video encode

@doitsujin
Copy link
Owner

doitsujin commented Jan 1, 2025

Vulkan WSI is fundamentally broken on Windows (HDR does not work, VRR does not work, alt+tab does not work in fullscreen unless we prevent a mode switch, ...), issues like these are outside our control. The only way to improve this situation is to add a D3D12 backend for presentation, but that is not a priority right now.

@qinlili23333
Copy link
Contributor

qinlili23333 commented Jan 2, 2025

If that is the case I hope we can force it back to exclusive

Exclusive fullscreen has already introduced tons of compatibility issues that cannot be fixed without complex workarounds which mess the code. That's why it's globally removed now.

Ok apparently there might be still a chance to get uncapped fps despite borderless with the vulkan api?

You can disable GSYNC to get uncapped fps, but with tears. For my own suggestion, uncapped fps only makes your system a heater, it's more important to minimize latency when your system can provide higher fps than refresh rate. An optimized 59fps actually is better than uncapped 300+fps if your monitor is only 60hz. My own tweak: 64.01hz GSYNC compatible monitor, low latency mode on, fps capped 63 with RTSS, vsync off, got 20-25ms latency only in most games.

And I agree with "Vulkan WSI is broken on WIndows", even native Vulkan games may suffer various issues, such as DOOM 2016, which is native Vulkan game without DXGI backend. Some games like RAGE 2 use DXGI backend by default. NVIDIA has some black magic in their driver to wrap Vulkan games on DXGI, but sadly this feature won't work with DXVK so NVIDIA disabled it when DXVK detected.

@De-M-oN
Copy link

De-M-oN commented Jan 3, 2025

Vulkan WSI is fundamentally broken on Windows (HDR does not work, VRR does not work, alt+tab does not work in fullscreen unless we prevent a mode switch, ...), issues like these are outside our control. The only way to improve this situation is to add a D3D12 backend for presentation, but that is not a priority right now.

Thats so weird, because Alt+tab works for me in exclusive fullscreen perfectly fine on Windows 10.
Please just make it a config option in the dxvk.conf instead of brute forcing Borderless mode now. Because my NFS HP2 runs with worse fps at borderless and due to that I will stay at 2.5.1 until I can go back to exclusive. Because thats most likely indeed the reason why the fps is lower

@qinlili23333 Please make it optional 🙏

An optimized 59fps actually is better than uncapped 300+fps if your monitor is only 60hz

Thats absolutely not true. Especially on a 60hz monitor you really, really want the uncapped or at least much higher than 60fps

Yes the frames inbetween come teared to you, but you see always the most up to date frame, no matter how teared the frames are inbetween.
It will still be much smoother and much less input latency

Here also nice videos where this is explained

https://www.youtube.com/watch?v=uzp8z1i5-Hc
https://www.youtube.com/watch?v=msOWcvoIC8M&t=158s

@qinlili23333
Copy link
Contributor

qinlili23333 commented Jan 3, 2025

Please make it optional

Actually, Windows itself is guadually dropping exclusive fullscreen. Since Windows 10, Windows puts compatible games in borderless window instead of traditional exclusive fullscreen, which is called fullscreen optimization. Windows uses hardware compose - independent flip for these games, so the performance can reach nearlly same as true exclusive fullscreen as the game is composed on dwm result instead of copy by dwm. However, this feature is only for DirectX.
In the future, dxgi d3d12 backend may become a new backend for dxvk on Windows, which can be similar to WIndows fullscreen optimization. But it needs a lot of work, and is not in priority.

Thats absolutely not true. Especially on a 60hz monitor you really, really want the uncapped or at least much higher than 60fps

That's just because some side effects brought by the high fps.
You feel smooth on high fps with 60hz monitor, it's due to the render and display latency is low. However, it's possible to keep low latency with capped fps.
Modern GPU can adjust freq based on the need. Let's consider a GPU model that can render 600fps under 600mhz, so 1mhz means 1fps for this GPU. If fps uncapped, the GPU runs at max freq, each frame needs 1.6ms. However when you cap to 60fps, the GPU thinks there's no need for such high freq, so it downgrades to 60mhz which provides just 60fps at 100% load, so the frame needs 16.6ms. This is why in normal condition you feel smooth with uncapped fps.
However, if you manually force the GPU running at max freq, it still can produce each frame in 1.6ms, then idle for 9*1.6ms, then 1.6ms for another frame. This is the first thing you need to do. This may even lower latency than uncapped on some heavily throttled device such as low-end laptops.

Another thing which produces lags when fps capped is the frame queue. To avoid sudden performance need, many games use a frame queue. Rendered frames are queued before display. This will add frame interval * queue length latency. For example, a 3 frame queue under 60fps means approx 50ms latency. If fps is uncapped, the frame interval is short so this latency can be lower. But if the game is well optimized which doesn't have sudden performance need frequently, or you prefer latency than stable fps, you can minimize this queue. Set low latency mode in Nvidia control panel to Ultra will eliminate this queue in most games, and for some games you may also need to tweak by game console such as Frostbite 3 engine games.

And for some very rare games, the game physics may have different behavior on different fps (may due to div calc precision issue), this may also make you feel different. But this should not happen for most modern games with uncapped fps.

You can use some games with internal latency tracker such as R6S, or use external tool like PresentMon to see your latency. Optimized 60fps should get very similar latency to uncapped fps. Hope these information can help you tweak your games, and enjoy a smooth experience while saving power.

@De-M-oN
Copy link

De-M-oN commented Jan 3, 2025

NFS HP2 has the better performance in exclusive and when you dont make the borderless optional I obviously will stay at 2.5.1

I need the better fps for high poly cars where for example a full grid 8th place start with 8 Lamborghini Veneno (high polygon custom car) the fps goes down to 163 (which is AMAZING by dxvk. With dgvoodoo 2 D3D11 output you would have less than 20 in this scenario!!! What kind of magic is this? Its insane.
But I want to keep that 163fps and not getting worse just because you brute force borderless now :-/
As long as windows doesnt brute force borderless itself and I have the better fps in exclusive I will of course prefer it.
This really should be optional.

Also I observed that at least with dgvoodoo, but probably DirectX in general:
In borderless mode the fps rate is limited to screen refreshrate due to the dwm probably doing that.
With my 240hz monitor its not the end of the world, but for 60hz players this is awful too :-/

@qinlili23333
Copy link
Contributor

NFS HP2 has the better performance in exclusive and when you dont make the borderless optional I obviously will stay at 2.5.1

If you really need exclusive fullscreen, I would suggest you to compile your own modified version.
Locate this line:

fullScreenInfo.fullScreenExclusive = VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT;

and change the value to VK_FULL_SCREEN_EXCLUSIVE_DEFAULT_EXT, then follow the build instruction as normal. Then you should get your own dlls with exclusive fullscreen enabled.

Sometimes it's not easy to improve performance without breaking compatibility to other games as dxvk is s general project which compatibility is more important. But if you just need it for some specific game, you can create a modified version that only prioritize performance. I sometimes bundle my modified and self compiled version of dxvk in patch when I make patches for some games.
If you want to build it on Windows, I suggest to refer to the Windows workflow file used currently. https://github.com/doitsujin/dxvk/blob/master/.github/workflows/test-build-windows.yml
You need vs2022 and meson, then follow this workflow file.

@De-M-oN
Copy link

De-M-oN commented Jan 5, 2025

Why you cant make borderless the default, but possible to change in the dxvk.conf file? I dont understand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants