(PS3) Move set_filtering and set_fbo to ps3_ctx.c

This commit is contained in:
Twinaphex 2012-05-27 18:04:25 +02:00
parent f32bc9e017
commit 90d6aca1e1
5 changed files with 47 additions and 42 deletions

View File

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

View File

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

View File

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

View File

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

View File

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