-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Add AMD AntiLag 2 support #96991
base: master
Are you sure you want to change the base?
Add AMD AntiLag 2 support #96991
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
IIRC this requires core integration to function correctly, and is likely one of the main reasons why there's no Nvidia Reflex support in Godot (as it's not license compatible with Godot and has to be in core) There are probably ways to expose the required internals properly to addons (like is required for DLSS and SMAAT2x, but those just require fairly simple things to be exposed and by no means require any deep integration with the internals) |
AFAICT the integration is pretty simple as it only requires calling a specific function before input polling. The SDK license is MIT -- I believe there should be no problem on that side. |
Only two reasons for rejecting this would be:
I'm unsure how likely and/or how complex the First option would be to implement Disclaimer - I'm an AMD user that benefits from this feature, but I'd be supporting this all the same if it were Nvidia's Reflex which wouldn't benefit me as such |
Given the comments in the proposal issue, I've decided I'll also try supporting this on Vulkan using the official AMD extension. Any suggestions as to what the config setting would be? |
Does this work on all vulkan graphics cards or only amd gpus? |
AMD only I'm afraid. |
Cool to see more folks tackling latency issues! I do have a couple concerns with this PR:
Right now I'm currently looking into establishing a broader low latency mode. Please let me know what you think of this proposal. |
@@ -2761,6 +2761,9 @@ | |||
<member name="rendering/rendering_device/d3d12/agility_sdk_version" type="int" setter="" getter="" default="613"> | |||
Version code of the [url=https://devblogs.microsoft.com/directx/directx12agility/]Direct3D 12 Agility SDK[/url] to use ([code]D3D12SDKVersion[/code]). This must match the [i]minor[/i] version that is installed next to the editor binary and in the export templates directory for the current editor version. For example, if you have [code]1.613.3[/code] installed, you need to input [code]613[/code] here. | |||
</member> | |||
<member name="rendering/rendering_device/d3d12/amd_antilag2_enabled" type="bool" setter="" getter="" default="true"> | |||
If [code]true[/code], enables AMD AntiLag 2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is worth an external link documenting what this is, a short summary, and the pros and cons of enabling this feature.
@frabert Would you be willing to test these changes using my latency tester? I am trying to narrow down the cause of RenderingDevice apparently having an additional frame of lag over OpenGL, so more datapoints here would be very helpful. |
One was taken with AntiLag on and the other one with it off. I don't think it matters which is which because if I understand your test correctly, the result is the same in both :) |
Hmm, disappointing results for sure. Just to double check, you ran this on the D3D12 renderer, right? On nVidia, the Vulkan renderer has five frames of lag max on defaults settings whereas D3D12 has four. Edit: Also would like to know what your results are in windowed vs fullscreen. Edit 2: I'm not sure what the extent of this PR is, so if it only affects input timing, that won't be reflected in the latency tester, as it's strictly checking swapchain/frame queue lag. |
Correct. Running using Vulkan has less latency, I think one or two frames less. EDIT: no difference between windowed and fullscreen |
Well that's interesting. On nVidia, latency is worse on Vulkan fullscreen unless you disable layered DXGI, then it's the same as D3D12. Do you know if Vulkan is running using native presentation or layered DXGI on the AMD drivers? I believe AMD added support for layered DXGI in their more recent drivers, but I'm unsure what the method to enable this is (it might be automatic). Either way, PresentMon should be able to tell you how it's being presented. I'd also like to see the effects of setting |
PresentMon says If you still can't get either of these two presentation modes, check to make sure that you have windowed/fullscreen optimizations and MPO (multi-plane overlay) enabled in Windows, and on Windows 10 make sure the application is the foreground window with no overlays on top (on Windows 11 it shouldn't matter due to some under-the-hood improvements). |
I get |
How's latency in fullscreen? Better or worse? And does your hardware configuration have anything that might cause additional indirection, such as hybrid graphics? Surprised that D3D12 isn't showing |
I think my hardware config is pretty straightforward? It's a single discrete GPU, no integrated GPUs. Fullscreen D3D12 does show |
Only now read this edit: as far as I understand, AMD AntiLag2 indeed only seems to affect input latency by strategically waiting until the very last moment before presenting before polling for input. |
|
I understand MPO is normally enabled, and I have never disabled it before. Checking the registry I don't see any setting that would suggest it is currently disabled. |
...Make that both Vulkan and D3D12. The more datapoints I have, the better I can diagnose latency issues and assess the effectiveness of lag fixes. Ideally I'd like that following:
All with the following combinations:
All with fullscreen optimizations and MPO enabled in Windows. Edit: Didn't see your post about MPO. Perhaps this issue isn't a great place for realtime communication :) Would you mind hopping on the Godot Contributors Chat? https://chat.godotengine.org/channel/rendering |
Adds support for AMD AntiLag 2.
Requires some intermingling between the rendering device and input polling, I'm open to suggestion as to whether there's a better way than what I've got right now.