mirror of https://github.com/snes9xgit/snes9x.git
GTK+: OpenGL: Separate glFinish and glFenceSync options.
This commit is contained in:
parent
4e84647499
commit
3eea50654f
|
@ -149,6 +149,7 @@ int Snes9xConfig::load_defaults ()
|
|||
use_shaders = 0;
|
||||
shader_filename[0] = '\0';
|
||||
sync_every_frame = FALSE;
|
||||
use_fences = FALSE;
|
||||
#endif
|
||||
|
||||
/* Snes9X Variables */
|
||||
|
@ -263,7 +264,8 @@ int Snes9xConfig::save_config_file ()
|
|||
#undef z
|
||||
#define z "OpenGL::"
|
||||
outbool (cf, z"VSync", sync_to_vblank);
|
||||
outbool (cf, z"ReduceInputLag", sync_every_frame);
|
||||
outbool (cf, z"glFinish", sync_every_frame);
|
||||
outbool (cf, z"glFenceSync", use_fences);
|
||||
outbool (cf, z"UsePixelBufferObjects", use_pbos);
|
||||
cf.SetInt (z"PixelBufferObjectBitDepth", pbo_format);
|
||||
outbool (cf, z"UseNonPowerOfTwoTextures", npot_textures);
|
||||
|
@ -493,7 +495,8 @@ int Snes9xConfig::load_config_file ()
|
|||
#undef z
|
||||
#define z "OpenGL::"
|
||||
inbool (z"VSync", sync_to_vblank);
|
||||
inbool (z"ReduceInputLag", sync_every_frame);
|
||||
inbool (z"glFinish", sync_every_frame);
|
||||
inbool (z"glFenceSync", use_fences);
|
||||
inbool (z"UsePixelBufferObjects", use_pbos);
|
||||
inint (z"PixelBufferObjectBitDepth", pbo_format);
|
||||
inbool (z"UseNonPowerOfTwoTextures", npot_textures);
|
||||
|
|
|
@ -150,6 +150,7 @@ class Snes9xConfig
|
|||
unsigned char use_shaders;
|
||||
char shader_filename[PATH_MAX];
|
||||
unsigned char sync_every_frame;
|
||||
unsigned char use_fences;
|
||||
#endif
|
||||
|
||||
JoyDevice **joystick;
|
||||
|
|
|
@ -646,19 +646,16 @@ void S9xOpenGLDisplayDriver::swap_buffers ()
|
|||
{
|
||||
context->swap_buffers ();
|
||||
|
||||
if (config->sync_every_frame)
|
||||
if (config->sync_every_frame && !config->use_fences)
|
||||
{
|
||||
if (fences)
|
||||
{
|
||||
if (fence)
|
||||
glDeleteSync (fence);
|
||||
fence = glFenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
usleep (0);
|
||||
glFinish ();
|
||||
}
|
||||
usleep (0);
|
||||
glFinish ();
|
||||
}
|
||||
else if (config->use_fences && fences)
|
||||
{
|
||||
if (fence)
|
||||
glDeleteSync (fence);
|
||||
fence = glFenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -731,5 +728,6 @@ bool S9xOpenGLDisplayDriver::is_ready ()
|
|||
|
||||
glDeleteSync (fence);
|
||||
fence = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -708,6 +708,7 @@ Snes9xPreferences::move_settings_to_dialog ()
|
|||
#ifdef USE_OPENGL
|
||||
set_check ("sync_to_vblank", config->sync_to_vblank);
|
||||
set_check ("sync_every_frame", config->sync_every_frame);
|
||||
set_check ("use_fences", config->use_fences);
|
||||
set_check ("use_pbos", config->use_pbos);
|
||||
set_combo ("pixel_format", config->pbo_format == 16 ? 0 : 1);
|
||||
set_check ("npot_textures", config->npot_textures);
|
||||
|
@ -865,6 +866,7 @@ Snes9xPreferences::get_settings_from_dialog ()
|
|||
config->npot_textures = get_check ("npot_textures");
|
||||
config->use_shaders = get_check ("use_shaders");
|
||||
config->sync_every_frame = get_check ("sync_every_frame");
|
||||
config->use_fences = get_check ("use_fences");
|
||||
|
||||
sstrncpy (config->shader_filename, get_entry_text ("fragment_shader"), PATH_MAX);
|
||||
|
||||
|
|
|
@ -3819,7 +3819,7 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="sync_every_frame">
|
||||
<property name="label" translatable="yes">Reduce input lag</property>
|
||||
<property name="label" translatable="yes">Reduce input lag with glFinish</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
|
@ -3832,6 +3832,21 @@
|
|||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="use_fences">
|
||||
<property name="label" translatable="yes">Reduce input lag with glFenceSync</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Sync the program with the video output after every displayed frame to reduce input latency, but allow GUI events to occur in the meantime</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="npot_textures">
|
||||
<property name="label" translatable="yes">Allow non-power-of-two textures</property>
|
||||
|
@ -3844,7 +3859,7 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -3860,7 +3875,7 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -3914,7 +3929,7 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">4</property>
|
||||
<property name="position">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -3972,7 +3987,7 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">5</property>
|
||||
<property name="position">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
|
Loading…
Reference in New Issue