Skip to content

Cef upgrade#3682

Closed
oracularhades wants to merge 2 commits intocitizenfx:masterfrom
oracularhades:cef-upgrade
Closed

Cef upgrade#3682
oracularhades wants to merge 2 commits intocitizenfx:masterfrom
oracularhades:cef-upgrade

Conversation

@oracularhades
Copy link
Copy Markdown

No description provided.

@github-actions github-actions Bot added the triage Needs a preliminary assessment to determine the urgency and required action label Oct 18, 2025
@oracularhades
Copy link
Copy Markdown
Author

oracularhades commented Oct 18, 2025

Lol sorry, I meant to keep this as a draft in my repository before submitting it to the main repository upon completion, my bad.

Current issues:

And just to note, there's a bit of Git weirdness here. For example, I didn't change line 224-326 at code/components/nui-core/include/CefOverlay.h or code/components/nui-core/src/NUIWindow.cpp, I'm not sure why it thinks so 😅

@piterson05
Copy link
Copy Markdown
Contributor

@oracularhades I see that you've used CEF binaries from spotify, FiveM is using custom build of CEF, you should check these repositories first and merge these changes into new version:
https://github.com/citizenfx/cef
https://github.com/citizenfx/cef-build

@oracularhades
Copy link
Copy Markdown
Author

@oracularhades I see that you've used CEF binaries from spotify, FiveM is using custom build of CEF, you should check these repositories first and merge these changes into new version:

https://github.com/citizenfx/cef

https://github.com/citizenfx/cef-build

Yes I know, thanks 🙂

@FabianTerhorst
Copy link
Copy Markdown
Contributor

Please also compare the result of https://www.vsynctester.com/ for the current cef version and your upgrade and upload both videos here.

@Kr3mu
Copy link
Copy Markdown

Kr3mu commented Nov 19, 2025

@oracularhades do you have plan on finishing this PR?
🙏

@oracularhades
Copy link
Copy Markdown
Author

@oracularhades do you have plan on finishing this PR? 🙏

@Kr3mu Yes, definitely. I've just been looking for help with a specific CEF API.

@Kr3mu
Copy link
Copy Markdown

Kr3mu commented Nov 19, 2025

@oracularhades do you have plan on finishing this PR? 🙏

@Kr3mu Yes, definitely. I've just been looking for help with a specific CEF API.

Thanks, You are the man who is going to save us

@oracularhades
Copy link
Copy Markdown
Author

@Kr3mu Oh hey! You made ESX! Great work :)

@Kr3mu
Copy link
Copy Markdown

Kr3mu commented Nov 19, 2025

@Kr3mu Oh hey! You made ESX! Great work :)

thanks

@Kr3mu
Copy link
Copy Markdown

Kr3mu commented Nov 19, 2025

@oracularhades What's your discord I can't find it anywhere

@oracularhades
Copy link
Copy Markdown
Author

@Kr3mu "oracularhades" on Discord :)

@Kr3mu
Copy link
Copy Markdown

Kr3mu commented Dec 21, 2025

Any update

@oracularhades
Copy link
Copy Markdown
Author

Any update

Still debugging 🙂 - UpdateFrame is doing some odd things.

@WolfsCoding
Copy link
Copy Markdown

Any updates on this PR, would love to see it.

@oracularhades
Copy link
Copy Markdown
Author

@WolfsCoding Definitely still happening, just juggling a bit IRL right now 🙂. If anyone wants to contribute to the PR, I'd be happy to answer any questions about the PR.

@ToffyMTA
Copy link
Copy Markdown

#3651 (reply in thread)

I would highly recommend that you stop working on this, as there is already a mostly complete upgrade to CEF M140 (including all original CEF/Chromium patches + extra) that is waiting on the issue I've mentioned above to be resolved.

If anyone wants to contribute to the PR

I’m not sure it’s worth spending time on this PR, as Ehbw mentioned that his upgrade is mostly complete.

@oracularhades
Copy link
Copy Markdown
Author

@ToffyMTA My PR uses a different method and I disagree with how the other PR is structured (respectfully, not wanting to disparage anyone 🙂). In Ehbw's PR merges are manually applied and changes are manually diverged, rather than being based on a fresh official CEF release, potentially creating stability/security gaps. I think my PR is better because it starts from the latest CEF build and will re-apply FiveM's changes.

In a perfect world, I'd also like to compartmentalise FiveM's changes into specific areas to make upgrades a little easier for future maintainers. Ehbw's PR would require significantly more time to maintain in the future and I worry we'll have the same outdated CEF problem in the future.

I think my PR is better because it starts from the latest CEF build

(At the time of this PR, I will update the CEF release before merging)

@Ehbw
Copy link
Copy Markdown
Contributor

Ehbw commented Jan 12, 2026

CFX depends on every single custom patch used. Without them we lose backwards compatability and fxdk functionality. Porting the patches from m103 -> m139 (which had over 2 years worth of patches and made all the patches unable to be automatically applied) took about an hour, with every subsequent update (m139 -> m140, m140 -> m144) taking less then 15 minutes to patch and 30 minutes to be in game on with my branch.

However this is absolutely not the issue. CFX depended on OBS's shared texture patch which only works on m103 as m104 chromium removed a large part of the rendering code that OBS patched and relied on for OSR. CEF implemented a new OSR rendering system in M124, however this is simply a massive downgrade to the OBS one in every single way and is significantly slower and harder to work with in FiveM (and RedM + FxDK), it has massive performance issues with vSync and general rendering which will massively impact the end users in a very negative way.

This is the main reason why my branch hasn't seen the light of day (I've had an experimental branch + experimental thread post in a draft since September) as without heavily patching CEF + Chromium which will make future upgrades significantly harder and more time consuming there is no fix to this problem.

@oracularhades
Copy link
Copy Markdown
Author

oracularhades commented Jan 12, 2026

@Ehbw My concerns are how diverged the patches in your PR are from the official CEF repo. It's not based on an official CEF release but rather patches manually applied onto a release that is years out-of-date.

Without them we lose backwards compatability and fxdk functionality.

Yeah, I mentioned NUI's reliance on custom CEF implementations in my last comment.

I think we're both saying very similar things. I have been facing the same shared textures issue, so we're currently both stuck in the same boat with regards to "This is the main reason why my branch hasn't seen the light of day" 😅.

as without heavily patching CEF + Chromium which will make future upgrades significantly harder and more time consuming there is no fix to this problem.

I respectfully disagree with this. Headless Chromium has been re-done in CEF. My PR is updating FiveM's NUI to use the new headless textures rather than trying to recycle the older CEF versions. Heavily patching CEF/Chromium would inevitably unnecessary unmaintainable code with security flaws that go well outside the sanity of CEF or CFX's maintainers.

@Ehbw
Copy link
Copy Markdown
Contributor

Ehbw commented Jan 12, 2026

I feel like you've misunderstood what I meant with the new implementation. I have fully adapted the fivem OSR logic to work with the new OSR system (both DUI and normal NUI). However the general performance and data sent (both frequency and content of the data) to the callback is much slower and inconsistent (e.g. frames being skipped especially on some heavy animated transitions where m103 fork had no issue with it) under the new OSR, along with just the new implementation for OnAcceleratedPaint either forcing the handle to be duplicated and passed to the render thread or OnAcceleratedPaint to be blocked until the texture is copied over to a resource owned by the games d3d11 device (which has to be done on the render thread) otherwise once the OnAcceleratedPaint callback returns the handle can be freed back to the pool immediately.

These issues get worse under vsync with cef having issues about it in the cef repo. From testing with various users on m140 they faced performance issues or artifacting exclusive to having off screen rendering enabled. This can even be repro successfully outside of fivem entirely by using cefclient and passing it OSR flags and navigate to https://www.vsynctester.com/ and you can see the performance issue clearly compared to not using OSR.

The git branches from my fork are temporary and are created from the upstream fork rather then off of the old fivem cef branches. Also something that isn't really an issue

@oracularhades
Copy link
Copy Markdown
Author

@Ehbw

The git branches from my fork are temporary and are created from the upstream fork rather then off of the old fivem cef branches.

Thank you for clarifying. By "upstream fork" do you mean the latest CEF release or the m103 fork?

Your insight into OSR performance is super interesting, thanks.

I will continue this PR and keep debugging to see what can be done. I'm not sure heavily patching CEF/Chromium is the right approach. 2 competing PRs won't hurt anyone 🙂.

I'd be interested to hear more about what you've learnt and see if there's anything we could come up with to get a CEF patch merged. My email is hi@oracularhades.com if you'd like to chat.

@oracularhades
Copy link
Copy Markdown
Author

@Ehbw I reread this thread after doing yet another week of digging and I see more of your point. I'm still very skeptical about heavily patching Chrome/CEF (which was my main point) as FiveM would essentially be maintaining it's own browser. Applying future chromium patches would be this problem on steroids. Maybe another browser could work? We could try firefox? It would be possible to add a flag in the resource manifest to either load CEF M103 or the new browser implementation, which would ensure backwards compatibility.

@oracularhades
Copy link
Copy Markdown
Author

Firefox doesn't have a CEF equivalent like Chromium but I think it's worth the contemplation if the discussion is at the point of maintaining a chromium fork.

@Ehbw
Copy link
Copy Markdown
Contributor

Ehbw commented Jan 22, 2026

@Ehbw I reread this thread after doing yet another week of digging and I see more of your point. I'm still very skeptical about heavily patching Chrome/CEF (which was my main point) as FiveM would essentially be maintaining it's own browser. Applying future chromium patches would be this problem on steroids. Maybe another browser could work? We could try firefox? It would be possible to add a flag in the resource manifest to either load CEF M103 or the new browser implementation, which would ensure backwards compatibility.

Not including the custom patches used in fivem and redm is an non-negotiable point as otherwise it will break how NUI and NUI resources work as a whole. The idea of heavily patching cef/chromium to improve OSR/rework OSR was more of highlighting how painful (and unlikely) a CEF upgrade would be.

@oracularhades
Copy link
Copy Markdown
Author

Not including the custom patches used in fivem and redm is an non-negotiable point as otherwise it will break how NUI and NUI resources work as a whole

@Ehbw Sorry i misspoke, I do still mean including the custom FiveM code that already exists in the Fivem CEF repo. That is a lot easier to maintain than a Chromium fork.

@radium-cfx
Copy link
Copy Markdown
Contributor

Superseded by another changeset targeting CEF.

Thanks for your work here!

@radium-cfx radium-cfx closed this Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage Needs a preliminary assessment to determine the urgency and required action

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants