Add gl_common.c and move commonly used helper GL functions there

This commit is contained in:
Twinaphex 2012-05-26 06:45:55 +02:00
parent 95a236ac61
commit 6583d8262b
5 changed files with 47 additions and 11 deletions

View File

@ -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"

38
gfx/gl_common.c Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#include "../driver.h"
#include <stdint.h>
#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);
}

View File

@ -112,4 +112,6 @@ extern PFNGLACTIVETEXTUREPROC pglActiveTexture;
#define pglActiveTexture glActiveTexture
#endif
void rarch_gl_set_vsync(unsigned enabled);
#endif

View File

@ -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;

View File

@ -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;