Cleanup some more CI details, auto-load nosimd wasm

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2023-04-23 12:20:52 +02:00
parent 26e206f3d8
commit 5a53cd37b8
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
6 changed files with 103 additions and 230 deletions

View file

@ -219,7 +219,7 @@ endif
endif
ifeq ($(WASM),true)
WASM_RESOURCES = $(LV2_RESOURCES)
WASM_RESOURCES = $(TARGET_DIR)/$(NAME).html $(LV2_RESOURCES)
ifneq ($(CARDINAL_VARIANT),mini)
WASM_RESOURCES += $(CURDIR)/lv2/fomp.lv2/manifest.ttl
@ -256,6 +256,10 @@ else ifneq ($(CARDINAL_VARIANT),mini)
FORCE_NATIVE_AUDIO_FALLBACK = true
endif
ifeq ($(WASM),true)
APP_EXT = .js
endif
USE_VST2_BUNDLE = true
USE_CLAP_BUNDLE = true
include ../../dpf/Makefile.plugins.mk
@ -283,10 +287,8 @@ LINK_FLAGS += -sINITIAL_MEMORY=64Mb
LINK_FLAGS += -sLZ4=1
ifeq ($(CARDINAL_VARIANT),mini)
LINK_FLAGS += --shell-file=../emscripten/CardinalMini.html
LINK_FLAGS += --preload-file=../../bin/CardinalMini.lv2/resources@/resources
else
LINK_FLAGS += --shell-file=../emscripten/CardinalNative.html
LINK_FLAGS += --preload-file=../../bin/CardinalNative.lv2/resources@/resources
LINK_FLAGS += --preload-file=./jsfx
LINK_FLAGS += --preload-file=./lv2
@ -434,6 +436,10 @@ $(TARGET_DIR)/%.app/Contents/Resources/distrho.icns: ../../utils/distrho.icns
# Extra rules for wasm resources
ifeq ($(WASM),true)
$(TARGET_DIR)/$(NAME).html: ../emscripten/$(NAME).html
-@mkdir -p $(shell dirname $@)
cp $< $@
$(CURDIR)/lv2/fomp.lv2/manifest.ttl: $(TARGET_DIR)/$(NAME).lv2/resources/PluginManifests/Cardinal.json
wget -O - https://falktx.com/data/wasm-things-2022-08-15.tar.gz | tar xz -C $(CURDIR)
touch $@

View file

@ -115,9 +115,6 @@
if (typeof(WebAssembly) === "undefined") {
wasmErrors.push('WebAssembly unsupported');
} else {
if (!WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11]))) {
wasmErrors.push('Bulk Memory Operations unsupported');
}
if (!WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,2,8,1,1,97,1,98,3,127,1,6,6,1,127,1,65,0,11,7,5,1,1,97,3,1]))) {
wasmErrors.push('Importable/Exportable mutable globals unsupported');
}
@ -188,8 +185,19 @@
if (text) console.error('[post-exception status] ' + text);
};
};
var jsModuleName;
if (!WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]))) {
jsModuleName = "CardinalMini-nosimd.js";
} else {
jsModuleName = "CardinalMini.js";
}
var jsModuleScript = document.createElement('script');
jsModuleScript.setAttribute('async', true);
jsModuleScript.setAttribute('src', jsModuleName);
jsModuleScript.setAttribute('type','text/javascript');
document.head.appendChild(jsModuleScript);
}
</script>
{{{ SCRIPT }}}
</body>
</html>

View file

@ -115,15 +115,9 @@
if (typeof(WebAssembly) === "undefined") {
wasmErrors.push('WebAssembly unsupported');
} else {
if (!WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11]))) {
wasmErrors.push('Bulk Memory Operations unsupported');
}
if (!WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,2,8,1,1,97,1,98,3,127,1,6,6,1,127,1,65,0,11,7,5,1,1,97,3,1]))) {
wasmErrors.push('Importable/Exportable mutable globals unsupported');
}
if (!WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]))) {
wasmErrors.push('Fixed-Width SIMD unsupported');
}
}
if (wasmErrors.length !== 0) {
@ -191,8 +185,19 @@
if (text) console.error('[post-exception status] ' + text);
};
};
var jsModuleName;
if (!WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]))) {
jsModuleName = "CardinalNative-nosimd.js";
} else {
jsModuleName = "CardinalNative.js";
}
var jsModuleScript = document.createElement('script');
jsModuleScript.setAttribute('async', true);
jsModuleScript.setAttribute('src', jsModuleName);
jsModuleScript.setAttribute('type','text/javascript');
document.head.appendChild(jsModuleScript);
}
</script>
{{{ SCRIPT }}}
</body>
</html>