summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--docs/source/initialsetup/compilingmame.rst2
-rw-r--r--scripts/genie.lua11
-rw-r--r--src/osd/modules/font/font_sdl.cpp5
-rw-r--r--src/osd/modules/render/bgfx/shadermanager.cpp9
-rw-r--r--src/osd/modules/render/drawbgfx.cpp3
5 files changed, 19 insertions, 11 deletions
diff --git a/docs/source/initialsetup/compilingmame.rst b/docs/source/initialsetup/compilingmame.rst
index 042a7fbbd85..cecb7d49d19 100644
--- a/docs/source/initialsetup/compilingmame.rst
+++ b/docs/source/initialsetup/compilingmame.rst
@@ -353,7 +353,7 @@ above in All Platforms.
Emscripten Javascript and HTML
------------------------------
-First, download and install Emscripten 2.0.25 or later by following the
+First, download and install Emscripten 3.1.35 or later by following the
instructions at the `official site <https://emscripten.org/docs/getting_started/downloads.html>`_.
Once Emscripten has been installed, it should be possible to compile MAME
diff --git a/scripts/genie.lua b/scripts/genie.lua
index 0376b306139..fab53dafec1 100644
--- a/scripts/genie.lua
+++ b/scripts/genie.lua
@@ -1170,26 +1170,24 @@ configuration { "asmjs" }
"-O" .. _OPTIONS["OPTIMIZE"],
"-s USE_SDL=2",
"-s USE_SDL_TTF=2",
- "--memory-init-file 0",
"-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=\"['\\$$ERRNO_CODES']\"",
"-s EXPORTED_FUNCTIONS=\"['_main', '_malloc', '__ZN15running_machine30emscripten_get_running_machineEv', '__ZN15running_machine17emscripten_get_uiEv', '__ZN15running_machine20emscripten_get_soundEv', '__ZN15mame_ui_manager12set_show_fpsEb', '__ZNK15mame_ui_manager8show_fpsEv', '__ZN13sound_manager4muteEbh', '_SDL_PauseAudio', '_SDL_SendKeyboardKey', '__ZN15running_machine15emscripten_saveEPKc', '__ZN15running_machine15emscripten_loadEPKc', '__ZN15running_machine21emscripten_hard_resetEv', '__ZN15running_machine21emscripten_soft_resetEv', '__ZN15running_machine15emscripten_exitEv']\"",
"-s EXPORTED_RUNTIME_METHODS=\"['cwrap']\"",
"-s ERROR_ON_UNDEFINED_SYMBOLS=0",
- "-s USE_WEBGL2=1",
- "-s LEGACY_GL_EMULATION=1",
- "-s GL_UNSAFE_OPTS=0",
+ "-s STACK_SIZE=5MB",
+ "-s MAX_WEBGL_VERSION=2",
"--pre-js " .. _MAKE.esc(MAME_DIR) .. "src/osd/modules/sound/js_sound.js",
"--post-js " .. _MAKE.esc(MAME_DIR) .. "scripts/resources/emscripten/emscripten_post.js",
"--embed-file " .. _MAKE.esc(MAME_DIR) .. "bgfx/chains@bgfx/chains",
"--embed-file " .. _MAKE.esc(MAME_DIR) .. "bgfx/effects@bgfx/effects",
"--embed-file " .. _MAKE.esc(MAME_DIR) .. "bgfx/shaders/essl@bgfx/shaders/essl",
"--embed-file " .. _MAKE.esc(MAME_DIR) .. "artwork/bgfx@artwork/bgfx",
+ "--embed-file " .. _MAKE.esc(MAME_DIR) .. "artwork/lut-default.png@artwork/lut-default.png",
"--embed-file " .. _MAKE.esc(MAME_DIR) .. "artwork/slot-mask.png@artwork/slot-mask.png",
}
if _OPTIONS["SYMBOLS"]~=nil and _OPTIONS["SYMBOLS"]~="0" then
linkoptions {
"-g" .. _OPTIONS["SYMLEVEL"],
- "-s DEMANGLE_SUPPORT=1",
}
end
if _OPTIONS["WEBASSEMBLY"] then
@@ -1205,11 +1203,12 @@ configuration { "asmjs" }
-- define a fixed memory size because allowing memory growth disables asm.js optimizations
linkoptions {
"-s ALLOW_MEMORY_GROWTH=0",
- "-s TOTAL_MEMORY=268435456",
+ "-s INITIAL_MEMORY=256MB",
}
else
linkoptions {
"-s ALLOW_MEMORY_GROWTH=1",
+ "-s INITIAL_MEMORY=24MB"
}
end
archivesplit_size "20"
diff --git a/src/osd/modules/font/font_sdl.cpp b/src/osd/modules/font/font_sdl.cpp
index 1938c97a44d..514e0cc0784 100644
--- a/src/osd/modules/font/font_sdl.cpp
+++ b/src/osd/modules/font/font_sdl.cpp
@@ -15,11 +15,8 @@
#include "unicode.h"
#include "osdcore.h"
-#ifdef SDLMAME_EMSCRIPTEN
-#include <SDL_ttf.h>
-#else
#include <SDL2/SDL_ttf.h>
-#endif
+
#if !defined(SDLMAME_HAIKU) && !defined(SDLMAME_EMSCRIPTEN)
#include <fontconfig/fontconfig.h>
#endif
diff --git a/src/osd/modules/render/bgfx/shadermanager.cpp b/src/osd/modules/render/bgfx/shadermanager.cpp
index 763a744e4aa..282029cb96a 100644
--- a/src/osd/modules/render/bgfx/shadermanager.cpp
+++ b/src/osd/modules/render/bgfx/shadermanager.cpp
@@ -83,6 +83,15 @@ std::string shader_manager::make_path_string(const osd_options &options, const s
{
std::string shader_path(options.bgfx_path());
shader_path += PATH_SEPARATOR "shaders" PATH_SEPARATOR;
+
+#if defined(SDLMAME_EMSCRIPTEN)
+ // Hard-code renderer type to OpenGL ES for emscripten builds since the
+ // bgfx::getRendererType() is called here before BGFX has been
+ // initialized and therefore gives the wrong renderer type (Noop).
+ shader_path += "essl" PATH_SEPARATOR;
+ return shader_path;
+#endif
+
switch (bgfx::getRendererType())
{
case bgfx::RendererType::Noop:
diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp
index 5fbb697089f..ef90478e59e 100644
--- a/src/osd/modules/render/drawbgfx.cpp
+++ b/src/osd/modules/render/drawbgfx.cpp
@@ -394,6 +394,9 @@ bool video_bgfx::set_platform_data(bgfx::PlatformData &platform_data, osd_window
#elif defined(OSD_MAC)
platform_data.ndt = nullptr;
platform_data.nwh = GetOSWindow(dynamic_cast<mac_window_info const &>(window).platform_window());
+#elif defined(SDLMAME_EMSCRIPTEN)
+ platform_data.ndt = nullptr;
+ platform_data.nwh = (void *)"#canvas"; // HTML5 target selector
#else // defined(OSD_*)
SDL_SysWMinfo wmi;
SDL_VERSION(&wmi.version);