From ab52a3cbf56b1c77363eac359cbf7e5e82680089 Mon Sep 17 00:00:00 2001 From: vanfanel Date: Fri, 8 May 2020 17:06:23 +0200 Subject: [PATCH] Pass -DUSE_GLES to sdl2 GL init context instead of -DTARGET_RPI, since there are more GLES platforms out there that this engine will run on. --- Makefile | 3 ++- src/pc/gfx/gfx_sdl2.c | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 1c5a5e6..1b0898c 100644 --- a/Makefile +++ b/Makefile @@ -133,7 +133,8 @@ endif ifeq ($(NON_MATCHING),1) VERSION_CFLAGS := $(VERSION_CFLAGS) -DNON_MATCHING -DAVOID_UB ifeq ($(TARGET_RPI),1) # Define RPi to change SDL2 title & GLES2 hints - VERSION_CFLAGS += -DTARGET_RPI + # Other platforms will use GLES2 eventually, not only RPis. + VERSION_CFLAGS += -DUSE_GLES endif VERSION_ASFLAGS := --defsym AVOID_UB=1 COMPARE := 0 diff --git a/src/pc/gfx/gfx_sdl2.c b/src/pc/gfx/gfx_sdl2.c index ba6044f..309c19a 100644 --- a/src/pc/gfx/gfx_sdl2.c +++ b/src/pc/gfx/gfx_sdl2.c @@ -100,7 +100,7 @@ static void gfx_sdl_init(void) { SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - #ifdef TARGET_RPI + #ifdef USE_GLES SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); // These attributes allow for hardware acceleration on RPis. SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); @@ -109,18 +109,18 @@ static void gfx_sdl_init(void) { //SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); //SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); - #ifndef TARGET_RPI - wnd = SDL_CreateWindow("Super Mario 64 PC-Port", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, + #ifndef USE_GLES + wnd = SDL_CreateWindow("Super Mario 64 PC port (OpenGL)", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, DESIRED_SCREEN_WIDTH, DESIRED_SCREEN_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE); #else - wnd = SDL_CreateWindow("Super Mario 64 RPi (GLES2)", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, + wnd = SDL_CreateWindow("Super Mario 64 PC port (OpenGL_ES2)", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, DESIRED_SCREEN_WIDTH, DESIRED_SCREEN_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE); #endif gfx_sdl_set_fullscreen(configFullscreen); SDL_GL_CreateContext(wnd); - SDL_GL_SetSwapInterval(2); // TODO 0, 1 or 2 or remove this line + SDL_GL_SetSwapInterval(1); // We have a double buffered GL context, it makes no sense to want tearing. for (size_t i = 0; i < sizeof(windows_scancode_table) / sizeof(SDL_Scancode); i++) { inverted_scancode_table[windows_scancode_table[i]] = i;