Jump to content

Webgl/babylonjs thread concurrency and safety


1glayfan
 Share

Recommended Posts

Hello,

In webgl app in general, assuming running on multi-core cpu, are the apps multi-threaded ?

If so, technically your callback function (like from user input) can be executed by a thread which is different from the one executing the main rendering loop.

Then is it not safe to edit a mesh directly in the callback ? Like disposing a mesh in the callback when the mesh is still in the scene being rendered continuously.

Does babylonjs provide the thread-safe synchronization for you, or you need to do this yourself ?

Thanks

Link to comment
Share on other sites

Thanks for the web worker info.

So it looks to me that web workers are indeed multi-threaded but run in different space from your web page so it can't access the dom and presumably the gl context. So this won't help in terms of parallelizing the rendering, but at least we can use them for other computation like doing AI or IO-bound ops like launching post/get to web services etc.

Link to comment
Share on other sites

What I meant to say was the web workers can't access the Dom nor webgl context. 

But similar to what you said, I believe it's technically possible to split the 3d computations into several web workers and combine the results in the end and feed it to the main rendering thread. Right?? 

Still an improvement than single thread for everything. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...