Overview

Reducing latency from mouse click to image on-screen is critical in delivering a satisfying gaming experience, especially for fast-paced and competitive games. This latency occurs at various stages of the system between the user providing input via the mouse and keyboard to finally seeing the results of those actions as photons reaching the eye. This is known as end-to-end system latency.

While some parts of the system are broadly out of the game developer’s control such as the input peripheral latency, or the display latency, the bit in the middle – the game itself – is somewhat more controllable. Obviously, a higher framerate will have a pretty-much linear impact on the game’s latency, but this will typically require reducing image quality and resolution. The key factor here is how much latency exists between the user input being polled and the point at which the content is sent to the display. This is where Anti-Lag comes in.

AMD Radeon™ Anti-Lag 1

Anti-Lag 1 is a pure driver-based technology that introduces a carefully calculated delay into the driver-side processing of the game’s graphics commands, such that CPU frames and GPU frames are optimally aligned. This way the CPU frames are prevented from running too far ahead of GPU frames, and as a result the lag (input-to-image latency) is reduced.

AMD Radeon™ Anti-Lag 2

Anti-Lag 2 does a similar thing to the driver-based Anti-Lag 1, but the point of insertion of the delay is now at the optimal point inside the game’s logic, just before the user controls (mouse/gamepad/keyboard) are sampled. This allows for an optimal alignment of the game’s internal processing pipeline (and not just the in-driver producer-consumer logic), achieving a significantly greater latency reduction.

In order to achieve this improved latency reduction, the game developer needs to integrate the Anti-Lag 2 SDK into their game, and (optionally) expose its controls in the game’s UI.

Integration guide

DirectX® 11

  • Include the DirectX® 11 header in your game: ffx_antilag2_dx11.h
  • Declare a persistent AMD::AntiLag2DX11::Context object initialized with = {} or mem-zeroed.
  • Call AMD::AntiLag2DX11::Initialize(&context). If this function returns S_OK, then Anti-Lag 2 is present in your game.
  • Call AMD::AntiLag2DX11::Update(&context,true,0) at the point just before the game polls for input. Specify true to enable Anti-Lag 2. False, to disable it. The second parameter is an optional framerate limiter. Specify zero to disable it.
  • Call AMD::AntiLag2DX11::DeInitialize(&context) to clean up the references to the SDK on game exit.

DirectX®12

  • Include the DirectX® 12 header in your game: ffx_antilag2_dx12.h
  • Declare a persistent AMD::AntiLag2DX12::Context object initialized with = {} or mem-zeroed.
  • Call AMD::AntiLag2DX12::Initialize(&context,pDevice) passing the DX12 device into this function. If this function returns S_OK, then Anti-Lag 2 is present in your game.
  • Call AMD::AntiLag2DX12::Update(&context,true,0) at the point just before the game polls for input. Specify true to enable Anti-Lag 2. False, to disable it. The second parameter is an optional framerate limiter. Specify zero to disable it.
  • Call AMD::AntiLag2DX12::DeInitialize(&context) to clean up the references to the SDK on game exit.

AMD FSR 3 frame generation support

Anti-Lag 2 requires some special attention when AMD FidelityFX™ Super Resolution 3 frame generation is enabled. There are a couple of extra Anti-Lag 2 functions required to be called to let Anti-Lag 2 know whether the presented frames are interpolated or not.

Until Anti-Lag 2 is supported in the public open-source release of FSR 3 (which is coming soon), developers are advised to reach out to their Developer Technology contacts at AMD.

Testing

Drivers supporting Anti-Lag 2 include a built-in AMD Radeon™ Anti-Lag 2 Latency Monitor:

  • Use the Alt+Shift+L hotkey to cycle through the modes which can display the FPS and latency onscreen.
  • The three values displayed (from top to bottom) are FPS (yellow), latency [milliseconds] (white) and latency [GPU frames] (green). The latter is most useful to make sure Anti-Lag 2 was integrated correctly.
  • Normally, the latency values will be white and green – but they can also be dark grey or light gray.
  • Dark grey color means that the Update() function is not being called, which would mean that there is a problem with Anti-Lag 2 integration.
  • Light grey color means that the values have not self-calibrated yet – that should resolve itself within a second or two. If it doesn’t, that probably means there is a problem with the integration.
  • When holding down the Right Ctrl key, Anti-Lag 2 is bypassed. In this case the green number (latency in frames) indicates the native (pre-Anti-Lag 2) game latency. Usually it would be close to an integer number 3, 4 or 5.
  • When Anti-Lag 2 is active, the green number (latency in frames) should be between 1.0 and 2.0, or perhaps slightly higher than 2.0. If it is higher than 3 – then there could be a problem with integration.
  • Both white and green numbers should roughly match the numbers measured by FLM (see below) when VSync is not used. In DirectX®11 though, if the game is not running in fullscreen exclusive mode – there might be a one frame discrepancy (FLM values will be one frame higher).

Another way to validate the SDK integration is to use the Frame Latency Meter (FLM) tool which can be downloaded, along with full source, here: https://github.com/GPUOpen-Tools/frame_latency_meter/releases. Full instructions on how to use this tool are included.

Support

Hardware:

  • AMD RDNA™ 1-based products, including the AMD Radeon™ RX 5000 Series and newer.

Driver:

  • AMD Software: Adrenalin Edition™ 24.6.1 and onwards for DirectX® 11 support.
  • AMD Software: Adrenalin Edition™ 24.7.1 and onwards for DirectX® 12 support.

OS:

  • Microsoft® Windows® 10
  • Microsoft® Windows® 11

Strings, including translations

Recommended UI text can be found here: https://gpuopen.com/fidelityfx-naming-guidelines/

Get AMD Radeon™ Anti-Lag 2 SDK