More wasm details, basics mostly work now

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2022-07-06 02:02:22 +01:00
parent 034515190c
commit 5370e2ad6e
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
10 changed files with 103 additions and 49 deletions

View file

@ -44,7 +44,7 @@ struct AsyncDialog : OpaqueWidget
Label* label;
AsyncDialog(const char* const message)
{
{
setup(message);
struct AsyncDismissButton : Button {
@ -61,7 +61,7 @@ struct AsyncDialog : OpaqueWidget
}
AsyncDialog(const char* const message, const std::function<void()> action)
{
{
setup(message);
struct AsyncCancelButton : Button {
@ -131,7 +131,7 @@ struct AsyncDialog : OpaqueWidget
}
void draw(const DrawArgs& args) override
{
{
bndMenuBackground(args.vg, 0.0, 0.0, box.size.x, box.size.y, 0);
Widget::draw(args);
}
@ -261,13 +261,13 @@ struct AsyncTextInput : OpaqueWidget
}
void step() override
{
{
OpaqueWidget::step();
box.pos = parent->box.size.minus(box.size).div(2).round();
}
void draw(const DrawArgs& args) override
{
{
bndMenuBackground(args.vg, 0.0, 0.0, box.size.x, box.size.y, 0);
Widget::draw(args);
}

View file

@ -44,7 +44,7 @@ BASE_FLAGS += -DPRIVATE=
BASE_FLAGS += -I../dpf/dgl/src/nanovg
BASE_FLAGS += -I../dpf/distrho
BASE_FLAGS += -I../include
BASE_FLAGS += -I../include/neon-compat
BASE_FLAGS += -I../include/simd-compat
BASE_FLAGS += -IRack/include
ifeq ($(SYSDEPS),true)
BASE_FLAGS += -DCARDINAL_SYSDEPS
@ -81,14 +81,11 @@ ifeq ($(HAIKU),true)
BASE_FLAGS += -DCLOCK_MONOTONIC_RAW=CLOCK_MONOTONIC
endif
ifeq ($(WASM),true)
BASE_FLAGS += -DNANOVG_GLES2=1
BASE_FLAGS += -msse -msse2 -msse3 -msimd128
# FIXME
BASE_FLAGS += -DRTLD_DEEPBIND=0
else ifneq ($(HAIKU),true)
ifneq ($(WASM),true)
ifneq ($(HAIKU),true)
BASE_FLAGS += -pthread
endif
endif
ifeq ($(WINDOWS),true)
BASE_FLAGS += -D_USE_MATH_DEFINES
@ -117,6 +114,10 @@ BUILD_CXX_FLAGS += -DnsvgParseFromFile=nsvgParseFromFileCardinal
# Rack code is not tested for this flag, unset it
BUILD_CXX_FLAGS += -U_GLIBCXX_ASSERTIONS -Wp,-U_GLIBCXX_ASSERTIONS
ifeq ($(WASM),true)
BUILD_CXX_FLAGS += -fexceptions
endif
# --------------------------------------------------------------
# Rack files to build

View file

@ -143,7 +143,7 @@ BASE_FLAGS += -DPRIVATE=
BASE_FLAGS += -I..
BASE_FLAGS += -I../../dpf/dgl/src/nanovg
BASE_FLAGS += -I../../include
BASE_FLAGS += -I../../include/neon-compat
BASE_FLAGS += -I../../include/simd-compat
BASE_FLAGS += -I../Rack/include
ifeq ($(SYSDEPS),true)
BASE_FLAGS += -DCARDINAL_SYSDEPS
@ -164,12 +164,11 @@ ifeq ($(MOD_BUILD),true)
BASE_FLAGS += -DDISTRHO_PLUGIN_USES_MODGUI=1 -DDISTRHO_PLUGIN_MINIMUM_BUFFER_SIZE=0xffff
endif
ifeq ($(WASM),true)
BASE_FLAGS += -DNANOVG_GLES2=1
BASE_FLAGS += -msse -msse2 -msse3 -msimd128
else ifneq ($(HAIKU),true)
ifneq ($(WASM),true)
ifneq ($(HAIKU),true)
BASE_FLAGS += -pthread
endif
endif
ifeq ($(WINDOWS),true)
BASE_FLAGS += -D_USE_MATH_DEFINES
@ -195,6 +194,10 @@ endif
# Rack code is not tested for this flag, unset it
BUILD_CXX_FLAGS += -U_GLIBCXX_ASSERTIONS -Wp,-U_GLIBCXX_ASSERTIONS
ifeq ($(WASM),true)
BUILD_CXX_FLAGS += -fexceptions
endif
# --------------------------------------------------------------
# FIXME lots of warnings from VCV side
@ -205,8 +208,12 @@ BASE_FLAGS += -Wno-unused-variable
# extra linker flags
ifeq ($(WASM),true)
LINK_FLAGS += --preload-file=./resources -sALLOW_MEMORY_GROWTH -sINITIAL_MEMORY=32Mb -sLZ4=1 --shell-file=../emscripten/shell.html
# -sDISABLE_EXCEPTION_CATCHING=1
LINK_FLAGS += --preload-file=./resources
LINK_FLAGS += -sALLOW_MEMORY_GROWTH
LINK_FLAGS += -sEXPORTED_RUNTIME_METHODS=FS,ccall
LINK_FLAGS += -sINITIAL_MEMORY=64Mb
LINK_FLAGS += -sLZ4=1
LINK_FLAGS += --shell-file=../emscripten/shell.html
else ifeq ($(HAIKU),true)
LINK_FLAGS += -lpthread
else

View file

@ -14,6 +14,11 @@
margin: 0;
}
#canvas_file_open,
#canvas_file_save {
display: none;
}
#canvas_wrapper {
display: none;
width: 100vw;
@ -73,6 +78,8 @@
<progress value="0" max="100" id="progress" hidden=1></progress>
</div>
<div id="canvas_wrapper">
<input type="file" id="canvas_file_open" ></input>
<a href="#" id="canvas_file_save"></a>
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1></canvas>
</div>