Skip to content

Core: validate DX11 display-composition back buffer - #211

Open
JohsonChou wants to merge 1 commit into
Filoppi:mainfrom
JohsonChou:fix/dx11-swapchain-getbuffer
Open

JohsonChou wants to merge 1 commit into
Filoppi:mainfrom
JohsonChou:fix/dx11-swapchain-getbuffer

Conversation

@JohsonChou

@JohsonChou JohsonChou commented Sep 19, 2026 •

Copy link
Copy Markdown

Context

With FINAL FANTASY VII REMAKE INTERGRADE running in DirectX 11, enabling NVIDIA Smooth Motion caused the game to crash during launch with Luma in the graphics stack. The same setup launched when Smooth Motion was disabled.

A report of a similar failure in another game pointed to Luma’s shared DX11 display-composition path: it involved the native swap-chain back-buffer index, a failed GetBuffer call, and a null texture dereference. Reviewing OnPresent confirmed that this path:

  1. obtained an index from native IDXGISwapChain3::GetCurrentBackBufferIndex();
  2. passed that index to GetBuffer without checking the returned HRESULT;
  3. assumed the texture and matching display-composition RTV existed; and
  4. dereferenced the texture unconditionally.

ReShade’s DX11 backend exposes one logical back buffer, with its own logical current-buffer index. A native flip-model index can therefore disagree with the indexing used by Luma’s ReShade-side buffer and RTV bookkeeping. If retrieval fails or selects an untracked resource, the old path can dereference a null texture or index display-composition state with the wrong buffer.

Changes

  • Use swapchain->get_current_back_buffer_index() for the DX11 logical back-buffer index instead of querying the native IDXGISwapChain3 index.
  • Check the GetBuffer result and returned texture before using it.
  • Confirm that the returned texture is present in Luma’s tracked back-buffer set.
  • Check the display-composition RTV bounds while holding the swap-chain data lock.
  • Emit a rate-limited warning when validation fails.
  • Skip only display composition for that frame, while preserving the existing end-of-frame cleanup, queued resource destruction, and game callback.

What this fixes

This removes an unchecked null/resource-mismatch path from DX11 presentation. In the reported FF7R setup, the patched build launches and runs with NVIDIA Smooth Motion enabled instead of crashing during startup.

The validation also makes the same composition path fail safely if a presentation wrapper, swap-chain resize, or mode transition temporarily exposes a buffer that does not match Luma’s tracked DX11 state.

Validation

  • Built with Visual Studio 2026 using Publishing-Release for x64.
  • Tested in FINAL FANTASY VII REMAKE INTERGRADE using DirectX 11 with NVIDIA Smooth Motion enabled.
  • Confirmed that the game launches and runs in both SDR and HDR.

Evidence scope

No matching crash dump was captured, so the exact faulting instruction in the original launch crash was not independently proven. The diagnosis is based on the reported reproduction, the analogous shared-code failure, inspection of the unsafe presentation path, and successful runtime testing of the patched build. This change does not alter DLSS, neural rendering, HDR policy, or auxiliary-swap-chain classification.

Use ReShade logical DX11 back-buffer indexing for display composition. Validate GetBuffer and Luma swapchain bookkeeping before accessing the texture or RTV. When resources are unavailable, skip only composition and continue normal end-of-frame cleanup.
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