Stop linking to OpenGL

libmpv and Retroarch should already be linked to OpenGL(/ES) libraries.

Signed-off-by: Mahyar Koshkouei <mahyar.koshkouei@gmail.com>
This commit is contained in:
Mahyar Koshkouei 2017-12-30 20:52:17 +00:00
parent 5f2ebce9b1
commit e3c8da7c17
2 changed files with 12 additions and 25 deletions

View File

@ -104,7 +104,7 @@ else
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined
endif endif
LDFLAGS += $(LIBM) -lmpv -lGL LDFLAGS += $(LIBM) -lmpv
LIBRETRO-COM = -Ilibretro-common/include LIBRETRO-COM = -Ilibretro-common/include
ifeq ($(DEBUG), 1) ifeq ($(DEBUG), 1)
@ -116,20 +116,6 @@ endif
OBJECTS := mpv-libretro.o OBJECTS := mpv-libretro.o
CFLAGS += -Wall -pedantic $(LIBRETRO-COM) $(fpic) CFLAGS += -Wall -pedantic $(LIBRETRO-COM) $(fpic)
ifeq ($(GLES), 1)
CFLAGS += -DHAVE_OPENGLES -DHAVE_OPENGLES2
ifeq ($(GLES31), 1)
CFLAGS += -DHAVE_OPENGLES3 -DHAVE_OPENGLES_3_1
else ifeq ($(GLES3), 1)
CFLAGS += -DHAVE_OPENGLES3
endif
LIBS += -lGLESv2 # Still link against GLESv2 when using GLES3 API, at least on desktop Linux.
OBJECTS += libretro-common/glsym/glsym_es2.o
else
OBJECTS += libretro-common/glsym/glsym_gl.o
LIBS += $(GL_LIB)
endif
ifneq (,$(findstring qnx,$(platform))) ifneq (,$(findstring qnx,$(platform)))
CFLAGS += -Wc,-std=c99 CFLAGS += -Wc,-std=c99
else else

View File

@ -11,10 +11,6 @@
static struct retro_hw_render_callback hw_render; static struct retro_hw_render_callback hw_render;
#define RARCH_GL_FRAMEBUFFER GL_FRAMEBUFFER
#define RARCH_GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE
#define RARCH_GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0
static struct retro_log_callback logging; static struct retro_log_callback logging;
static retro_log_printf_t log_cb; static retro_log_printf_t log_cb;
@ -89,8 +85,9 @@ void retro_get_system_av_info(struct retro_system_av_info *info)
info->geometry = (struct retro_game_geometry) { info->geometry = (struct retro_game_geometry) {
.base_width = 320, .base_width = 320,
.base_height = 240, .base_height = 240,
.max_width = 320, .max_width = 1920,
.max_height = 240, .max_height = 1080,
.aspect_ratio = -1,
}; };
} }
@ -152,8 +149,6 @@ static bool retro_init_hw_context(void)
hw_render.context_type = RETRO_HW_CONTEXT_OPENGL; hw_render.context_type = RETRO_HW_CONTEXT_OPENGL;
hw_render.context_reset = context_reset; hw_render.context_reset = context_reset;
hw_render.context_destroy = context_destroy; hw_render.context_destroy = context_destroy;
hw_render.depth = true;
hw_render.bottom_left_origin = true;
if (!environ_cb(RETRO_ENVIRONMENT_SET_HW_RENDER, &hw_render)) if (!environ_cb(RETRO_ENVIRONMENT_SET_HW_RENDER, &hw_render))
return false; return false;
@ -209,8 +204,8 @@ void retro_run(void)
{ {
audio_callback(); audio_callback();
mpv_opengl_cb_draw(mpv_gl, hw_render.get_current_framebuffer(), 100, 100); mpv_opengl_cb_draw(mpv_gl, hw_render.get_current_framebuffer(), 320, 240);
video_cb(RETRO_HW_FRAME_BUFFER_VALID, 100, 100, 0); video_cb(RETRO_HW_FRAME_BUFFER_VALID, 320, 240, 0);
return; return;
} }
@ -255,6 +250,12 @@ bool retro_load_game(const struct retro_game_info *info)
{ {
const char *cmd[] = {"loadfile", info->path, NULL}; const char *cmd[] = {"loadfile", info->path, NULL};
enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_XRGB8888;
if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt))
{
fprintf(stderr, "XRGB8888 is not supported.\n");
return false;
}
if(!retro_init_hw_context()) if(!retro_init_hw_context())
{ {
log_cb(RETRO_LOG_ERROR, "HW Context could not be initialized\n"); log_cb(RETRO_LOG_ERROR, "HW Context could not be initialized\n");