Skip to content

feat(graphics/rdr3): various graphics improvements#3840

Merged
prikolium-cfx merged 1 commit into
citizenfx:masterfrom
Ehbw:feat/rdr3-graphics-hooks
Mar 2, 2026
Merged

feat(graphics/rdr3): various graphics improvements#3840
prikolium-cfx merged 1 commit into
citizenfx:masterfrom
Ehbw:feat/rdr3-graphics-hooks

Conversation

@Ehbw

@Ehbw Ehbw commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

Goal of this PR

This PR consists of dozens of small graphics changes combined to fix several issues and improve startup behaviour within RedM.

The core changes in this patch are:

  • Improve Vulkan NUI implementation, obtaining correct memoryTypeIndexes for memory allocating. Resolving common "Vulkan failed to allocate" errors users faced on startup.
  • Force D3D12 implementation to use the dedicated GPU similar to Vulkan (and matches the behaviour in FiveM with D3D11)
  • While the game is stating up, create dummy D3D12 and Vulkan devices similar to FiveM to speed up the UMD for D3D12. However we also do this for Vulkan to provide startup checks to ensure that the system has the vulkan features required by RedM that aren't used/checked by RDR2.
  • Block Vulkan from being used if the Vulkan startup checks fails. Falling back to D3D12
  • Integrated feat(graphics/rdr3): improve ERR_GFX_STATE error messages #3761 into this patch, now informing the game to invalidate pipeline cache on the next launch. This should help prevent infinite ERR_GFX_STATE errors caused by corrupted pipeline cache data.
  • Backported "No ShowWindow Early" (Now only showing the window when the NUI/Game is ready to render) and Renderer wait (removing long sleeps with a WaitForSingleObject call) patches from FiveM along side the "UiDone" functionality used to show the game window when mpMenu is ready.

How is this PR achieving the goal

This PR applies to the following area(s)

RedM

Successfully tested on

Tested on a feature branch given to users having issues with Vulkan.

Game builds: 1491

Platforms: Windows,

Checklist

  • Code compiles and has been tested successfully.
  • Code explains itself well and/or is documented.
  • My commit message explains what the changes do and what they are for.
  • No extra compilation warnings are added by these changes.

Fixes issues

https://forum.cfx.re/t/redm-fails-during-rockstar-launcher-initialization-vulkan-memory-error-rtx-4060-ti/5383341
https://forum.cfx.re/t/failed-to-allocate-memory-for-vulkan-vkresult-4294967283/5384919/2
https://forum.cfx.re/t/failed-to-allocate-memory-for-vulkan-upon-launching-redm/5374697/4
https://forum.cfx.re/t/failed-to-allocate-memory-for-vulkan-upon-launching-redm/5375052
https://forum.cfx.re/t/getting-failed-to-allocate-memory-for-vulcan-when-using-dx12/5371039/5
https://forum.cfx.re/t/failed-to-allocate-memory-for-vulkan-upon-launching-redm/5375052/2
https://forum.cfx.re/t/have-to-delete-the-data-folder-every-time-i-want-to-play-redm/5378511
https://forum.cfx.re/t/redm-giving-me-a-vulkan-issue/5341791

@github-actions github-actions Bot added the RedM Issues/PRs related to RedM label Feb 26, 2026
@radium-cfx radium-cfx self-assigned this Feb 26, 2026
@radium-cfx radium-cfx added the ready-to-merge This PR is enqueued for merging label Feb 26, 2026
@github-actions github-actions Bot added the invalid Requires changes before it's considered valid and can be (re)triaged label Feb 26, 2026
This commit consists of various improvements I've had laying around since the original RenderHooks rdr3 implementation. Aimed at tackling various common graphics issues along with matching some behaviours with FiveM.

The core changes are as following:

- Move glues VK external handle code to shared VulkanHelper file in rage-graphics-rdr3
- Corrected behaviour in the VK external handle logic to hopefully resolve "Failed to allocate memory for vulkan" errors on various hardware configurations
- Match FiveM's behaviour by forcing the UMD for D3D12 and Vulkan to load before the game is ready. May also help with other Vulkan related errors.
- Added start up checks for the Dedicated GPU used for the game to ensure it has the proper support required for RedM on top of the existing requirements for RDR2.
- Block vulkan from being used if the GPU used is not able to support the needed Vulkan functionality in RedM.
- Hook D3D12CreateDevice calls to force D3D12 to use the dedicated GPU similar to vulkan.
- Backported render sleep changes and "no ShowWindow early" patches from FiveM to make the games launch feel smoother.
- Provide crashometry with data related to vulkan/d3d12 from the game it self, this may be useful in debugging graphics related errors.
- Introduce "UiDone" logic to RedM, this existed in FiveM and was used to show the game window when mpMenu is ready.
- Remove 'ERR_GFX_STATE' error messages, replacing them with D3D12/Vulkan call failure messages providing data from those Graphic APIs.
- Introduce pipeline cache clearing from any D3D12/Vulkan call failures or ERR_GFX_STATE.
@Ehbw Ehbw force-pushed the feat/rdr3-graphics-hooks branch from 107b0ef to c0bf21c Compare February 27, 2026 01:24
@prikolium-cfx prikolium-cfx merged commit 220cec9 into citizenfx:master Mar 2, 2026
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid Requires changes before it's considered valid and can be (re)triaged ready-to-merge This PR is enqueued for merging RedM Issues/PRs related to RedM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants