BabylonNative icon indicating copy to clipboard operation
BabylonNative copied to clipboard

Investigate web workers / web assembly

Open bghgary opened this issue 4 years ago • 6 comments

Make sure web workers work automatically in all the JS engines that we support.

One way to test is:

  • [ ] Try a glTF with Draco and see if it works (will test both web workers and web assembly) (draco compression will fallback if these things are not available, so make sure it is actually being used)

bghgary avatar Apr 10 '20 18:04 bghgary

should be done in conjunction of https://github.com/BabylonJS/BabylonNative/issues/219 In order to load draco.js script from js script.

CedricGuillemet avatar May 25 '20 12:05 CedricGuillemet

Win32/Chakra, this test is false: https://github.com/BabylonJS/Babylon.js/blob/5fb3378450f974fbb0d105c8e48f49b55fc9ce7f/src/Meshes/Compression/dracoCompression.ts#L305

CedricGuillemet avatar May 26 '20 15:05 CedricGuillemet

Is this under feature under development? Our project has several web workers and we're working out how we can port them to BN.

bnolan avatar May 30 '20 23:05 bnolan

Not currently, no. We do intend on adding this though.

bghgary avatar May 30 '20 23:05 bghgary

Ok awesome. We'll update this issue if we can contribute this code. Any gotchas we should look out for while implementing this? We'll basically spin up a std::thread and put an instance of the javascript engine in it and then use a mutex to push messages back and forward.

bnolan avatar May 31 '20 01:05 bnolan

I'm not exactly sure how to implement yet. A simple std::thread might be right or maybe it should be using a threadpool. As for message passing, a concurrent queue is more efficient. I suspect it will be useful to use arcana.cpp to do some of this, which, for example, has a concurrent queue implementation.

bghgary avatar Jun 01 '20 19:06 bghgary