Skip to content

fix(editor): render the overlay from the BGFX submit path - #26

Open
Unny984 wants to merge 1 commit into
wo55555:developfrom
Unny984:fix/overlay-coexist-with-present-detours
Open

fix(editor): render the overlay from the BGFX submit path#26
Unny984 wants to merge 1 commit into
wo55555:developfrom
Unny984:fix/overlay-coexist-with-present-detours

Conversation

@Unny984

@Unny984 Unny984 commented Aug 21, 2026

Copy link
Copy Markdown

Overlays that detour IDXGISwapChain::Present, such as RivaTuner Statistics Server, can bypass the replay timeline's own present detour. When that happened the replay browser opened logically but never drew: the button handler ran and menu input was suspended, yet renderInternal was never reached, so not even its warnings were logged.

Composite the overlay at the end of the RendererContextD3D12::submit hook instead. That hook is on the client's own renderer, so it cannot be detoured away, and BGFX has not flipped the back buffer yet. The present detours keep their existing path and skip the frame when the submit path already drew it, so machines without a competing overlay render exactly once. Offline export is left on its current route.

Because a competing overlay also swallows ResizeBuffers, add syncSwapChainGeometry() so the overlay rebuilds its swap-chain resources when the back buffer changes size without beforeResize() being called.

Validated on Minecraft Bedrock 1.26.10.04 with LeviLamina 26.10.14, with RivaTuner Statistics Server 7.x and MSI Afterburner attached: the replay browser now renders, with the RTSS OSD composited above it.

Summary

Describe the problem and the focused change that resolves it.

Validation

  • xmake -r -y
  • git diff --check
  • Tested in Minecraft when the change affects recording, replay, or UI behavior

Describe any additional validation and list the Minecraft, LeviLamina, and Playback versions used.

Compatibility and Replay Impact

Describe changes to compatibility, replay files, recorded data, or runtime behavior. Write None when not applicable.

Checklist

  • The change is focused and contains no unrelated refactoring.
  • Changed C++ files have been formatted with the repository configuration.
  • Translation keys remain aligned across supported languages where applicable.
  • New third-party code or assets include the required license notice.
  • Logs, replays, screenshots, and test data contain no private server or player information.

Overlays that detour IDXGISwapChain::Present, such as RivaTuner
Statistics Server, can bypass the replay timeline's own present detour.
When that happened the replay browser opened logically but never drew:
the button handler ran and menu input was suspended, yet renderInternal
was never reached, so not even its warnings were logged.

Composite the overlay at the end of the RendererContextD3D12::submit
hook instead. That hook is on the client's own renderer, so it cannot be
detoured away, and BGFX has not flipped the back buffer yet. The present
detours keep their existing path and skip the frame when the submit path
already drew it, so machines without a competing overlay render exactly
once. Offline export is left on its current route.

Because a competing overlay also swallows ResizeBuffers, add
syncSwapChainGeometry() so the overlay rebuilds its swap-chain resources
when the back buffer changes size without beforeResize() being called.

Validated on Minecraft Bedrock 1.26.10.04 with LeviLamina 26.10.14, with
RivaTuner Statistics Server 7.x and MSI Afterburner attached: the replay
browser now renders, with the RTSS OSD composited above it.

@indpriyanshuraj indpriyanshuraj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Went through the changes, approach looks good to me. Moving the overlay rendering to bgfx submit path should avoid the Present detour issue, and the submit flag handles the case where normal path is still reached so we don't render twice. Resize handling also makes sense for when ResizeBuffers gets bypassed. Overall the change is pretty focused,i didn't spotted anything concerning in the diff.

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.

2 participants