mirror of
https://github.com/libretro/RetroArch
synced 2025-02-01 20:54:10 +00:00
[EMSCRIPTEN] less workarounds due to fixes in emscripten, enable more optimizations
This commit is contained in:
parent
7479270406
commit
f4ff5f3ea3
@ -47,16 +47,19 @@ HAVE_FREETYPE = 1
|
||||
HAVE_ZLIB = 1
|
||||
HAVE_FBO = 1
|
||||
WANT_MINIZ = 1
|
||||
MEMORY = 67108864
|
||||
LTO = 0
|
||||
FAST_DOUBLES = 1
|
||||
|
||||
ifneq ($(NATIVE_ZLIB),)
|
||||
WANT_MINIZ = 0
|
||||
endif
|
||||
|
||||
libretro ?= -lretro_emscripten
|
||||
libretro = libretro_emscripten.bc
|
||||
|
||||
LIBS = -lm
|
||||
DEFINES = -DHAVE_SCREENSHOTS -DHAVE_NULLAUDIO -DHAVE_BSV_MOVIE -DPACKAGE_VERSION=\"0.9.9.3\"
|
||||
LDFLAGS = -L. -static-libgcc -s TOTAL_MEMORY=268435456
|
||||
LDFLAGS = -L. -s TOTAL_MEMORY=$(MEMORY)
|
||||
|
||||
ifeq ($(SCALER_NO_SIMD), 1)
|
||||
DEFINES += -DSCALER_NO_SIMD
|
||||
@ -105,8 +108,6 @@ ifeq ($(HAVE_ZLIB), 1)
|
||||
endif
|
||||
endif
|
||||
|
||||
LIBS += $(libretro)
|
||||
|
||||
ifeq ($(HAVE_FBO), 1)
|
||||
DEFINES += -DHAVE_FBO
|
||||
endif
|
||||
@ -117,8 +118,17 @@ endif
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
LDFLAGS += -O0 -g
|
||||
CFLAGS += -O0 -g
|
||||
else
|
||||
LDFLAGS += -O2 -ffast-math
|
||||
LDFLAGS += -O2
|
||||
# WARNING: some optimizations can break some cores (ex: LTO breaks tyrquake)
|
||||
ifeq ($(FAST_DOUBLES), 1)
|
||||
LDFLAGS += -s DOUBLE_MODE=0
|
||||
endif
|
||||
ifeq ($(LTO), 1)
|
||||
LDFLAGS += --llvm-lto 3
|
||||
endif
|
||||
CFLAGS += -O2
|
||||
endif
|
||||
|
||||
CFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I. -std=gnu99
|
||||
@ -127,7 +137,7 @@ all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJ)
|
||||
@$(if $(Q), $(shell echo echo LD $@),)
|
||||
$(Q)$(LD) -o $@ $(OBJ) $(LIBS) $(LDFLAGS)
|
||||
$(Q)$(LD) -o $@ $(OBJ) $(libretro) $(LIBS) $(LDFLAGS)
|
||||
|
||||
%.o: %.c
|
||||
@$(if $(Q), $(shell echo echo CC $<),)
|
||||
|
@ -31,12 +31,33 @@
|
||||
|
||||
static bool menuloop;
|
||||
|
||||
void mainloop(void)
|
||||
static void endloop(void)
|
||||
{
|
||||
g_extern.system.shutdown = false;
|
||||
menu_free();
|
||||
|
||||
if (g_extern.config_save_on_exit && *g_extern.config_path)
|
||||
config_save_file(g_extern.config_path);
|
||||
|
||||
if (g_extern.main_is_init)
|
||||
rarch_main_deinit();
|
||||
|
||||
rarch_deinit_msg_queue();
|
||||
|
||||
#ifdef PERF_TEST
|
||||
rarch_perf_log();
|
||||
#endif
|
||||
|
||||
rarch_main_clear_state();
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static void mainloop(void)
|
||||
{
|
||||
if (g_extern.system.shutdown)
|
||||
{
|
||||
RARCH_ERR("Exit...\n");
|
||||
exit(0);
|
||||
endloop();
|
||||
}
|
||||
else if (menuloop)
|
||||
{
|
||||
|
@ -30,14 +30,12 @@
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
#include <GLES/gl.h>
|
||||
#include <SDL/SDL.h>
|
||||
|
||||
static EGLContext g_egl_ctx;
|
||||
static EGLSurface g_egl_surf;
|
||||
static EGLDisplay g_egl_dpy;
|
||||
static EGLConfig g_config;
|
||||
static bool g_quit;
|
||||
|
||||
static bool g_inited;
|
||||
|
||||
@ -58,12 +56,13 @@ static void gfx_ctx_check_window(bool *quit,
|
||||
(void)height;
|
||||
|
||||
*resize = false;
|
||||
*quit = g_quit;
|
||||
*quit = false;
|
||||
}
|
||||
|
||||
static void gfx_ctx_swap_buffers(void)
|
||||
{
|
||||
eglSwapBuffers(g_egl_dpy, g_egl_surf);
|
||||
// no-op in emscripten, no way to force swap/wait for vsync in browsers
|
||||
//eglSwapBuffers(g_egl_dpy, g_egl_surf);
|
||||
}
|
||||
|
||||
static void gfx_ctx_set_resize(unsigned width, unsigned height)
|
||||
@ -209,7 +208,7 @@ static void gfx_ctx_input_driver(const input_driver_t **input, void **input_data
|
||||
{
|
||||
*input = NULL;
|
||||
|
||||
if (SDL_Init(SDL_INIT_VIDEO) != 0)
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) != 0)
|
||||
return;
|
||||
|
||||
void *sdlinput = input_sdl.init();
|
||||
@ -228,7 +227,7 @@ static bool gfx_ctx_has_focus(void)
|
||||
|
||||
static gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol)
|
||||
{
|
||||
return SDL_GL_GetProcAddress(symbol);
|
||||
return eglGetProcAddress(symbol);
|
||||
}
|
||||
|
||||
static float gfx_ctx_translate_aspect(unsigned width, unsigned height)
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "../libretro.h"
|
||||
#include "input_common.h"
|
||||
|
||||
#if !(SDL_MAJOR_VERSION <= 1 && SDL_MINOR_VERSION <= 2)
|
||||
#ifdef EMSCRIPTEN
|
||||
#define SDL_GetKeyState SDL_GetKeyboardState
|
||||
#endif
|
||||
|
||||
@ -232,12 +232,7 @@ static void sdl_poll_mouse(sdl_input_t *sdl)
|
||||
|
||||
static void sdl_input_poll(void *data)
|
||||
{
|
||||
#ifdef EMSCRIPTEN
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event));
|
||||
#else
|
||||
SDL_PumpEvents();
|
||||
#endif
|
||||
sdl_input_t *sdl = (sdl_input_t*)data;
|
||||
|
||||
input_joypad_poll(sdl->joypad);
|
||||
|
Loading…
x
Reference in New Issue
Block a user