WebGL 2.0 and WebAssembly support?

Users and developers helping users with technical Pale Moon issues (Windows and other non-Linux O.S.). Please direct questions about the Linux version to the appropriate Linux board.

Moderators: trava90, satrow

Forum rules
This board is for technical/usage questions and troubleshooting for the Pale Moon browser only. The main focus here is on Pale Moon on Windows. Please direct your questions for Linux, Android and Mac to the dedicated boards.
Technical issues and questions not related to the Pale Moon browser should be posted in "technical chat"
Please keep off-topic and general discussion out of this board, thank you!
ninjapretzel

WebGL 2.0 and WebAssembly support?

Unread post by ninjapretzel » 2017-08-15, 01:19

Are these supported at all? Will there be support for them in the future?

I can get Webgl 1.0 to work, but I don't know if there is some kind of work around to get WebGL 2.0 features to work like with some other browsers while they had experemental support for it.

Same with Web Assembly, will there be support for it, or is there already an experemental flag I can flick on?

Thanks.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 24225
Joined: 2011-08-28, 17:27
Location: 58°2'16"N 14°58'31"E
Contact:

Re: WebGL 2.0 and WebAssembly support?

Unread post by Moonchild » 2017-08-15, 05:57

WebGL 2 implementation is incomplete in our platform at the moment, and disabled as a result. You can experiment with it by flipping on webgl.enable-prototype-webgl2

WASM is not something Pale Moon has at all, and won't have unless we move to using UXP as a back-end (long-term planning). WASM is also optional for sites to use, and going to be very browser-specific since it's basically pre-compiled Javascript code (which may even be a security concern since it'll be black box code). Not having WASM will cause slower initialization of pages that have ridiculous amounts of JS, but otherwise should not make any difference unless the website chooses to restrict themselves to it.
City of Heroes public server: https://www.moonshard.org/ -- Vote for it on cohservers.com

"If you want to build a better world for yourself, you have to be willing to build one for everybody." -- Coyote Osborne
Image

jez9999
Moonbather
Moonbather
Posts: 62
Joined: 2015-05-30, 19:35
Location: UK

Re: WebGL 2.0 and WebAssembly support?

Unread post by jez9999 » 2017-11-14, 18:38

Moonchild wrote:Not having WASM will cause slower initialization of pages that have ridiculous amounts of JS, but otherwise should not make any difference unless the website chooses to restrict themselves to it.
Doesn't WASM allow cross-compilation of something like C# to WASM browser code, allowing people not to code web stuff in JS at all? Unless I'm misunderstanding something I can definitely see people wanting to do that (I'd quite like to, in fact).

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 24225
Joined: 2011-08-28, 17:27
Location: 58°2'16"N 14°58'31"E
Contact:

Re: WebGL 2.0 and WebAssembly support?

Unread post by Moonchild » 2017-11-14, 22:05

jez9999 wrote:Doesn't WASM allow cross-compilation of something like C# to WASM browser code, allowing people not to code web stuff in JS at all? Unless I'm misunderstanding something I can definitely see people wanting to do that (I'd quite like to, in fact).
No, WASM itself doesn't allow cross-compilation of other languages; other transcoders do that to JavaScript, and WASM is simply an optimized delivery vessel for the resulting complex JavaScript. You're confusing WASM with things like EMScripten here. WASM doesn't have support for native translation of e.g. Java or C# (not yet, anyway, since there's no garbage collection possible).

To clarify the current situation: WASM pre-compiles asm.js JavaScript (a subset of JS) into pseudo-code; it's compiled on the server and delivered in its compiled state. asm.js delivery is delivered in its source state and compiled "just-in-time" by the browser. The resulting near-native code that ultimately runs in the browser will be very similar in terms of operation and performance, but browser-side compilation is skipped.

With WASM: C#/C++ -> EMScripten -> JavaScript (asm.js) -> WASM compiler -> WASM -> WASM-loader -> in-browser near-native code
Without WASM: C#/C++ -> EMScripten -> JavaScript (asm.js) -> JIT compiler -> in-browser near-native code

Colors: Red = server-side, Blue = browser-side
City of Heroes public server: https://www.moonshard.org/ -- Vote for it on cohservers.com

"If you want to build a better world for yourself, you have to be willing to build one for everybody." -- Coyote Osborne
Image

prenex
Newbie
Newbie
Posts: 3
Joined: 2017-11-21, 18:22

Re: WebGL 2.0 and WebAssembly support?

Unread post by prenex » 2017-11-21, 18:54

With WASM: C#/C++ -> EMScripten -> JavaScript (asm.js) -> WASM compiler -> WASM -> WASM-loader -> in-browser near-native code
Without WASM: C#/C++ -> EMScripten -> JavaScript (asm.js) -> JIT compiler -> in-browser near-native code
Actually this is not true as WebAssembly has clear bytecode specification for which it is indeed possible to compile directly. I literally plan to do the same with my own language too and I think soon (if not already) EMScripten will also have a chance to skip the asm.js step completely.

Until some language (like mine hahahaha - lol, surely) make some inpact and change the way how the web looks however it is very well valid that in most cases there will be a fallback. Personally however I would be very happy to have wasm so that I can look my extraspeedy pages in pale moon later when I start implementing the things a little bit more deeply if I have time.

Best regards,
Prenex

PS.: I have a 10 year old machine on which your browser is the biggest winner ever when it comes to overall performance. I think it is not because both being old or anything bad, but just that you are among the few who is not using an even more overbloated webkit fork and try to take care of resources properly. It would be awsome to have WASM support for being even faster. Having a clean look is actually secondary for my case, but not counting the small bugs pale moon is really the most awsome - other solutions are not so much comparable ever when it comes to saving performance and still having a full featured browser. Even things like midori run very much worse here on my machine ;-)

Subsentient

Re: WebGL 2.0 and WebAssembly support?

Unread post by Subsentient » 2017-11-26, 23:00

Indeed, WebAssembly would be a huge boost to Pale Moon. I think it's quickly going to become a necessity as well.
EMScripten might compile to asm.js, but WebAssembly can be much faster than asm.js, and given that all major browsers fully support WebAssembly now, I really wouldn't count on a fallback existing for that long, at least in some sites.

I'm interested in WebAssembly because it could allow me to write native C and C++ software that runs far, far better than asm.js ever could, allowing much more sophisticated code due to the substantially improved performance. I've never been a fan of web development, but this could suck me in.
Right now the engines aren't that great compared to asm.js, but I expect that to change quickly.

Please do seriously consider implementing WebAssembly in the near future, it would make me very happy.
Even a transliteration layer that converts webassembly to asm.js prior to execution would be a huge step to allay potential compatibility issues.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 24225
Joined: 2011-08-28, 17:27
Location: 58°2'16"N 14°58'31"E
Contact:

Re: WebGL 2.0 and WebAssembly support?

Unread post by Moonchild » 2017-11-27, 00:40

prenex wrote:Actually this is not true as WebAssembly has clear bytecode specification for which it is indeed possible to compile directly.
I haven't seen any compilers for that yet from any other language -- not surprising since the bytecode is, as I already stated, a delivery vessel that is pre-compiled and more compact. Pulling the bytecode apart, the underlying structure is still a subset of JS, which is run in the browser's JS engine -- also unsurprising, because it's not like browsers with the introduction of WASM have suddenly added a new language interpreter or what not.
So, the server-side may look simpler if there is eventually a direct transcoder that spits out WASM bytecode from different source languages, but in essence it will still remain a subset of JS that is also supported in source form by asm.js
Subsentient wrote:Even a transliteration layer that converts webassembly to asm.js prior to execution would be a huge step to allay potential compatibility issues.
That would probably not be very efficient, decompiling to source then recompiling internally again with Ion/asm.js, but it would be a potential workaround solution if websites start to only supply wasm code.
Subsentient wrote:WebAssembly can be much faster than asm.js
Not in execution. Only in initialization because, as explained, the browser-side compilation step is skipped. Whether it's delivered as binary bytecode or textual source won't matter for the final JITed code that runs in the JS engine.
City of Heroes public server: https://www.moonshard.org/ -- Vote for it on cohservers.com

"If you want to build a better world for yourself, you have to be willing to build one for everybody." -- Coyote Osborne
Image

User avatar
WilliamK
Fanatic
Fanatic
Posts: 170
Joined: 2018-02-23, 06:51

Re: WebGL 2.0 and WebAssembly support?

Unread post by WilliamK » 2018-06-25, 21:28

WebAssembly would be a huge boost to Pale Moon.
Changes in WebAssembly Could Render Meltdown and Spectre Browser Patches Useless

https://www.bleepingcomputer.com/news/security/changes-in-webassembly-could-render-meltdown-and-spectre-browser-patches-useless/

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 24225
Joined: 2011-08-28, 17:27
Location: 58°2'16"N 14°58'31"E
Contact:

Re: WebGL 2.0 and WebAssembly support?

Unread post by Moonchild » 2018-06-25, 21:37

WilliamK wrote:Changes in WebAssembly Could Render Meltdown and Spectre Browser Patches Useless
Browser makers created WebAssembly to improve the speed of delivery and performance of JavaScript code, but as a side effect, they also created a way for developers to port code from other high-level languages (such as C, C++, and others) into Wasm, and then run it inside a browser.
Let me clarify one thing here: speed of delivery is faster through WASM because JS is precompiled to bytecode, BUT performance of JS is the same once compiled, whether the source be WASM or plain old asm.js JavaScript code.
Also, the porting of other languages is precisely why WASM was created, not a side effect (emscriptn was one of the main drivers behind creating it, which is a transpiler for JS).

Without WASM, loading and starting complex transpiled code takes longer because it's not as compact to download and needs to be compiled in the browser "Just-in-Time", but once that process is complete you have machine code either way that runs at near-native speeds, regardless how it's delivered.
City of Heroes public server: https://www.moonshard.org/ -- Vote for it on cohservers.com

"If you want to build a better world for yourself, you have to be willing to build one for everybody." -- Coyote Osborne
Image

prenex
Newbie
Newbie
Posts: 3
Joined: 2017-11-21, 18:22

Re: WebGL 2.0 and WebAssembly support?

Unread post by prenex » 2018-11-26, 15:35

Go can compile directly to webasm, so do some other languages and an extra step is not necessary:
https://tinygo.readthedocs.io/en/latest ... embly.html

Some go as far as they even write wasm by hand :-)
https://blog.scottlogic.com/2018/04/26/ ... -hand.html

I keep to my knowledge that practically you are right that most browsers just use the already existing asm.js engines, but it is not necessary. Also for compiler writers it is easier (at least to me it is) to support only webasm directly and not needing to fuss with asm.js at all so I think with tooling growing around this will be more and more accepted. There might be a chance too that new things might be added to wasm without introducing them in asm.js in the future I think if most browsers will end up supporting the latter directly and only supporting asm.js as a fallback.

For example one can write wasm runner in a browser from scratch and give only fallback using a regular javascript engine that would run even asm.js anyway if things once become that widespread in the future. I am not telling it will happen, just that wasm is defined in itself and only have ties with asm.js for practical reasons of course (who would not reuse code?)

yami_
Astronaut
Astronaut
Posts: 502
Joined: 2018-04-26, 11:05

Re: WebGL 2.0 and WebAssembly support?

Unread post by yami_ » 2018-11-26, 16:57

prenex wrote:Go can compile directly to webasm, so do some other languages and an extra step is not necessary:
https://tinygo.readthedocs.io/en/latest ... embly.html
This not Go, it is a Go-like language that uses LLVM as the backed. I would guess they use Emscripten to get the WebAssembly version. If that is true then the extra step still exist. However it is worth noting that the official Go toolchain has experimental support for targeting WebAssembly. In this case the WebAssembly binary is produced directly by the Go compiler.
Last edited by yami_ on 2018-11-26, 16:57, edited 1 time in total.
cat came back from Berkeley waving flags -- rob pike

User avatar
Tomaso
Board Warrior
Board Warrior
Posts: 1264
Joined: 2015-07-23, 16:09
Location: Norway

Re: WebGL 2.0 and WebAssembly support?

Unread post by Tomaso » 2018-11-27, 21:02

I gave this a try:
https://svpvodps-vh.akamaihd.net/helge-ingstad/
It works with WebAssembly enabled in about:config (javascript.options.wasm = true), but during the loading process, Pale Moon throws a "not responding" message.
Last edited by Tomaso on 2018-11-27, 21:06, edited 2 times in total.

User avatar
moonbat
Fanatic
Fanatic
Posts: 152
Joined: 2015-12-09, 15:45
Location: Australia

Re: WebGL 2.0 and WebAssembly support?

Unread post by moonbat » 2019-06-24, 13:53

So are either of these supported now? Was having a discussion on a Facebook group with someone about this in the context of switching to Palemoon, they need it for development.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

yami_
Astronaut
Astronaut
Posts: 502
Joined: 2018-04-26, 11:05

Re: WebGL 2.0 and WebAssembly support?

Unread post by yami_ » 2019-06-24, 14:04

Both are supported, but WASM must be manually enabled.
cat came back from Berkeley waving flags -- rob pike

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 24225
Joined: 2011-08-28, 17:27
Location: 58°2'16"N 14°58'31"E
Contact:

Re: WebGL 2.0 and WebAssembly support?

Unread post by Moonchild » 2019-06-24, 15:34

WebGL2 is fully supported in all UXP applications.

WASM support is basic (1.0) and as stated disabled by default. It's not a recommended technology because of the obvious issues with malware (in-browser cryptominers are all delivered as WASM) and code obfuscation, as well as the need to rely on non-native compilation of code which may not be 100% compatible as-delivered.
City of Heroes public server: https://www.moonshard.org/ -- Vote for it on cohservers.com

"If you want to build a better world for yourself, you have to be willing to build one for everybody." -- Coyote Osborne
Image

Post Reply