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

Nvidia Reflex support #4632

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open

Nvidia Reflex support #4632

wants to merge 22 commits into from

Conversation

doitsujin
Copy link
Owner

@doitsujin doitsujin commented Jan 21, 2025

This implements Reflex support through dxvk-nvapi's ID3DLowLatencyDevice on drivers that support VK_NV_low_latency2. Fairly invasive change since we need to pass frame IDs all over the place and mess around with certain markers to account for internal threading.

Tested in a few games:

  • Ghostrunner: Broken, game never even calls the function to enable Reflex at all, let alone the sleep function.
  • Ghostrunner 2: Works as expected.
  • God of War: Works as expected.
  • Mordhau: Game sets present markers but thinks that Reflex is unsupported, so you can't enable it in game. (???)
  • Overwatch 2: Works, but only if Vsync is disabled. I don't know if this is expected behaviour.
  • Quake Champions: Doesn't use markers, but appears to work.

Not sure if there are any other Reflex-enabled D3D11 games that aren't simultaneously blocked by anti-cheat measures, it's a bit unfortunate that the only UE4 test case seems to be bugged at a game level.

This also adds a HUD item (latency) that will show up when a game uses latency markers, and will display the average time it takes from the game setting the SIMULATION_START (or INPUT_SAMPLING, if it uses that) marker to presentation of the given frame completing on the GPU, as well as the average latency sleep duration.

Bildschirmfoto-829

Things that are not really supported very well include non-monitonic frame IDs (dxvk-nvapi sorts these out for us so that should never happen anyway), and the whole thing probably isn't very well behaved when a game randomly skips markers for a frame since it breaks our way of correlating app-provided frame IDs with the ones we use for the Vulkan swapchain.

Finally, this adds an option to enable latency sleep for older games; the obvious downside here is that we can only really sleep after Present, so this isn't going to do all that much in games that have an asynchronous render thread, besides reducing some buffering inside DXVK. This can be enabled by setting dxvk.latencySleep = True in the configuration file.

Supersedes #4623, #3690.

We'll need this in more places.
Implements a basic latency sleep solution that is intended to work
without requiring games to support any related vendor features.

This alone is not enough to expose the Reflex API to applications via
dxvk-nvapi, but since that relies on NV_low_latency2 specifics anyway,
we are going to add an implementation based on that extension later
with an extended interface.
Introduces two queues and allows us to dispatch chunks to the ordered
queue without disrupting the sequence number.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant