DISTS: New Emscripten/WebAssembly dists target

This is an initial version of the emscripten build/dist target.
Many things are still missing, see dists/emscripten/README.md for
a detailed summary of what this provides and still misses
This commit is contained in:
Christian Kündig 2021-06-02 00:59:09 +02:00 committed by Eugene Sandulenko
parent 2f3b74e485
commit b7a2e22b0a
11 changed files with 608 additions and 1 deletions

6
.gitignore vendored
View File

@ -279,3 +279,9 @@ android_project
#Ignore snapcraft build artifacts
.snap
#Ignore emscripten build artifacts
dists/emscripten/emsdk-*/
dists/emscripten/libs/
dists/emscripten/games/
dists/emscripten/emsdk-*

View File

@ -180,7 +180,12 @@ void OpenGLSdlGraphics3dManager::setupScreen() {
// So check if the window needs to be recreated.
int currentSamples = 0;
#if defined(EMSCRIPTEN)
// SDL_GL_MULTISAMPLESAMPLES isn't available on the WebGL context (or not bridged in Emscripten?), let's just reset the windows every time
currentSamples = -1;
#else
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &currentSamples);
#endif
// When rendering to a framebuffer, MSAA is enabled on that framebuffer, not on the screen
int targetSamples = shouldRenderToFramebuffer() ? 0 : _antialiasing;

63
configure vendored
View File

@ -561,6 +561,9 @@ get_system_exe_extension() {
mingw* | *os2-emx)
_exeext=".exe"
;;
emscripten)
_exeext=".html"
;;
*)
_exeext=""
;;
@ -1720,6 +1723,12 @@ switch)
# Switch SDK has C++11 constructs so we must enable it
_use_cxx11=yes
;;
wasm32-*)
_endian=little # the endian check below fails, but emscripten is always little endian anyway
_host_os=emscripten
_host_cpu=wasm32
CXX="em++"
;;
wii)
_host_os=wii
_host_cpu=powerpc
@ -1806,6 +1815,12 @@ dreamcast)
exit 1
fi
;;
emscripten)
if test -z "$EMSDK"; then
echo "Please set EMSDK in your environment. export EMSDK=<path to emscripten sdk>"
exit 1
fi
;;
n64)
if test -z "$N64SDK"; then
echo "Please set N64SDK in your environment. export N64SDK=<path to n64 sdk>"
@ -2570,6 +2585,9 @@ case $_host_cpu in
amd64 | x86_64)
echo "x86_64"
;;
wasm32)
echo "wasm32"
;;
*)
echo "unknown ($_host_cpu)"
;;
@ -2893,6 +2911,25 @@ EOF
append_var LIBS "-lmm9"
append_var LIBS "-lnds9"
;;
emscripten)
add_line_to_config_mk 'EMSCRIPTEN = 1'
# mandatory emscripten flags
append_var LDFLAGS "-s MAX_WEBGL_VERSION=2 -s WEBGL2_BACKWARDS_COMPATIBILITY_EMULATION=1 -s ASYNCIFY -s FORCE_FILESYSTEM=1 -s ALLOW_MEMORY_GROWTH=1"
# enable emscripten-ports and set up paths accordingly
append_var LDFLAGS "-s USE_SDL=2 -s USE_SDL_MIXER=2 -s USE_OGG=1 -s USE_VORBIS=1 -s USE_LIBJPEG=1 -s USE_FREETYPE=1 -s USE_ZLIB"
_sdlpath="$EMSDK/upstream/emscripten/system/bin/"
_pngpath="$EMSDK/upstream/emscripten/cache/"
_freetypepath="$EMSDK/upstream/emscripten/cache/ports-builds/freetype/"
VORBIS_CFLAGS="-I$EMSDK/upstream/emscripten/cache//ports-builds/vorbis/include"
VORBIS_LIBS="-L$EMSDK/upstream/emscripten/cache//ports-builds/vorbis/lib"
FREETYPE2_CFLAGS="-I$_freetypepath/include"
_freetype_found="true"
if test "$_debug_build" = no; then
_optimization_level=-O3 -g4
else
_optimization_level=-O2
fi
;;
freebsd* | openbsd*)
append_var LDFLAGS "-L/usr/local/lib"
append_var CXXFLAGS "-I/usr/local/include"
@ -3229,6 +3266,15 @@ if test -n "$_host"; then
_seq_midi=no
_port_mk="backends/platform/dingux/dingux.mk"
;;
wasm*-emscripten)
_backend="sdl"
HOSTEXEPRE=
HOSTEXEEXT=.html
_ar="emar cru"
_ranlib="emranlib"
_opengl_mode=gles2
_opengl_game_es2=yes
;;
raspberrypi)
_libcurlpath=$RPI_ROOT/usr/bin
# This is needed because the official cross compiler doesn't have multiarch enabled
@ -3927,6 +3973,9 @@ case $_host_os in
os2-emx*)
_posix=yes # FIXME: Really???
;;
emscripten)
_posix=yes
;;
*)
# given this is a shell script, we might assume some type of posix.
# However, the host system might be a totally different one, so
@ -3947,7 +3996,7 @@ if test "$_posix" = yes ; then
#include <spawn.h>
int main(void) { return posix_spawn(0, 0, 0, 0, 0, 0); }
EOF
cc_check && _has_posix_spawn=yes
cc_check && test "$_host_os" != "emscripten" && _has_posix_spawn=yes
echo $_has_posix_spawn
if test "$_has_posix_spawn" = yes ; then
append_var DEFINES "-DHAS_POSIX_SPAWN"
@ -3994,6 +4043,18 @@ _mak_plugins=
if test "$_dynamic_modules" = yes ; then
echo_n "Checking whether building plugins is supported... "
case $_host_os in
emscripten)
_plugin_prefix="lib"
_plugin_suffix=".wasm"
append_var CXXFLAGS "-fPIC"
append_var LIBS ""
_mak_plugins='
PLUGIN_EXTRA_DEPS =
PLUGIN_LDFLAGS += -s SIDE_MODULE=1 -s EXPORT_ALL=1
PRE_OBJS_FLAGS := -s MAIN_MODULE=1 -s EXPORT_ALL=1
POST_OBJS_FLAGS :=
'
;;
3ds)
_elf_loader=yes
append_var DEFINES "-DUNCACHED_PLUGINS"

View File

@ -0,0 +1,61 @@
# Building ScummVM for Webassembly
The [Emscripten](https://emscripten.org/) target provides a script to build ScummVM as a single page browser app.
> Emscripten is an LLVM/Clang-based compiler that compiles C and C++ source code to WebAssembly for execution in web browsers.
## Current State
* All engines compile (though I didn't test all of them), including ResidualVM with WebGL acceleration
* Audio works and 3rd-party libraries for sound and video decoding are integrated
* Proof of concept integration with [BrowserFS](https://github.com/jvilk/browserfs) to download game data lazily when required and to support local savegames
## How to build for Webassembly
This folder contains a script to help build scummvm with Emscripten, it automatically downloads the correct emsdk version and also takes care of bundling the data and setting up a few demo games.
### Running `emscripten/build.sh`
`emscripten/build.sh` needs to be run from the root of the project.
```
./dists/emscripten/build.sh libs|configure|make|data|dist|all|clean
```
It accepts a single parameter with 7 valid commands:
- `libs`: Download and compile the required 3rd-party libraries required to build certain engines (libmad, a52dec etc)
- `configure`: Run the configure script with emconfigure with the recommended settings for a simple demo page
- `make`: Run the make scripts with emmake
- `data`: Download some demos and set up all data require for the demo page
- `dist`: Copy all files into a single build-emscripten folder to bring it all together
- `all`: Run all of the above commands
- `clean`: Remove all object files, built libs, bundled data etc.
Independent of the command executed, the script sets up a pre-defined emsdk environment in the subfolder `./dists/emscripten/build.sh`
## Known Issues + Possible Improvements
Some ideas for possible improvements:
### Emscripten Optimizations
- Optimize asyncify behaviour (we only have SDL functions calling wait currently), e.g with https://wiki.libsdl.org/SDL_HINT_EMSCRIPTEN_ASYNCIFY
- Specify a `ASYNCIFY_ONLY` list to to make asyncify only instrument functions in the call path as described in https://emscripten.org/docs/porting/asyncify.html
- Don't use asyncify but rewrite main loop to improve performance
- Shrink code size or execution speed with `-Os` or `-Oz` ( https://emscripten.org/docs/tools_reference/emcc.html#emcc-compiler-optimization-options ) )
### Storage Integration:
- BrowserFS seems abandoned and never did a stable 2.0.0 release. Maybe there's a better way to handle Storage?
- File Loading Improvements:
- Load Assets with HTTP Range Request Headers
- Load Assets asynchronously (not blocking) via a worker
- Add support for save games (and games data?) on personal cloud storage (Dropbox, Google Drive)
### UI Integration:
- Support resizing canvas is currently broken
- fix scaling issues / fullscreen not working
- Build a nice webpage around the canvas
- Adapt page padding/background color to theme (black when in game)
- ScummVM shouldn't be able to "close" (there's no concept for that
- Remove "exit" buttons from all menus
- Change any programmatic "exits" to cause a restart of Scummvm (or refresh of the page)
- Pass CLI parameters for ScummVM via URL parameters to allow for "deep-linking" to a specific game
### Other Features + Bugs
- Bug: vorbis support is broken - parts seems to have been patched out so -lvorbisfile triggers an error during configure ( https://github.com/emscripten-core/emscripten/pull/9849 doesn't seem to fix this )
- Bug: Going back to main menu from Grim (and other Residual Games?) messes up the render context and the UI is unusable
- Todo: Check all disabled features (e.g; TiMidity++) and see if they could be enabled (some might never make sense, e.g. anything requiring MIDI Hardware, Update Checking etc. )

204
dists/emscripten/build.sh Executable file
View File

@ -0,0 +1,204 @@
#!/bin/bash
# print commands
set -o xtrace
# exit when any command fails
set -e
if [ "$#" -ne 1 ]; then
echo "$0: exactly 1 arguments expected: configure, make, data, all"
exit 3
fi
EMSDK_VERSION="2.0.23"
ROOT_FOLDER=$(pwd)
DIST_FOLDER="$ROOT_FOLDER/dists/emscripten"
LIBS_FOLDER="$DIST_FOLDER/libs"
if [[ ! -d "$DIST_FOLDER" ]]; then
echo "/dists/emscripten/ not found. Please make sure to run this script from the root of the project - ./dists/emscripten/build.sh "
exit 1
fi
if [[ "$1" =~ ^(clean)$ ]]; then
make clean
rm -rf ./dists/emscripten/libs/build
rm -rf ./dists/emscripten/libs/*/
rm -rf ./dists/emscripten/emsdk*/
find . -name "*.o"
find . -name "*.o" -exec rm -rf {} \;
find . -name "*.a"
find . -name "*.a" -exec rm -rf {} \;
find . -name "*.wasm"
find . -name "*.wasm" -exec rm -rf {} \;
exit 0
fi
# Activate Emscripten
if [[ ! -d "$DIST_FOLDER/emsdk-$EMSDK_VERSION" ]]; then
echo "$DIST_FOLDER/emsdk-$EMSDK_VERSION not found. Installing Emscripten"
cd $DIST_FOLDER
wget --content-disposition "https://github.com/emscripten-core/emsdk/archive/${EMSDK_VERSION}.tar.gz"
tar xzvf "emsdk-${EMSDK_VERSION}.tar.gz"
cd "emsdk-${EMSDK_VERSION}"
./emsdk install ${EMSDK_VERSION}
./emsdk activate ${EMSDK_VERSION}
fi
source "$DIST_FOLDER/emsdk-$EMSDK_VERSION/emsdk_env.sh"
# Download + Install Libraries
echo $LIBS_FOLDER
mkdir -p "$LIBS_FOLDER"
if [[ ! -d "$LIBS_FOLDER/build" ]]; then
echo "$LIBS_FOLDER/build/ not found. Building plugins..."
echo "build libtheora-1.1.1"
cd "$LIBS_FOLDER"
pwd
wget -nc "https://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.xz"
tar -xf libtheora-1.1.1.tar.xz
cd "./libtheora-1.1.1/"
CFLAGS="-fPIC -s USE_OGG=1 -s USE_VORBIS=1 " emconfigure ./configure --host=wasm32-unknown-none --prefix="$LIBS_FOLDER/build/" --disable-asm
emmake make -j 3
emmake make install
echo "building faad2-2.8.8"
cd "$LIBS_FOLDER"
wget -nc "https://sourceforge.net/projects/faac/files/faad2-src/faad2-2.8.0/faad2-2.8.8.tar.gz"
tar -xf faad2-2.8.8.tar.gz
cd "./faad2-2.8.8/"
CFLAGS="-fPIC" emconfigure ./configure --host=wasm32-unknown-none --prefix="$LIBS_FOLDER/build/"
emmake make
emmake make install
echo "building libmad-0.15.1b"
cd "$LIBS_FOLDER"
# libmad needs patching: https://stackoverflow.com/questions/14015747/gccs-fforce-mem-option
wget -nc "http://www.linuxfromscratch.org/patches/blfs/svn/libmad-0.15.1b-fixes-1.patch"
wget -nc "https://downloads.sourceforge.net/mad/libmad-0.15.1b.tar.gz"
tar -xf libmad-0.15.1b.tar.gz
cd "$LIBS_FOLDER/libmad-0.15.1b/"
patch -Np1 -i ../libmad-0.15.1b-fixes-1.patch
emconfigure ./configure --host=wasm32-unknown-none --prefix="$LIBS_FOLDER/build/" --with-pic --enable-fpm=no
emmake make
emmake make install
echo "building libmpeg2-0.5.1"
cd "$LIBS_FOLDER"
wget -nc "http://libmpeg2.sourceforge.net/files/libmpeg2-0.5.1.tar.gz"
tar -xf libmpeg2-0.5.1.tar.gz
cd "$LIBS_FOLDER/libmpeg2-0.5.1/"
CFLAGS="-fPIC" emconfigure ./configure --host=wasm32-unknown-none --prefix="$LIBS_FOLDER/build/" --disable-sdl
emmake make
emmake make install
echo "building a52dec-0.7.4"
cd "$LIBS_FOLDER"
wget -nc "https://liba52.sourceforge.io/files/a52dec-0.7.4.tar.gz"
tar -xf a52dec-0.7.4.tar.gz
cd "$LIBS_FOLDER/a52dec-0.7.4/"
CFLAGS="-fPIC" emconfigure ./configure --host=wasm32-unknown-none --prefix="$LIBS_FOLDER/build/"
emmake make -j 3
emmake make install
fi
cd "$ROOT_FOLDER"
## Emscripten configuration (should probably go into the configure file)
## IMPORTANT: ASYNCIFY WITH -O0 doesnt work (presumably because the stack gets too big)
export LDFLAGS="-O2 -s ASSERTIONS=1 -s GL_ASSERTIONS=1 -s LLD_REPORT_UNDEFINED -s INITIAL_MEMORY=33554432"
#debugging
export LDFLAGS="${LDFLAGS} -gsource-map --source-map-base \"http://localhost:8080/\" "
# linker flags (bundle JS and default assets)
export LDFLAGS_LINKER=" --pre-js ./dists/emscripten/pre.js --post-js ./dists/emscripten/post.js --shell-file ./dists/emscripten/custom_shell.html "
if [[ "$1" =~ ^(configure|all)$ ]]; then
echo "clean, & configure"
make clean
emconfigure ./configure --enable-debug --enable-verbose-build --host=wasm32-unknown-emscripten \
--disable-all-engines \
--enable-engine=testbed,scumm,scumm_7_8,grim,monkey4,mohawk,myst,riven,sci32,agos2,sword2,drascula,sky,lure,queen,testbed \
--with-theoradec-prefix="$LIBS_FOLDER/build/" \
--with-faad-prefix="$LIBS_FOLDER/build/" \
--with-mad-prefix="$LIBS_FOLDER/build/" \
--with-mpeg2-prefix="$LIBS_FOLDER/build/" \
--with-a52-prefix="$LIBS_FOLDER/build/"
# TODO: enable dynamic linking so we can enable more plugins
# https://forums.scummvm.org/viewtopic.php?t=14918
# https://github.com/emscripten-core/emscripten/wiki/Linking
# https://freecontent.manning.com/dynamic-linking-a-crash-course/
# https://iandouglasscott.com/2019/07/18/experimenting-with-webassembly-dynamic-linking-with-clang/
# HACK: the preload flags break emcc during configure as emcc enables NODERAWFS when run as part of configure
# which doesn't support preloading assets, so we have to manually add those after configure to the config.mk file
echo "LDFLAGS += ${LDFLAGS_LINKER}" >>config.mk
# configure currently doesn't clean up all files it created
rm scummvm-conf.*
fi
if [[ "$1" =~ ^(data|all)$ ]]; then
cd "${ROOT_FOLDER}"
rm -rf ./build-emscripten/games/
mkdir -p ./build-emscripten/games/
cd dists/engine-data
./create-testbed-data.sh
mv testbed "${ROOT_FOLDER}/build-emscripten/games/testbed"
games=true
if [ "$games" = true ]; then
mkdir -p ./dists/emscripten/games/
cd "${ROOT_FOLDER}/dists/emscripten/games/"
wget -nc https://downloads.scummvm.org/frs/demos/scumm/ft-dos-demo-en.zip
unzip -n ft-dos-demo-en -d "${ROOT_FOLDER}/build-emscripten/games/ft-dos-demo-en/"
wget -nc https://downloads.scummvm.org/frs/demos/mohawk/myst-win-demo-en.zip
unzip -n myst-win-demo-en.zip -d "${ROOT_FOLDER}/build-emscripten/games/myst-win-demo-en/"
wget -nc https://downloads.scummvm.org/frs/demos/mohawk/riven-win-demo-en.zip
unzip -n riven-win-demo-en.zip -d "${ROOT_FOLDER}/build-emscripten/games/riven-win-demo-en/" -x DXSETUP/* -x QTWSETUP/*
wget -nc https://downloads.scummvm.org/frs/demos/sword2/sword2-win-demo-en.zip
unzip -n sword2-win-demo-en.zip -d "${ROOT_FOLDER}/build-emscripten/games/sword2-win-demo-en/"
wget -nc https://downloads.scummvm.org/frs/demos/scumm/comi-win-large-demo-en.zip
unzip -n comi-win-large-demo-en.zip -d "${ROOT_FOLDER}/build-emscripten/games/comi-win-large-demo-en/"
wget -nc https://downloads.scummvm.org/frs/demos/grim/emi-win-demo-en.zip
unzip -n emi-win-demo-en.zip -d "${ROOT_FOLDER}/build-emscripten/games/emi-win-demo-en/"
wget -nc https://downloads.scummvm.org/frs/demos/grim/grim-win-demo2-en.zip
unzip -n grim-win-demo2-en.zip -d "${ROOT_FOLDER}/build-emscripten/games/grim-win-demo2-en/"
wget -nc https://downloads.scummvm.org/frs/demos/agos/feeble-dos-ni-demo-en.zip
unzip -n feeble-dos-ni-demo-en.zip -d "${ROOT_FOLDER}/build-emscripten/games/feeble-dos-ni-demo-en/"
wget -nc https://downloads.scummvm.org/frs/demos/sci/lsl7-dos-demo-en.zip
unzip -n lsl7-dos-demo-en.zip -d "${ROOT_FOLDER}/build-emscripten/games/lsl7-dos-demo-en/"
wget -nc https://downloads.scummvm.org/frs/demos/sci/phantasmagoria-dos-win-demo-en.zip
unzip -n phantasmagoria-dos-win-demo-en -d "${ROOT_FOLDER}/build-emscripten/games/phantasmagoria-dos-win-demo-en/"
wget -nc https://downloads.scummvm.org/frs/extras/Beneath%20a%20Steel%20Sky/BASS-Floppy-1.3.zip
unzip -n BASS-Floppy-1.3.zip -d "${ROOT_FOLDER}/build-emscripten/games/bass-floppy/"
wget -nc https://downloads.scummvm.org/frs/extras/Drascula_%20The%20Vampire%20Strikes%20Back/drascula-1.0.zip
unzip -n drascula-1.0.zip -d "${ROOT_FOLDER}/build-emscripten/games/drascula/"
wget -nc https://downloads.scummvm.org/frs/extras/Drascula_%20The%20Vampire%20Strikes%20Back/drascula-audio-mp3-2.0.zip
unzip -n drascula-audio-mp3-2.0.zip -d "${ROOT_FOLDER}/build-emscripten/games/drascula/"
wget -nc https://downloads.scummvm.org/frs/extras/Flight%20of%20the%20Amazon%20Queen/FOTAQ_Floppy.zip
unzip -n FOTAQ_Floppy.zip -d "${ROOT_FOLDER}/build-emscripten/games/fotaq-floppy/"
wget -nc https://downloads.scummvm.org/frs/extras/Lure%20of%20the%20Temptress/lure-1.1.zip
unzip -n lure-1.1.zip -d "${ROOT_FOLDER}/build-emscripten/games/lure/"
fi
cd "${ROOT_FOLDER}//build-emscripten/games/"
NODE_DIR=$(dirname $EMSDK_NODE)
"$NODE_DIR/npx" -p browserfs make_xhrfs_index >index.json
fi
if [[ "$1" =~ ^(make|all)$ ]]; then
cd "${ROOT_FOLDER}"
emmake make
emmake make dist-generic
# preload data
$EMSDK_PYTHON $EMSDK/upstream/emscripten/tools/file_packager.py files.data --preload ./dist-generic/scummvm/data@/ --use-preload-cache --js-output=files.js
rm -rf dist-generic/
fi
if [[ "$1" =~ ^(dist|all)$ ]]; then
cd "${ROOT_FOLDER}"
mkdir -p build-emscripten
mv scummvm.* build-emscripten/
mv files.* build-emscripten/
fi

File diff suppressed because one or more lines are too long

2
dists/emscripten/post.js Normal file
View File

@ -0,0 +1,2 @@
// Workaround for https://github.com/emscripten-core/emscripten/pull/9803 which results in mouse events not working anymore after context switches
JSEvents.removeAllHandlersOnTarget = function(){}

7
dists/emscripten/pre.js Normal file
View File

@ -0,0 +1,7 @@
Module['arguments'] = [];
//Module['arguments'].push('--debuglevel=5');
Module['arguments'].push('--config=/data/local/scummvm.ini');
//Module['arguments'].push('--add');
//Module['arguments'].push('--recursive');
//Module['arguments'].push('--path=/data/games');

View File

@ -1116,6 +1116,10 @@ void GrimEngine::mainLoop() {
g_imuseState = -1;
}
#if defined(EMSCRIPTEN)
// We need to yield regularly to unblock the main thread
g_system->delayMillis(10);
#endif
uint32 endTime = g_system->getMillis();
if (startTime > endTime)
continue;

View File

@ -158,12 +158,20 @@ void FrameBuffer::init() {
glBindRenderbuffer(GL_RENDERBUFFER, 0);
} else {
glBindRenderbuffer(GL_RENDERBUFFER, _renderBuffers[0]);
#if defined(EMSCRIPTEN)
// See https://www.khronos.org/registry/webgl/specs/latest/1.0/#FBO_ATTACHMENTS
#define GL_DEPTH_STENCIL 0x84F9
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_STENCIL, _texWidth, _texHeight);
#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, _renderBuffers[0]);
#else
glRenderbufferStorage(GL_RENDERBUFFER, useDepthComponent24() ? GL_DEPTH_COMPONENT24 : GL_DEPTH_COMPONENT16, _texWidth, _texHeight);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, _renderBuffers[0]);
glBindRenderbuffer(GL_RENDERBUFFER, _renderBuffers[1]);
glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, _texWidth, _texHeight);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, _renderBuffers[1]);
#endif
glBindRenderbuffer(GL_RENDERBUFFER, 0);
}

View File

@ -33,6 +33,10 @@ namespace OpenGL {
static const GLchar *readFile(const Common::String &filename) {
Common::File file;
#if defined(EMSCRIPTEN)
// Since we need to bundle all files into data files on Emscripten, we keep all shaders in a different folder
SearchMan.addDirectory("ALL_SHADERS", "/", 0, 2);
#endif
// Allow load shaders from source code directory without install them
// It's used for development purpose
// FIXME: it's doesn't work with just search subdirs in 'engines'
@ -47,6 +51,9 @@ static const GLchar *readFile(const Common::String &filename) {
SearchMan.remove("MYST3_SHADERS");
SearchMan.remove("STARK_SHADERS");
SearchMan.remove("WINTERMUTE_SHADERS");
#if defined(EMSCRIPTEN)
SearchMan.remove("ALL_SHADERS");
#endif
const int32 size = file.size();
GLchar *shaderSource = new GLchar[size + 1];