Open Deins opened 6 years ago
Ok this issue is really weird and i am almost starting to think it is compiler bug or something like that, and not nuklear fault. The issue only happens in optimized build, debug build runs fine .
the issue can be fixed with compiler/linker option -s "BINARYEN_TRAP_MODE='clamp'" but it adds some small performance overhead. If anybody wants to play around with web-assembly and try find the real cause for this issue I created a minimalistic example here: https://github.com/Deins/nuklear_wasm_bug_test
How does it behave with -O2
? I'm asking, because e.g. RedHat compiles the whole Enterprise Linux and packages with -O2
and not -O3
, because -O3
makes some unsafe optimizations. Not sure though whether emcc
does also all possible safe optimizations for -O2
and turns on some unsafe optimizations for -O3
.
the issue can be fixed with compiler/linker option -s "BINARYEN_TRAP_MODE='clamp'" but it adds some small performance overhead. If anybody wants to play around with web-assembly and try find the real cause for this issue I created a minimalistic example here: https://github.com/Deins/nuklear_wasm_bug_test
Your post just saved my day and I managed to push out my entry for LD43, but still it looks like it's very slow on Windows, while on macOS it works fine.
It would be nice to correct the real issue though. It looks like most of them are just integer overflows.
I opened a new issue there https://github.com/vurtun/nuklear/issues/774 with all the information I've put together over the past weekend.
Hi, when i compile this library to web assembly (using emscripten) some functions cause nuklear to crash. For example nk_label_colored crashes when finishing frame (inside nk_convert) with error: chrome:
firefox:
Regular labels work without problems. Also x86 or x64 builds and runs without any problems. I have integrated nuklear in my own opengl pipeline, but that doesn't seem to be the problem, as the nuklear crashes when building the vertex buffers internally. I haven't really learned how to debug wasm, however i found that the crashing instruction lays inside nk_draw_vertex near the while cycle or in the nk_draw_vertex_layout_element_is_end_of_layout. Does nuklear intentionally use integer overflow? Or maybe use some unaligned reads or something other unportable which could cause these problems?
P.S. asm.js build with emscripten also runs without problems.
example code: