From 31f929caa2bc8422c0a6bb50f81500e1f4db101b Mon Sep 17 00:00:00 2001 From: eska Date: Fri, 11 Nov 2016 03:48:13 +0100 Subject: Clarify a NULL comparison 'TreeItem::get_children()' does not return the child count, but rather a pointer to the children. This comparison caused an error during WebAssembly builds using the LLVM backend path. --- scene/gui/tree.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 912371142f..d974e09275 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1331,7 +1331,7 @@ int Tree::draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2& int root_ofs = children_pos.x + (hide_folding?cache.hseparation:cache.item_margin); int parent_ofs = p_pos.x + (hide_folding?cache.hseparation:cache.item_margin); Point2i root_pos = Point2i(root_ofs, children_pos.y + label_h/2)-cache.offset+p_draw_ofs; - if (c->get_children() > 0) + if (c->get_children() != NULL) root_pos -= Point2i(cache.arrow->get_width(),0); Point2i parent_pos = Point2i(parent_ofs - cache.arrow->get_width()/2, p_pos.y + label_h/2 + cache.arrow->get_height()/2)-cache.offset+p_draw_ofs; -- cgit v1.2.3 From 82addf2ffe18c49d437ee6d425e3470817f0dc85 Mon Sep 17 00:00:00 2001 From: eska Date: Fri, 11 Nov 2016 03:58:03 +0100 Subject: Enable memory growth in WebAssembly builds This allows setting TOTAL_MEMORY during runtime at the cost of reserving a bit more memory. --- platform/javascript/detect.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index 9bc204a94a..1ee3358888 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -76,6 +76,7 @@ def configure(env): if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"): env.opus_fixed_point = "yes" + # These flags help keep the file size down env.Append(CPPFLAGS=["-fno-exceptions", '-DNO_SAFE_CAST', '-fno-rtti']) env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DPTHREAD_NO_RENAME', '-DNO_FCNTL', '-DMPC_FIXED_POINT', '-DTYPED_METHOD_BIND', '-DNO_THREADS']) env.Append(CPPFLAGS=['-DGLES2_ENABLED']) @@ -86,6 +87,12 @@ def configure(env): if env['wasm'] == 'yes': env.Append(LINKFLAGS=['-s', 'BINARYEN=1']) env.Append(LINKFLAGS=['-s', '\'BINARYEN_METHOD="native-wasm"\'']) + # Maximum memory size is baked into the WebAssembly binary during + # compilation, so we need to enable memory growth to allow setting + # TOTAL_MEMORY at runtime. The value set at runtime must be higher than + # what is set during compilation, check TOTAL_MEMORY in Emscripten's + # src/settings.js for the default. + env.Append(LINKFLAGS=['-s', 'ALLOW_MEMORY_GROWTH=1']) env["PROGSUFFIX"] += ".webassembly" else: env.Append(CPPFLAGS=['-s', 'ASM_JS=1']) -- cgit v1.2.3 From d87b1d1338472514e96c3cd8857d050d54a9d1e7 Mon Sep 17 00:00:00 2001 From: eska Date: Sun, 13 Nov 2016 14:10:00 +0100 Subject: Remove explicit BINARYEN_METHOD for WebAssembly build This option is the default since Binaryen version 21. --- platform/javascript/detect.py | 1 - 1 file changed, 1 deletion(-) diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index 1ee3358888..35352becf8 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -86,7 +86,6 @@ def configure(env): if env['wasm'] == 'yes': env.Append(LINKFLAGS=['-s', 'BINARYEN=1']) - env.Append(LINKFLAGS=['-s', '\'BINARYEN_METHOD="native-wasm"\'']) # Maximum memory size is baked into the WebAssembly binary during # compilation, so we need to enable memory growth to allow setting # TOTAL_MEMORY at runtime. The value set at runtime must be higher than -- cgit v1.2.3