how does chrome deal with multiple native clients updating in the same page

46 views
Skip to first unread message

Slim Maalej

unread,
Apr 19, 2016, 3:34:54 AM4/19/16
to Native-Client-Discuss
I need some help with opengl native clients  in chrome.  

i have a native client which pushes updates to chrome. it runs perfect at 60 fps. when i instantiate 4 clients in the same page chrome  is not able to keep up with speed and callbacks are delayed as a result my native clients are running low fps while chrome runs at ~60fps.
i was wondering will chrome try to generate a new frame for the window every time i push an update from every native client? in that case how do i  implement a sync between the native clients?
thanks in advance!

Ben Smith

unread,
Apr 19, 2016, 1:56:37 PM4/19/16
to Native-Client-Discuss
I'm guessing that your modules are being serialized by access to the single JavaScript thread. If this is true, there's probably not much you can do to fix it. Have you tried running multiple tabs all loading the same page? Does that run at full speed?

Slim Maalej

unread,
Apr 20, 2016, 2:16:13 PM4/20/16
to Native-Client-Discuss
Thanks for the reply.
it seems indeed that everything is running in the context of the Module. the native interface does not execute swapBuffers in case the tab is not active so rendering stops in the inactive tabs.
i had tried to make the second instance not call the swap buffer so having two instances but only one driving the swap buffer. and surprisingly enough the framerate of instance where the swapbuffer is called drops to half. it is like if chrome foresees room for the updates of the second instance. i can't understand how the chrome logic works wtr to rendering updates from multiple elements in the page.
any help is more than welcome.

John Bauman

unread,
Apr 21, 2016, 6:04:14 PM4/21/16
to native-cli...@googlegroups.com
Chrome tries to draw at 60fps (or whatever the refresh rate of the monitor is). For every frame, it'll pick up new updates from whatever Native client modules have called SwapBuffers. The main reasons it'll draw at less than 60fps are
a) If no content changes during a frame then it'll be skipped
b) If the previous frame took too long to complete (GPU work or CPU work) then it can delay the next frame. Note that a context that does GL rendering during a frame without a SwapBuffers still causes GPU work to be done.

There's no way to guarantee that updates to multiple Native Client instances happen at the exact same time. The best you can do is probably to try to do glFlush() after rendering in each context, then trying to do SwapBuffers at exactly the same time in every instance. 

--
You received this message because you are subscribed to the Google Groups "Native-Client-Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to native-client-di...@googlegroups.com.
To post to this group, send email to native-cli...@googlegroups.com.
Visit this group at https://groups.google.com/group/native-client-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages