From 2fe11bd827a8b3cc755de88042cabd250313464c Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Tue, 15 Mar 2022 17:17:56 +0100 Subject: [PATCH] A few fixes for the Emscripten WebAssembly build. --- CMakeLists.txt | 2 +- es-core/src/renderers/RendererOpenGL.cpp | 4 ++++ es-core/src/utils/PlatformUtil.cpp | 6 ++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 42a61f866..8827c367e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -207,7 +207,7 @@ endif() if(EMSCRIPTEN) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s USE_SDL=2 -pthread") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s INITIAL_MEMORY=33554432 -s ALLOW_MEMORY_GROWTH=1 -s WASM=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=1 -s USE_SDL=2 \ - -pthread -s PTHREAD_POOL_SIZE=4 -s DEMANGLE_SUPPORT=1 -s USE_WEBGL2=1 -s FULL_ES2=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s ASYNCIFY \ + -pthread -s PTHREAD_POOL_SIZE=4 -s DEMANGLE_SUPPORT=1 -s USE_WEBGL2=1 -s FULL_ES3=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s ASYNCIFY \ --preload-file ${PROJECT_SOURCE_DIR}/resources@/home/web_user/.emulationstation/resources/ \ --preload-file ${PROJECT_SOURCE_DIR}/themes/rbsimple-DE@/home/web_user/.emulationstation/themes/rbsimple-DE/ \ --preload-file ${PROJECT_SOURCE_DIR}/ROMs@/home/web_user/ROMs/") diff --git a/es-core/src/renderers/RendererOpenGL.cpp b/es-core/src/renderers/RendererOpenGL.cpp index 60362d1be..ae8db3632 100644 --- a/es-core/src/renderers/RendererOpenGL.cpp +++ b/es-core/src/renderers/RendererOpenGL.cpp @@ -116,7 +116,11 @@ GLenum RendererOpenGL::convertTextureType(const TextureType type) #else case TextureType::BGRA: { return GL_BGRA; } break; #endif +#if defined(__EMSCRIPTEN__) + case TextureType::RED: { return GL_LUMINANCE; } break; +#else case TextureType::RED: { return GL_RED; } break; +#endif default: { return GL_ZERO; } } // clang-format on diff --git a/es-core/src/utils/PlatformUtil.cpp b/es-core/src/utils/PlatformUtil.cpp index 1f549c192..2fdced2fe 100644 --- a/es-core/src/utils/PlatformUtil.cpp +++ b/es-core/src/utils/PlatformUtil.cpp @@ -18,13 +18,11 @@ #include -#if defined(__APPLE__) -#include -#endif - #if !defined(_WIN64) #include #endif + +#include #include namespace Utils