(PS3) set_filtering function (WIP)

This commit is contained in:
TwinAphex51224 2012-01-30 09:28:41 +01:00
parent 35e5f2dbc6
commit 8deab9ea35
3 changed files with 29 additions and 4 deletions

View File

@ -941,26 +941,26 @@ 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;
//ps3graphics_set_smooth(g_settings.video.smooth, 0);
ps3_set_filtering(1, g_settings.video.smooth);
set_text_message("", 7);
}
if(CTRL_START(state))
{
g_settings.video.smooth = 1;
//ps3graphics_set_smooth(g_settings.video.smooth, 0);
ps3_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;
//ps3graphics_set_smooth(g_settings.video.second_pass_smooth, 1);
ps3_set_filtering(2, g_settings.video.second_pass_smooth);
set_text_message("", 7);
}
if(CTRL_START(state))
{
g_settings.video.second_pass_smooth = 1;
//ps3graphics_set_smooth(g_settings.video.second_pass_smooth, 1);
ps3_set_filtering(2, g_settings.video.second_pass_smooth);
}
break;
case SETTING_SCALE_ENABLED:

View File

@ -542,6 +542,7 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei
set_viewport(gl, gl->fbo_rect[0].img_width, gl->fbo_rect[0].img_height, true);
}
#if 0
if (gl->should_resize)
{
gl->should_resize = false;
@ -585,6 +586,7 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei
set_viewport(gl, gl->fbo_rect[0].img_width, gl->fbo_rect[0].img_height, true);
}
}
#endif
if ((width != gl->last_width[gl->tex_index] || height != gl->last_height[gl->tex_index]) && gl->empty_buf) // Res change. need to clear out texture.
{
@ -1160,6 +1162,28 @@ bool ps3_setup_texture(void)
return true;
}
void ps3_set_filtering(unsigned index, bool set_smooth)
{
gl_t * gl = g_gl;
if(!gl)
return;
if(gl->fbo_inited)
glBindTexture(GL_TEXTURE_2D, gl->fbo_texture[index]);
else
glBindTexture(GL_TEXTURE_2D, gl->texture[index]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
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);
if(gl->fbo_inited)
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
}
/* PS3 needs a working graphics stack before SSNES even starts.
To deal with this main.c, the top level module owns the instance,

View File

@ -34,6 +34,7 @@ void ps3_block_swap (void);
void ps3_unblock_swap (void);
void gl_frame_menu(void);
bool ps3_setup_texture(void);
void ps3_set_filtering(unsigned index, bool set_smooth);
extern void *g_gl;