From d72751956ec761b173b9e2a8f555eb92af8c32f5 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sun, 27 May 2012 16:23:01 +0200 Subject: [PATCH] (PS3) Implement gfx_ctx_swap_buffers --- gfx/context/ps3_ctx.c | 4 ++++ gfx/gl_common.h | 3 +++ ps3/menu.c | 31 +++++++++++++++++++++++-------- ps3/ps3_video_psgl.c | 20 +++++--------------- 4 files changed, 35 insertions(+), 23 deletions(-) diff --git a/gfx/context/ps3_ctx.c b/gfx/context/ps3_ctx.c index 919b9e159e..ac630886c0 100644 --- a/gfx/context/ps3_ctx.c +++ b/gfx/context/ps3_ctx.c @@ -60,3 +60,7 @@ bool gfx_ctx_window_has_focus(void) return true; } +void gfx_ctx_swap_buffers(void) +{ + psglSwap(); +} diff --git a/gfx/gl_common.h b/gfx/gl_common.h index 2c48ac9227..2601bd79ab 100644 --- a/gfx/gl_common.h +++ b/gfx/gl_common.h @@ -126,6 +126,9 @@ struct gl_tex_info typedef struct gl { +#ifdef RARCH_CONSOLE + bool block_swap; +#endif bool vsync; GLuint texture[TEXTURES]; unsigned tex_index; // For use with PREV. diff --git a/ps3/menu.c b/ps3/menu.c index e83df45c15..87a7a5b8a2 100644 --- a/ps3/menu.c +++ b/ps3/menu.c @@ -1105,8 +1105,10 @@ static void rarch_filename_input_and_save (unsigned filename_type) { glClear(GL_COLOR_BUFFER_BIT); gl_frame_menu(); - video_gl.swap(NULL); + gfx_ctx_swap_buffers(); +#ifdef HAVE_SYSUTILS cellSysutilCheckCallback(); +#endif } if(g_console.oskutil_handle.text_can_be_fetched) @@ -1138,8 +1140,10 @@ static void rarch_filename_input_and_save (unsigned filename_type) { /* OSK Util gets updated */ glClear(GL_COLOR_BUFFER_BIT); - video_gl.swap(NULL); - cellSysutilCheckCallback(); + gfx_ctx_swap_buffers(); +#ifdef HAVE_SYSUTILS + cellSysutilCheckCallback(); +#endif } if(g_console.oskutil_handle.text_can_be_fetched) @@ -1545,8 +1549,10 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue) while(OSK_IS_RUNNING(g_console.oskutil_handle)) { glClear(GL_COLOR_BUFFER_BIT); - video_gl.swap(NULL); - cellSysutilCheckCallback(); + gfx_ctx_swap_buffers(); +#ifdef HAVE_SYSUTILS + cellSysutilCheckCallback(); +#endif } if(g_console.oskutil_handle.text_can_be_fetched) @@ -2353,7 +2359,10 @@ static void ingame_menu(uint32_t menu_id) cellDbgFontPrintf (0.09f, 0.83f, 0.91f, LIGHTBLUE, "Allows you to resize the screen by moving around the two analog sticks.\nPress TRIANGLE to reset to default values, and CIRCLE to go back to the menu."); cellDbgFontDraw(); } - video_gl.swap(NULL); + gfx_ctx_swap_buffers(); +#ifdef HAVE_SYSUTILS + cellSysutilCheckCallback(); +#endif if(CTRL_SQUARE(~state)) { glDisable(GL_BLEND); @@ -2376,7 +2385,10 @@ static void ingame_menu(uint32_t menu_id) rarch_render_cached_frame(); - video_gl.swap(NULL); + gfx_ctx_swap_buffers(); +#ifdef HAVE_SYSUTILS + cellSysutilCheckCallback(); +#endif } } @@ -2642,7 +2654,10 @@ void menu_loop(void) SET_TIMER_EXPIRATION(g_console.timer_expiration_frame_count, 30); } - video_gl.swap(NULL); + gfx_ctx_swap_buffers(); +#ifdef HAVE_SYSUTILS + cellSysutilCheckCallback(); +#endif glDisable(GL_BLEND); }while (g_console.menu_enable); diff --git a/ps3/ps3_video_psgl.c b/ps3/ps3_video_psgl.c index b67dabc5f5..725d5a479d 100644 --- a/ps3/ps3_video_psgl.c +++ b/ps3/ps3_video_psgl.c @@ -100,7 +100,6 @@ static const GLfloat white_color[] = { }; struct { - bool block_swap; bool overscan_enable; GLfloat overscan_amount; #ifdef HAVE_CG_MENU @@ -954,8 +953,8 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei gl_render_msg_post(gl); } - if(!ps3_gl.block_swap) - psglSwap(); + if(!gl->block_swap) + gfx_ctx_swap_buffers(); return true; } @@ -1202,19 +1201,11 @@ static bool gl_focus(void *data) return gfx_ctx_window_has_focus(); } -static void ps3graphics_set_swap_block_swap(void * data, bool toggle) +static void ps3graphics_set_swap_block_swap(void * data, bool enable) { - (void)data; - ps3_gl.block_swap = toggle; -} + gl_t *gl = driver.video_data; -static void ps3graphics_swap(void * data) -{ - (void)data; - psglSwap(); -#ifdef HAVE_SYSUTILS - cellSysutilCheckCallback(); -#endif + gl->block_swap = enable; } static void ps3graphics_set_aspect_ratio(void * data, uint32_t aspectratio_index) @@ -1245,7 +1236,6 @@ const video_driver_t video_gl = .set_swap_block_state = ps3graphics_set_swap_block_swap, .set_rotation = ps3graphics_set_orientation, .set_aspect_ratio = ps3graphics_set_aspect_ratio, - .swap = ps3graphics_swap }; static void get_all_available_resolutions (void)