Hi,


I am new to Emscripten so I apologise in advance if some of my questions 
are commonly known or stupid … .


I have added an (very experimental) multi-threaded path-tracer to my Open 
Source WebGL/OpenGL based application framework Visual Graphics. I have 
several problems and some questions. The application is at 
https://visualgraphics.tv/apps/cornellbox/.


I build the C++ source via the latest incoming emscripten version, command 
line to build the tracer is


../incoming/emcc --bind ../../vglib/tracer/vg-bindings.cpp -o 
../../vglib/vglib_a.js -s USE_PTHREADS=2 --memory-init-file 0 -s 
TOTAL_MEMORY=100000000 -O3


Problems:


1) The generated code does not work on browsers who don’t support 
SharedMemoryBuffer. I get an messages like: "TypeError: undefined is not an 
object (evaluating 'global.Atomics.load’)” when loading vglib_a.js. This 
should work when -s USE_PTHREADS=2 is specified right ?


2) While creating the threads I sometimes (quite often) get the error 
message


Uncaught Error: Uncaught Typed arrays 2 must be run on a little-endian 
system

pthread-main.js:69 Uncaught TypeError: Runtime.establishStackSpace is not a 
function


The created thread is than not usable and when I try to join / delete it 
the browser hangs. Sometimes all threads get started ok, sometimes up to 4 
threads on my system fail to launch.


Questions:


1) Will memory eventually be able to grow in a threaded environment ? 
Preallocating is not always possible in a dynamic user driven environment.


2)  Will I be able to call into the main JavaScript context from a thread 
one day ? Problem is that I have a Node system for creating procedural 
textures / materials which is implement in JavaScript, now the tracer would 
need to pull the texture color from the Nodegraph (which is in JS) for the 
UV coordinate of the hitpoint … . I would much prefer to have the Node 
system stay in JavaScript due to the flexibility (new Nodes can be 
dynamically loaded from a DB etc.).


Thanks for any help and great work on Emscripten / WebAssembly!


<https://lh3.googleusercontent.com/-mjaMDfh02RI/V0AAKrVH1HI/AAAAAAAAABk/5QxXHeDe0X0aUGNpRqbq3b0fM-UkqMrbQCLcB/s1600/CB_Screenshot1.jpg>

-Markus


--

Markus Mönig

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to