diff --git a/gfx/context/ps3_ctx.c b/gfx/context/ps3_ctx.c index ffac36ee38..60edacd8c5 100644 --- a/gfx/context/ps3_ctx.c +++ b/gfx/context/ps3_ctx.c @@ -178,3 +178,37 @@ void gfx_ctx_destroy(void) } void gfx_ctx_input_driver(const input_driver_t **input, void **input_data) { } + +void gfx_ctx_set_filtering(unsigned index, bool set_smooth) +{ + gl_t *gl = driver.video_data; + + if (!gl) + return; + + if (index == 1) + { + // Apply to all PREV textures. + for (unsigned i = 0; i < TEXTURES; i++) + { + glBindTexture(GL_TEXTURE_2D, gl->texture[i]); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, set_smooth ? GL_LINEAR : GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, set_smooth ? GL_LINEAR : GL_NEAREST); + } + } + else if (index >= 2 && gl->fbo_inited) + { + glBindTexture(GL_TEXTURE_2D, gl->fbo_texture[index - 2]); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, set_smooth ? GL_LINEAR : GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, set_smooth ? GL_LINEAR : GL_NEAREST); + } + + glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]); +} + +void gfx_ctx_set_fbo(bool enable) +{ + gl_t *gl = driver.video_data; + gl->fbo_inited = enable; + gl->render_to_tex = enable; +} diff --git a/gfx/gfx_context.h b/gfx/gfx_context.h index f3ff2f54c6..cf1dc44973 100644 --- a/gfx/gfx_context.h +++ b/gfx/gfx_context.h @@ -62,5 +62,9 @@ void gfx_ctx_input_driver(const input_driver_t **input, void **input_data); bool gfx_ctx_menu_init(void) #endif +#ifdef RARCH_CONSOLE +void gfx_ctx_set_filtering(unsigned index, bool set_smooth); +#endif + #endif diff --git a/ps3/menu.c b/ps3/menu.c index 7c10d6f0d7..642c8973c4 100644 --- a/ps3/menu.c +++ b/ps3/menu.c @@ -1328,33 +1328,33 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue) if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state)) { g_settings.video.smooth = !g_settings.video.smooth; - ps3_set_filtering(1, g_settings.video.smooth); + gfx_ctx_set_filtering(1, g_settings.video.smooth); set_delay = DELAY_LONG; } if(CTRL_START(state)) { g_settings.video.smooth = 1; - ps3_set_filtering(1, g_settings.video.smooth); + gfx_ctx_set_filtering(1, g_settings.video.smooth); } break; case SETTING_HW_TEXTURE_FILTER_2: if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state)) { g_settings.video.second_pass_smooth = !g_settings.video.second_pass_smooth; - ps3_set_filtering(2, g_settings.video.second_pass_smooth); + gfx_ctx_set_filtering(2, g_settings.video.second_pass_smooth); set_delay = DELAY_LONG; } if(CTRL_START(state)) { g_settings.video.second_pass_smooth = 1; - ps3_set_filtering(2, g_settings.video.second_pass_smooth); + gfx_ctx_set_filtering(2, g_settings.video.second_pass_smooth); } break; case SETTING_SCALE_ENABLED: if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state)) { g_console.fbo_enabled = !g_console.fbo_enabled; - gl_set_fbo_enable(g_console.fbo_enabled); + gfx_ctx_set_fbo(g_console.fbo_enabled); set_delay = DELAY_MEDIUM; diff --git a/ps3/ps3_video_psgl.c b/ps3/ps3_video_psgl.c index 220ca10532..2fb619e694 100644 --- a/ps3/ps3_video_psgl.c +++ b/ps3/ps3_video_psgl.c @@ -275,13 +275,6 @@ static bool gl_shader_filter_type(unsigned index, bool *smooth) return valid; } -void gl_set_fbo_enable (bool enable) -{ - gl_t *gl = driver.video_data; - gl->fbo_inited = enable; - gl->render_to_tex = false; -} - #ifdef HAVE_FBO static void gl_shader_scale(unsigned index, struct gl_fbo_scale *scale) { @@ -1281,33 +1274,6 @@ const char * ps3_get_resolution_label(uint32_t resolution) } } -void ps3_set_filtering(unsigned index, bool set_smooth) -{ - gl_t *gl = driver.video_data; - - if (!gl) - return; - - if (index == 1) - { - // Apply to all PREV textures. - for (unsigned i = 0; i < TEXTURES; i++) - { - glBindTexture(GL_TEXTURE_2D, gl->texture[i]); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, set_smooth ? GL_LINEAR : GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, set_smooth ? GL_LINEAR : GL_NEAREST); - } - } - else if (index >= 2 && gl->fbo_inited) - { - glBindTexture(GL_TEXTURE_2D, gl->fbo_texture[index - 2]); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, set_smooth ? GL_LINEAR : GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, set_smooth ? GL_LINEAR : GL_NEAREST); - } - - glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]); -} - void ps3graphics_set_overscan(void) { gl_t * gl = driver.video_data; @@ -1333,7 +1299,10 @@ void ps3graphics_video_init(bool get_all_resolutions) video_info.height = g_console.viewports.custom_vp.height; } driver.video_data = gl_init(&video_info, NULL, NULL); - gl_set_fbo_enable(g_console.fbo_enabled); + +#ifdef HAVE_FBO + gfx_ctx_set_fbo(g_console.fbo_enabled); +#endif if(get_all_resolutions) get_all_available_resolutions(); diff --git a/ps3/ps3_video_psgl.h b/ps3/ps3_video_psgl.h index 497deb9266..96bc8cf4c5 100644 --- a/ps3/ps3_video_psgl.h +++ b/ps3/ps3_video_psgl.h @@ -40,10 +40,8 @@ const char * ps3_get_resolution_label(uint32_t resolution); int ps3_check_resolution(uint32_t resolution_id); void gl_deinit_fbo(gl_t * gl); void gl_init_fbo(gl_t * gl, unsigned width, unsigned height); -void gl_set_fbo_enable(bool enable); void ps3_previous_resolution (void); void ps3_next_resolution (void); -void ps3_set_filtering(unsigned index, bool set_smooth); void ps3_video_deinit(void); void ps3graphics_reinit_fbos(void); void ps3graphics_set_overscan(void);