mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-04-05 22:46:56 +00:00
gl: Make vsync setting dynamic
This commit is contained in:
parent
7a7e25f901
commit
cb501e32ca
3 changed files with 31 additions and 15 deletions
|
|
@ -138,21 +138,7 @@ void GLGSRender::on_init_thread()
|
|||
gl::init();
|
||||
gl::set_command_context(gl_state);
|
||||
|
||||
// Enable adaptive vsync if vsync is requested
|
||||
int swap_interval = 0;
|
||||
switch (g_cfg.video.vsync)
|
||||
{
|
||||
default:
|
||||
case vsync_mode::off:
|
||||
break;
|
||||
case vsync_mode::adaptive:
|
||||
swap_interval = -1;
|
||||
break;
|
||||
case vsync_mode::full:
|
||||
swap_interval = 1;
|
||||
break;
|
||||
}
|
||||
gl::set_swapinterval(swap_interval);
|
||||
update_swap_interval();
|
||||
|
||||
if (g_cfg.video.debug_output)
|
||||
gl::enable_debugging();
|
||||
|
|
@ -593,6 +579,33 @@ void GLGSRender::on_exit()
|
|||
gl::set_primary_context_thread(false);
|
||||
}
|
||||
|
||||
void GLGSRender::update_swap_interval()
|
||||
{
|
||||
const vsync_mode current_mode = g_cfg.video.vsync;
|
||||
if (current_mode == m_vsync_mode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Enable adaptive vsync if vsync is requested
|
||||
int swap_interval = 0;
|
||||
switch (current_mode)
|
||||
{
|
||||
default:
|
||||
case vsync_mode::off:
|
||||
break;
|
||||
case vsync_mode::adaptive:
|
||||
swap_interval = -1;
|
||||
break;
|
||||
case vsync_mode::full:
|
||||
swap_interval = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
gl::set_swapinterval(swap_interval);
|
||||
m_vsync_mode = current_mode;
|
||||
}
|
||||
|
||||
void GLGSRender::clear_surface(u32 arg)
|
||||
{
|
||||
if (skip_current_frame) return;
|
||||
|
|
|
|||
|
|
@ -186,6 +186,8 @@ private:
|
|||
|
||||
gl::texture* get_present_source(gl::present_surface_info* info, const rsx::avconf& avconfig);
|
||||
|
||||
void update_swap_interval();
|
||||
|
||||
public:
|
||||
void set_viewport();
|
||||
void set_scissor(bool clip_viewport);
|
||||
|
|
|
|||
|
|
@ -252,6 +252,7 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
|
|||
if (info.emu_flip)
|
||||
{
|
||||
evaluate_cpu_usage_reduction_limits();
|
||||
update_swap_interval();
|
||||
}
|
||||
|
||||
// Get window state
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue