protonscr

[Question] How would you approach Anti-Lag 1 Integration via a Vulkan layer?

dxvkclosed question
doitsujin/dxvk#5561 · opened 2026-03-23 by nJ3ahxac · updated 2026-06-17 · 3 comments · github
NnJ3ahxac 2026-03-23 github

Hi,

I have done some work writing an Anti-Lag 2 and Anti-Lag 1 implementation via a Vulkan layer. You can have a look at it over here. I am pretty happy with the results.

While Anti-Lag 2 works OK, I noticed that my Anti-Lag 1 implementation doesn't seem to work with DXVK. If I block the thread that calls vkQueuePresentKHR, the actual game doesn't stall as I would expect. Unfortunately I am a DXVK layman.

I want to ask, how would you approach Anti-Lag 1 integration? Is a Vulkan layer just the wrong place to do so for DXVK? Am I doing something wrong with my approach here? Does DXVK needs changes for this approach to work?

Also, I was considering supplying VK_NV_low_latency2 in addition to the VK_AMD_anti_lag device extension. Again, I'm not well versed on the current status of fakenvapi / efforts to spoof a nvidia card for those applications which only support reflex. What are your thoughts on this approach?

Thank you for your time and all your work on DXVK!

NnJ3ahxac 2026-04-09 github

Update as I changed the focus of the layer. I got rid of the heuristic-based frame pacing (Windows's AntiLag 1) and moved to implementing VK_NV_low_latency2 and VK_AMD_anti_lag device extensions separately. Now you can switch between which extension the layer provides with an env var. It (sort of) solves the issue in #4268 - AMD or Intel hardware can use frame pacing by just meeting the requirements for Reflex. I would still like to hear your thoughts on how 'dumb' frame pacing that doesn't involve these extensions can be implemented in DXVK with this Vulkan layer approach because it seems like any sleeping I apply doesn't affect the game thread at all.

Nnetborg-afps 2026-04-09 github

I want to ask, how would you approach Anti-Lag 1 integration? Is a Vulkan layer just the wrong place to do so for DXVK?

in DXVK with this Vulkan layer approach because it seems like any sleeping I apply doesn't affect the game thread at all.

Yes, you can only delay the presentation when delaying vkQueuePresentKHR(). This is the wrong place to pace the game thread. You can have a look at dxvk-low-latency, which is a sophisticated manufacturer-independent custom anti-lag solution for DXVK.

You need to put the sleep into dxgi.present() in order to affect the game thread, there is no other way.

NnJ3ahxac 2026-04-09 github

You need to put the sleep into dxgi.present() in order to affect the game thread, there is no other way.

Thanks, I wasn't aware of this. If we can't pace things at vkQueuePresentKHR() then the layer can only really target native Linux games which happen to not support AL2/Reflex. So I think it's probably not worth the trouble to write this into a vulkan layer.

Nothing extracted yet.