From 6583d8262bb828c6c0c387fc121f3e28af8c0cb1 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sat, 26 May 2012 06:45:55 +0200 Subject: [PATCH] Add gl_common.c and move commonly used helper GL functions there --- console/griffin/griffin.c | 4 ++++ gfx/gl_common.c | 38 ++++++++++++++++++++++++++++++++++++++ gfx/gl_common.h | 2 ++ ps3/menu.c | 5 +++-- ps3/ps3_video_psgl.c | 9 --------- 5 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 gfx/gl_common.c diff --git a/console/griffin/griffin.c b/console/griffin/griffin.c index 8facc62e39..039a626ed4 100644 --- a/console/griffin/griffin.c +++ b/console/griffin/griffin.c @@ -43,6 +43,10 @@ CONFIG FILE /*============================================================ VIDEO ============================================================ */ +#ifdef HAVE_OPENGL +#include "../../gfx/gl_common.c" +#endif + #if defined(__CELLOS_LV2__) #include "../../gfx/shader_cg.c" #include "../../ps3/ps3_video_psgl.c" diff --git a/gfx/gl_common.c b/gfx/gl_common.c new file mode 100644 index 0000000000..aa749c545c --- /dev/null +++ b/gfx/gl_common.c @@ -0,0 +1,38 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2012 - Hans-Kristian Arntzen + * Copyright (C) 2011-2012 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include "../driver.h" + +#include + +#include "gl_common.h" +#include "gfx_common.h" + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/*============================================================ + VIDEO +============================================================ */ + +void rarch_gl_set_vsync(unsigned enabled) +{ + if(enabled) + glEnable(GL_VSYNC_SCE); + else + glDisable(GL_VSYNC_SCE); +} diff --git a/gfx/gl_common.h b/gfx/gl_common.h index 5dcd8ce808..369fcea228 100644 --- a/gfx/gl_common.h +++ b/gfx/gl_common.h @@ -112,4 +112,6 @@ extern PFNGLACTIVETEXTUREPROC pglActiveTexture; #define pglActiveTexture glActiveTexture #endif +void rarch_gl_set_vsync(unsigned enabled); + #endif diff --git a/ps3/menu.c b/ps3/menu.c index eee47e29d6..d820c564ac 100644 --- a/ps3/menu.c +++ b/ps3/menu.c @@ -29,6 +29,7 @@ #include "../console/console_ext.h" #include "ps3_video_psgl.h" +#include "../gfx/gl_common.h" #include "shared.h" #include "../file.h" @@ -1427,13 +1428,13 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue) if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state)) { g_console.throttle_enable = !g_console.throttle_enable; - ps3graphics_set_vsync(g_console.throttle_enable); + rarch_gl_set_vsync(g_console.throttle_enable); set_delay = DELAY_MEDIUM; } if(CTRL_START(state)) { g_console.throttle_enable = true; - ps3graphics_set_vsync(g_console.throttle_enable); + rarch_gl_set_vsync(g_console.throttle_enable); set_delay = DELAY_MEDIUM; } break; diff --git a/ps3/ps3_video_psgl.c b/ps3/ps3_video_psgl.c index 91f66be0fa..3f4c552e6a 100644 --- a/ps3/ps3_video_psgl.c +++ b/ps3/ps3_video_psgl.c @@ -1113,15 +1113,6 @@ const char * ps3_get_resolution_label(uint32_t resolution) } } - -void ps3graphics_set_vsync(uint32_t vsync) -{ - if(vsync) - glEnable(GL_VSYNC_SCE); - else - glDisable(GL_VSYNC_SCE); -} - bool ps3_setup_texture(void) { gl_t *gl = g_gl;