Is it possible to run complex browser program (including WebGL, SDL and so on) such as Unity3D WebGL build in pure JS shell?

129 views
Skip to first unread message

ziwu...@gmail.com

unread,
Sep 13, 2016, 4:50:43 AM9/13/16
to emscripten-discuss
Hi

I noticed that there is a HEADLESS option in setting.js, which says to "shim code that tries to 'fake' a browser environment", and seems to add src/headless.js and src/headlessCanvas.js to the generated js file.
I tried it on the Unity3D WebGL build, but found that there are still many "undefined" functions and variables, for example some WebGL function calls, XMLHttpRequest and other dom nodes...

Do we have any other flags or setting or tools, to help run the complex browser program in JS shell?
Or is it possible to improve the HEADLESS=1 option to do so?

Alon Zakai

unread,
Sep 13, 2016, 1:03:22 PM9/13/16
to emscripten-discuss
HEADLESS is very partial, yes. It's basically enough to run basic GL apps, and I made sure BananaBread can run. That was useful for testing. But for other things it's likely more things would need to be added.

What is your goal, btw?

--
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 emscripten-discuss+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ziwu...@gmail.com

unread,
Sep 13, 2016, 9:42:43 PM9/13/16
to emscripten-discuss
I'm trying to run the Unity WebGL benchmark (http://beta.unity3d.com/jonas/benchmark2015/) in a pure JavaScript shell like Google d8 or SpiderMonkey js, because I'm more interested in the performance of asm.js code rather than the WebGL rendering part.
But I haven't found an "official" way to do this :(

在 2016年9月14日星期三 UTC+8上午1:03:22,Alon Zakai写道:

ziwu...@gmail.com

unread,
Sep 14, 2016, 3:09:00 AM9/14/16
to emscripten-discuss
Also from my web search it seems that I should use "--embed-file" instead of "--preload-file" to get rid of the XMLHttpRequest in file system, since I'm outside the browser environment... Is this the recommended way?


在 2016年9月14日星期三 UTC+8上午1:03:22,Alon Zakai写道:
HEADLESS is very partial, yes. It's basically enough to run basic GL apps, and I made sure BananaBread can run. That was useful for testing. But for other things it's likely more things would need to be added.

Alon Zakai

unread,
Sep 14, 2016, 1:22:08 PM9/14/16
to emscripten-discuss
Yes, embedding the file is the simplest thing. (Very large files might be an issue, though, NODEFS might help in the shell.)

To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

ziwu...@gmail.com

unread,
Sep 20, 2016, 9:55:55 PM9/20/16
to emscripten-discuss
Thanks Alon, for the very useful advice.
I still cannot completely run the Unity WebGL benchmark in pure JS shell, because there're too many things relying on the browser.... But thank you very much!

在 2016年9月15日星期四 UTC+8上午1:22:08,Alon Zakai写道:
Yes, embedding the file is the simplest thing. (Very large files might be an issue, though, NODEFS might help in the shell.)
On Wed, Sep 14, 2016 at 12:08 AM, <ziwu...@gmail.com> wrote:
Also from my web search it seems that I should use "--embed-file" instead of "--preload-file" to get rid of the XMLHttpRequest in file system, since I'm outside the browser environment... Is this the recommended way?

在 2016年9月14日星期三 UTC+8上午1:03:22,Alon Zakai写道:
HEADLESS is very partial, yes. It's basically enough to run basic GL apps, and I made sure BananaBread can run. That was useful for testing. But for other things it's likely more things would need to be added.

What is your goal, btw?
On Tue, Sep 13, 2016 at 1:50 AM, <ziwu...@gmail.com> wrote:
Hi

I noticed that there is a HEADLESS option in setting.js, which says to "shim code that tries to 'fake' a browser environment", and seems to add src/headless.js and src/headlessCanvas.js to the generated js file.
I tried it on the Unity3D WebGL build, but found that there are still many "undefined" functions and variables, for example some WebGL function calls, XMLHttpRequest and other dom nodes...

Do we have any other flags or setting or tools, to help run the complex browser program in JS shell?
Or is it possible to improve the HEADLESS=1 option to do so?

--
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 emscripten-discuss+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages