More wasm things, high-dpi browser tests

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2022-07-06 15:17:27 +01:00
parent 5370e2ad6e
commit 5ed8eb4731
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
12 changed files with 61 additions and 53 deletions

View file

@ -64,6 +64,7 @@ DGL_EXTRA_ARGS = \
NVG_DISABLE_SKIPPING_WHITESPACE=true \
NVG_FONT_TEXTURE_FLAGS=NVG_IMAGE_NEAREST \
USE_NANOVG_FBO=true \
ASM_EXCEPTIONS=true \
WINDOWS_ICON_ID=401
# --------------------------------------------------------------

2
carla

@ -1 +1 @@
Subproject commit ca15445429d7ff872fd40db23e24840cc6b90436
Subproject commit 1ee091f4cc42fcf25d5064e6b9ebd569038684fe

5
deps/Makefile vendored
View file

@ -10,6 +10,7 @@
DISTRHO_NAMESPACE = CardinalDISTRHO
DGL_NAMESPACE = CardinalDGL
USE_NANOVG_FBO = true
WASM_EXCEPTIONS = true
include ../dpf/Makefile.base.mk
# --------------------------------------------------------------
@ -62,10 +63,6 @@ BUILD_CXX_FLAGS += -fno-finite-math-only -fno-strict-aliasing
# 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
# --------------------------------------------------------------
# override VCV arch.mk stuff so we can build more architectures

2
dpf

@ -1 +1 @@
Subproject commit c2938c02994988bd5dde4c4cbba9951709789ee8
Subproject commit b63db742200341b91358c14a7290104cb97d5613

View file

@ -21,7 +21,6 @@
# include_next <mmintrin.h>
#elif defined(__EMSCRIPTEN__)
# include <wasm_simd128.h>
// # include_next <pmmintrin.h>
#else
# include "../sse2neon/sse2neon.h"
#endif

View file

@ -23,16 +23,6 @@
#elif defined(__EMSCRIPTEN__)
# include_next <pmmintrin.h>
// NOTE these have been verified to be unused (included for ValleyAudio builds)
// static inline
// __m64 _mm_and_si64(__m64 a, __m64 b) { return a; }
//
// static inline
// __m64 _mm_andnot_si64(__m64 a, __m64 b) { return a; }
//
// static inline
// __m64 _mm_or_si64(__m64 a, __m64 b) { return a; }
static inline
__m64 _mm_set1_pi16(short w)
{
@ -48,25 +38,6 @@ void __builtin_ia32_pause()
__asm__ __volatile__("isb\n");
}
static inline
__m64 _mm_and_si64(__m64 a, __m64 b)
{
return vreinterpret_s64_s32(vand_s32(vreinterpret_s32_m64(a), vreinterpret_s32_m64(b)));
}
static inline
__m64 _mm_andnot_si64(__m64 a, __m64 b)
{
// *NOTE* argument swap
return vreinterpret_s64_s32(vbic_s32(vreinterpret_s32_m64(b), vreinterpret_s32_m64(a)));
}
static inline
__m64 _mm_or_si64(__m64 a, __m64 b)
{
return vreinterpret_s64_s32(vorr_s32(vreinterpret_s32_m64(a), vreinterpret_s32_m64(b)));
}
static inline
__m64 _mm_set1_pi16(short w)
{

View file

@ -287,7 +287,7 @@ struct SassyScopeWidget : ImGuiWidget {
do_show_scope_window(module != nullptr ? &module->scope : getFakeScopeInstance(), scaleFactor);
}
void onButton(const ButtonEvent& e)
void onButton(const ButtonEvent& e) override
{
// if mouse press is over draggable areas, do nothing so event can go to Rack
if (e.action == GLFW_PRESS)

View file

@ -10,6 +10,7 @@
DISTRHO_NAMESPACE = CardinalDISTRHO
DGL_NAMESPACE = CardinalDGL
USE_NANOVG_FBO = true
WASM_EXCEPTIONS = true
include ../dpf/Makefile.base.mk
# --------------------------------------------------------------
@ -114,10 +115,6 @@ 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

@ -53,6 +53,7 @@ DGL_NAMESPACE = CardinalDGL
NVG_DISABLE_SKIPPING_WHITESPACE = true
NVG_FONT_TEXTURE_FLAGS = NVG_IMAGE_NEAREST
USE_NANOVG_FBO = true
WASM_EXCEPTIONS = true
include ../../dpf/Makefile.base.mk
# --------------------------------------------------------------
@ -194,10 +195,6 @@ 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
@ -210,9 +207,9 @@ BASE_FLAGS += -Wno-unused-variable
ifeq ($(WASM),true)
LINK_FLAGS += --preload-file=./resources
LINK_FLAGS += -sALLOW_MEMORY_GROWTH
LINK_FLAGS += -sEXPORTED_RUNTIME_METHODS=FS,ccall
LINK_FLAGS += -sEXPORTED_RUNTIME_METHODS=FS,cwrap
LINK_FLAGS += -sINITIAL_MEMORY=64Mb
LINK_FLAGS += -sLZ4=1
# LINK_FLAGS += -sLZ4=1
LINK_FLAGS += --shell-file=../emscripten/shell.html
else ifeq ($(HAIKU),true)
LINK_FLAGS += -lpthread

View file

@ -3,10 +3,13 @@
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="Cardinal" />
<meta name="theme-color" content="#111111">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1" user-scalable="no">
<title>Cardinal Synth</title>
<style>
html {
background-color: #111;
background-color: #111111;
color: #eee;
}
body, canvas {
@ -14,16 +17,36 @@
margin: 0;
}
#canvas_file_open,
#canvas_file_save {
#canvas_file_open {
display: none;
}
#canvas_wrapper {
display: none;
image-rendering: pixelated;
image-rendering: crisp-edges;
position: absolute;
width: 100vw;
height: 100vh;
}
@media (min-resolution: 2dppx) {
#canvas_wrapper {
scale: calc(1/2);
width: 200vw;
height: 200vh;
left: -50vw;
top: -50vh;
}
}
@media (min-resolution: 3dppx) {
#canvas_wrapper {
scale: calc(1/3);
width: 300vw;
height: 300vh;
left: -100vw;
top: -100vh;
}
}
.emscripten {
display: block;
@ -79,7 +102,6 @@
</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>

View file

@ -114,6 +114,7 @@ struct FileButton : MenuButton {
patchUtils::loadTemplateDialog();
}));
#ifndef DISTRHO_OS_WASM
menu->addChild(createMenuItem("Open / Import...", RACK_MOD_CTRL_NAME "+O", []() {
patchUtils::loadDialog();
}));
@ -126,6 +127,23 @@ struct FileButton : MenuButton {
menu->addChild(createMenuItem("Save as / Export...", RACK_MOD_CTRL_NAME "+Shift+S", []() {
patchUtils::saveAsDialog();
}));
#else
menu->addChild(createMenuItem("Import patch...", RACK_MOD_CTRL_NAME "+O", []() {
patchUtils::loadDialog();
}));
menu->addChild(createMenuItem("Import selection...", "", [=]() {
patchUtils::loadSelectionDialog();
}, false, true));
menu->addChild(createMenuItem("Save and download compressed", RACK_MOD_CTRL_NAME "+Shift+S", []() {
patchUtils::saveAsDialog();
}));
menu->addChild(createMenuItem("Save and download uncompressed", "", []() {
patchUtils::saveAsDialogUncompressed();
}));
#endif
menu->addChild(createMenuItem("Revert", RACK_MOD_CTRL_NAME "+" RACK_MOD_SHIFT_NAME "+O", []() {
patchUtils::revertDialog();
@ -151,16 +169,18 @@ struct FileButton : MenuButton {
}
#endif
#ifndef DISTRHO_OS_WASM
menu->addChild(new ui::MenuSeparator);
// Load selection
menu->addChild(createMenuItem("Import selection", "", [=]() {
menu->addChild(createMenuItem("Import selection...", "", [=]() {
patchUtils::loadSelectionDialog();
}, false, true));
menu->addChild(createMenuItem("Export uncompressed json...", "", []() {
patchUtils::saveAsDialogUncompressed();
}));
#endif
if (!demoPatches.empty())
{
@ -182,13 +202,15 @@ struct FileButton : MenuButton {
}));
}
#ifndef DISTRHO_OS_WASM
if (isStandalone) {
menu->addChild(new ui::MenuSeparator);
menu->addChild(createMenuItem("Quit", RACK_MOD_CTRL_NAME "+Q", []() {
APP->window->close();
}));
};
}
#endif
}
};

View file

@ -299,11 +299,13 @@ void Scene::onHoverKey(const HoverKeyEvent& e) {
patchUtils::revertDialog();
e.consume(this);
}
#ifndef DISTRHO_OS_WASM
if (e.keyName == "s" && (e.mods & RACK_MOD_MASK) == RACK_MOD_CTRL) {
// NOTE: will do nothing if path is empty, intentionally
patchUtils::saveDialog(APP->patch->path);
e.consume(this);
}
#endif
if (e.keyName == "s" && (e.mods & RACK_MOD_MASK) == (RACK_MOD_CTRL | GLFW_MOD_SHIFT)) {
patchUtils::saveAsDialog();
e.consume(this);