CEF offscreen rendering with shared textures using skia

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Re: CEF offscreen rendering with shared textures using skia

Postby reito » Sat Feb 03, 2024 10:44 am

Yes.

Here's the corresponding Chromium patch if you want to test it out.
OSR_GPU_6261.zip
(8.54 KiB) Downloaded 61 times


Although the patch named 6261, you should checkout master-osr using:
Code: Select all
python3 automate-git.py --download-dir=. --branch=master --checkout=master-osr --url=https://reitovo@bitbucket.org/reitovovo/cef.git --force-build --x64-build --no-release-build --no-depot-tools-update --no-distrib
reito
Techie
 
Posts: 17
Joined: Sat Jan 27, 2024 11:19 pm

Re: CEF offscreen rendering with shared textures using skia

Postby reito » Sun Feb 04, 2024 10:38 am

There's a bug on macOS side, and here's the addition patch: https://chromium-review.googlesource.co ... /+/5266558
reito
Techie
 
Posts: 17
Joined: Sat Jan 27, 2024 11:19 pm

Re: CEF offscreen rendering with shared textures using skia

Postby reito » Sun Feb 04, 2024 2:24 pm

Update:
I have almost done here:
Main patch to bring GPU OSR back to chromium > 104: https://chromium-review.googlesource.co ... /+/5265077
Additional patch to fix a bug on macOS: https://chromium-review.googlesource.co ... /+/5266558
With these two patches CEF can bring OnAcceleratedPaint back alive.

There're also some changes to CEF: https://bitbucket.org/reitovovo/cef/src/master/
The latest commit brings a shitty proof of concept that renders IOSurface passed by OnAcceleratedPaint to GLView, but it is slow and buggy, I suggest migrate to Metal if someone can.

Some other places to keep track:
CEF Forum: viewtopic.php?f=6&t=19404&p=53489#p53489
Electron: https://github.com/electron/electron/is ... 1925563269
CEF PR: https://bitbucket.org/chromiumembedded/ ... rt-for-viz
OBS Discord: https://discord.gg/obsproject
reito
Techie
 
Posts: 17
Joined: Sat Jan 27, 2024 11:19 pm

Re: CEF offscreen rendering with shared textures using skia

Postby rjxray » Mon Feb 05, 2024 8:18 am

This is awesome work and fantastic news and I'm trying building right now but I am having final link errors

Code: Select all
LINK cefclient.exe cefclient.exe.pdb

lld-link: error: undefined symbol: public: __cdecl client::OsrRenderer::OsrRenderer(struct client::OsrRendererSettings const &)
>>> referenced by ../../cef/tests/cefclient/browser/osr_render_handler_win_gl.cc
>>>               obj/cef/cefclient/osr_render_handler_win_gl.obj

lld-link: error: undefined symbol: public: __cdecl client::OsrRenderer::~OsrRenderer(void)
>>> referenced by ../../cef/tests/cefclient/browser/osr_render_handler_win_gl.cc
>>>               obj/cef/cefclient/osr_render_handler_win_gl.obj

lld-link: error: undefined symbol: public: void __cdecl client::OsrRenderer::SetSpin(float, float)
>>> referenced by ../../cef/tests/cefclient/browser/osr_render_handler_win_gl.cc
>>>               obj/cef/cefclient/osr_render_handler_win_gl.obj

lld-link: error: undefined symbol: public: void __cdecl client::OsrRenderer::IncrementSpin(float, float)
>>> referenced by ../../cef/tests/cefclient/browser/osr_render_handler_win_gl.cc
>>>               obj/cef/cefclient/osr_render_handler_win_gl.obj

lld-link: error: undefined symbol: public: void __cdecl client::OsrRenderer::ClearPopupRects(void)
>>> referenced by ../../cef/tests/cefclient/browser/osr_render_handler_win_gl.cc
>>>               obj/cef/cefclient/osr_render_handler_win_gl.obj

lld-link: error: undefined symbol: public: void __cdecl client::OsrRenderer::OnPopupShow(class scoped_refptr<class CefBrowser>, bool)
>>> referenced by ../../cef/tests/cefclient/browser/osr_render_handler_win_gl.cc
>>>               obj/cef/cefclient/osr_render_handler_win_gl.obj

lld-link: error: undefined symbol: public: void __cdecl client::OsrRenderer::OnPopupSize(class scoped_refptr<class CefBrowser>, class CefRect const &)
>>> referenced by ../../cef/tests/cefclient/browser/osr_render_handler_win_gl.cc
>>>               obj/cef/cefclient/osr_render_handler_win_gl.obj

lld-link: error: undefined symbol: public: void __cdecl client::OsrRenderer::OnPaint(class scoped_refptr<class CefBrowser>, enum cef_paint_element_type_t, class std::__Cr::vector<class CefRect, class std::__Cr::allocator<class CefRect>> const &, void const *, int, int)
>>> referenced by ../../cef/tests/cefclient/browser/osr_render_handler_win_gl.cc
>>>               obj/cef/cefclient/osr_render_handler_win_gl.obj

lld-link: error: undefined symbol: public: void __cdecl client::OsrRenderer::Render(void)
>>> referenced by ../../cef/tests/cefclient/browser/osr_render_handler_win_gl.cc
>>>               obj/cef/cefclient/osr_render_handler_win_gl.obj

lld-link: error: undefined symbol: public: void __cdecl client::OsrRenderer::Initialize(void)
>>> referenced by ../../cef/tests/cefclient/browser/osr_render_handler_win_gl.cc
>>>               obj/cef/cefclient/osr_render_handler_win_gl.obj

lld-link: error: undefined symbol: public: void __cdecl client::OsrRenderer::Cleanup(void)
>>> referenced by ../../cef/tests/cefclient/browser/osr_render_handler_win_gl.cc
>>>               obj/cef/cefclient/osr_render_handler_win_gl.obj
ninja: build stopped: subcommand failed.

I can probably figure that out but thought I would post in case anyone else sees the same.
rjxray
Expert
 
Posts: 115
Joined: Wed Jun 07, 2017 4:31 am

Re: CEF offscreen rendering with shared textures using skia

Postby rjxray » Mon Feb 05, 2024 8:21 am

OK, I see there has been an update since I cloned, will retry
rjxray
Expert
 
Posts: 115
Joined: Wed Jun 07, 2017 4:31 am

Re: CEF offscreen rendering with shared textures using skia

Postby reito » Mon Feb 05, 2024 8:30 am

rjxray wrote:OK, I see there has been an update since I cloned, will retry


Yeah, the latest commit fixed that. It was a bug introduced when fixing a bug for macOS LOL. You can git pull in cef and build again with --no-update
reito
Techie
 
Posts: 17
Joined: Sat Jan 27, 2024 11:19 pm

Re: CEF offscreen rendering with shared textures using skia

Postby rjxray » Tue Feb 06, 2024 4:33 am

I have it built now and cefclient runs well with --shared-texture-enabled, but if I turn on off screen rendering with --off-screen-rendering-enabled I hit the check in OsrRenderHandlerWinD3D11::OnPaint
OsrRenderHandlerWinD3D11::OnAcceleratedPaint is never called.

Should it be called, is off screen rendering implemented for shared textures?
rjxray
Expert
 
Posts: 115
Joined: Wed Jun 07, 2017 4:31 am

Re: CEF offscreen rendering with shared textures using skia

Postby reito » Tue Feb 06, 2024 5:48 am

I always use --off-screen-rendering-enabled with --shared-texture-enabled, what is the expected behaviour if only shared-texture-enabled present?
reito
Techie
 
Posts: 17
Joined: Sat Jan 27, 2024 11:19 pm

Re: CEF offscreen rendering with shared textures using skia

Postby reito » Tue Feb 06, 2024 5:59 am

I tried `.\chromium\src\out\Debug_GN_x64\cefclient.exe --transparent-painting-enabled --shared-texture-enabled` and `.\chromium\src\out\Debug_GN_x64\cefclient.exe --transparent-painting-enabled --shared-texture-enabled --off-screen-rendering-enabled` both are working? and shared_texture is only enabled when off-screen enabled.
reito
Techie
 
Posts: 17
Joined: Sat Jan 27, 2024 11:19 pm

Re: CEF offscreen rendering with shared textures using skia

Postby rjxray » Tue Feb 06, 2024 6:05 am

I always use --off-screen-rendering-enabled, but the only way I could stop it crashing was to remove the flag.
I guess there must be some issue with my build.
The build command was
python3 automate-git.py --download-dir=. --branch=master --checkout=master-osr --url=https://reitovo@bitbucket.org/reitovovo/cef.git --force-build --x64-build --with-pgo-profiles
It ran through to completion and created the binary distribution
I'm running on the binary distribution so all I can see is the call stack coming from CefRenderHandlerCppToC::Get(self)->OnPaint.
I will have to returrn to the build server and check it with Visual Studio
rjxray
Expert
 
Posts: 115
Joined: Wed Jun 07, 2017 4:31 am

PreviousNext

Return to Support Forum

Who is online

Users browsing this forum: No registered users and 211 guests