Page 1 of 1

Questions regarding embedding CEF in a game

PostPosted: Wed Mar 22, 2017 6:43 pm
by Asadas
Hi! I need to integrate a browser in our game in the near future, so I'm trying to find out whether we can run CEF at high frame rates and synchronize it with the game rendering.
Already looked at the cef-client example, but so far I failed to get it running at more than 64 fps when offscreen is enabled, needs to handle 144+.

I'm currently thinking of a system like this:
- Game provides a render target for each open browser widget
- Browser draws to this render target using gpu rasterization
- Game reads from the render targets to draw the browser widgets

For the synchronization, I'd like CEF to draw exactly one frame for every frame drawn by the game.
Similar to using vsync, except that it will block until the game processed the browser widget.


Can this be done using CEF? Or maybe I'm completely on the wrong path here? Thanks!

Re: Questions regarding embedding CEF in a game

PostPosted: Wed Mar 22, 2017 9:27 pm
by magreenblatt
What is the point of such high frame rates when hardware operates at 60Hz?

Re: Questions regarding embedding CEF in a game

PostPosted: Wed Mar 22, 2017 9:29 pm
by magreenblatt
CEF does not currently support rendering to a GPU surface provided by the client application. See https://bitbucket.org/chromiumembedded/ ... ardware-gl

Re: Questions regarding embedding CEF in a game

PostPosted: Thu Mar 23, 2017 7:07 am
by Asadas
magreenblatt wrote:What is the point of such high frame rates when hardware operates at 60Hz?

Many players have 120 or 144hz monitors nowadays. I'm running a 100hz ultrawide myself, and things just feel a bit... smoother, I guess? It's nice.
But yes, if someone has a 60hz monitor, they'd run it at 60 fps.


magreenblatt wrote:CEF does not currently support rendering to a GPU surface provided by the client application. See https://bitbucket.org/chromiumembedded/ ... ardware-gl

Well that's a shame. I'll see if we can hack something here as drawing to a window already works.
Though it seems strange to me that this issue is basically stuck since 2015... it's an essential feature for integrating CEF in a high performance engine.

Re: Questions regarding embedding CEF in a game

PostPosted: Thu Mar 23, 2017 10:40 am
by magreenblatt
magreenblatt wrote:CEF does not currently support rendering to a GPU surface provided by the client application. See https://bitbucket.org/chromiumembedded/ ... ardware-gl

Well that's a shame. I'll see if we can hack something here as drawing to a window already works.
Though it seems strange to me that this issue is basically stuck since 2015... it's an essential feature for integrating CEF in a high performance engine.

There are a number of game engines that embed CEF currently (search Google for examples). It's unfortunately not possible to provide the optimal architecture for every use case.

Re: Questions regarding embedding CEF in a game

PostPosted: Thu Mar 23, 2017 10:49 am
by magreenblatt
Asadas wrote:
magreenblatt wrote:What is the point of such high frame rates when hardware operates at 60Hz?

Many players have 120 or 144hz monitors nowadays. I'm running a 100hz ultrawide myself, and things just feel a bit... smoother, I guess? It's nice.
But yes, if someone has a 60hz monitor, they'd run it at 60 fps.

Does Google Chrome run at 100FPS on your display? You can test with http://webglsamples.org/field/field.html

Re: Questions regarding embedding CEF in a game

PostPosted: Thu Mar 23, 2017 10:56 am
by Asadas
magreenblatt wrote:
Asadas wrote:
magreenblatt wrote:What is the point of such high frame rates when hardware operates at 60Hz?

Many players have 120 or 144hz monitors nowadays. I'm running a 100hz ultrawide myself, and things just feel a bit... smoother, I guess? It's nice.
But yes, if someone has a 60hz monitor, they'd run it at 60 fps.

Does Google Chrome run at 100FPS on your display? You can test with http://webglsamples.org/field/field.html


Yes, chrome runs at 100fps with g-sync. Actually so does the cef-client, but only when offscreen is disabled.