emscripten: fixes to get bgfx working (#13255)
* Emscripten: Fixes to get BGFX working * Move emscripten specific setup into an #elif statement * Fix indentation * emscripten: remove no longer link option DEMANGLE_SUPPORT
This commit is contained in:
parent
11cd46119a
commit
c1bddc67a1
@ -353,7 +353,7 @@ above in All Platforms.
|
|||||||
Emscripten Javascript and HTML
|
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>`_.
|
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
|
Once Emscripten has been installed, it should be possible to compile MAME
|
||||||
|
@ -1170,26 +1170,24 @@ configuration { "asmjs" }
|
|||||||
"-O" .. _OPTIONS["OPTIMIZE"],
|
"-O" .. _OPTIONS["OPTIMIZE"],
|
||||||
"-s USE_SDL=2",
|
"-s USE_SDL=2",
|
||||||
"-s USE_SDL_TTF=2",
|
"-s USE_SDL_TTF=2",
|
||||||
"--memory-init-file 0",
|
|
||||||
"-s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=\"['\\$$ERRNO_CODES']\"",
|
"-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_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 EXPORTED_RUNTIME_METHODS=\"['cwrap']\"",
|
||||||
"-s ERROR_ON_UNDEFINED_SYMBOLS=0",
|
"-s ERROR_ON_UNDEFINED_SYMBOLS=0",
|
||||||
"-s USE_WEBGL2=1",
|
"-s STACK_SIZE=5MB",
|
||||||
"-s LEGACY_GL_EMULATION=1",
|
"-s MAX_WEBGL_VERSION=2",
|
||||||
"-s GL_UNSAFE_OPTS=0",
|
|
||||||
"--pre-js " .. _MAKE.esc(MAME_DIR) .. "src/osd/modules/sound/js_sound.js",
|
"--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",
|
"--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/chains@bgfx/chains",
|
||||||
"--embed-file " .. _MAKE.esc(MAME_DIR) .. "bgfx/effects@bgfx/effects",
|
"--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) .. "bgfx/shaders/essl@bgfx/shaders/essl",
|
||||||
"--embed-file " .. _MAKE.esc(MAME_DIR) .. "artwork/bgfx@artwork/bgfx",
|
"--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",
|
"--embed-file " .. _MAKE.esc(MAME_DIR) .. "artwork/slot-mask.png@artwork/slot-mask.png",
|
||||||
}
|
}
|
||||||
if _OPTIONS["SYMBOLS"]~=nil and _OPTIONS["SYMBOLS"]~="0" then
|
if _OPTIONS["SYMBOLS"]~=nil and _OPTIONS["SYMBOLS"]~="0" then
|
||||||
linkoptions {
|
linkoptions {
|
||||||
"-g" .. _OPTIONS["SYMLEVEL"],
|
"-g" .. _OPTIONS["SYMLEVEL"],
|
||||||
"-s DEMANGLE_SUPPORT=1",
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
if _OPTIONS["WEBASSEMBLY"] then
|
if _OPTIONS["WEBASSEMBLY"] then
|
||||||
@ -1205,11 +1203,12 @@ configuration { "asmjs" }
|
|||||||
-- define a fixed memory size because allowing memory growth disables asm.js optimizations
|
-- define a fixed memory size because allowing memory growth disables asm.js optimizations
|
||||||
linkoptions {
|
linkoptions {
|
||||||
"-s ALLOW_MEMORY_GROWTH=0",
|
"-s ALLOW_MEMORY_GROWTH=0",
|
||||||
"-s TOTAL_MEMORY=268435456",
|
"-s INITIAL_MEMORY=256MB",
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
linkoptions {
|
linkoptions {
|
||||||
"-s ALLOW_MEMORY_GROWTH=1",
|
"-s ALLOW_MEMORY_GROWTH=1",
|
||||||
|
"-s INITIAL_MEMORY=24MB"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
archivesplit_size "20"
|
archivesplit_size "20"
|
||||||
|
@ -15,11 +15,8 @@
|
|||||||
#include "unicode.h"
|
#include "unicode.h"
|
||||||
#include "osdcore.h"
|
#include "osdcore.h"
|
||||||
|
|
||||||
#ifdef SDLMAME_EMSCRIPTEN
|
|
||||||
#include <SDL_ttf.h>
|
|
||||||
#else
|
|
||||||
#include <SDL2/SDL_ttf.h>
|
#include <SDL2/SDL_ttf.h>
|
||||||
#endif
|
|
||||||
#if !defined(SDLMAME_HAIKU) && !defined(SDLMAME_EMSCRIPTEN)
|
#if !defined(SDLMAME_HAIKU) && !defined(SDLMAME_EMSCRIPTEN)
|
||||||
#include <fontconfig/fontconfig.h>
|
#include <fontconfig/fontconfig.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -83,6 +83,15 @@ std::string shader_manager::make_path_string(const osd_options &options, const s
|
|||||||
{
|
{
|
||||||
std::string shader_path(options.bgfx_path());
|
std::string shader_path(options.bgfx_path());
|
||||||
shader_path += PATH_SEPARATOR "shaders" PATH_SEPARATOR;
|
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())
|
switch (bgfx::getRendererType())
|
||||||
{
|
{
|
||||||
case bgfx::RendererType::Noop:
|
case bgfx::RendererType::Noop:
|
||||||
|
@ -394,6 +394,9 @@ bool video_bgfx::set_platform_data(bgfx::PlatformData &platform_data, osd_window
|
|||||||
#elif defined(OSD_MAC)
|
#elif defined(OSD_MAC)
|
||||||
platform_data.ndt = nullptr;
|
platform_data.ndt = nullptr;
|
||||||
platform_data.nwh = GetOSWindow(dynamic_cast<mac_window_info const &>(window).platform_window());
|
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_*)
|
#else // defined(OSD_*)
|
||||||
SDL_SysWMinfo wmi;
|
SDL_SysWMinfo wmi;
|
||||||
SDL_VERSION(&wmi.version);
|
SDL_VERSION(&wmi.version);
|
||||||
|
Loading…
Reference in New Issue
Block a user