diff --git a/gtk/src/gtk_config.cpp b/gtk/src/gtk_config.cpp
index 94307307..88a04f92 100644
--- a/gtk/src/gtk_config.cpp
+++ b/gtk/src/gtk_config.cpp
@@ -139,13 +139,9 @@ int Snes9xConfig::load_defaults()
Settings.Rewinding = false;
sync_to_vblank = true;
- use_pbos = true;
- pbo_format = 0;
- npot_textures = true;
use_shaders = false;
shader_filename.clear();
- use_glfinish = false;
- use_sync_control = false;
+ reduce_input_lag = false;
/* Snes9x Variables */
Settings.MouseMaster = true;
@@ -245,12 +241,8 @@ int Snes9xConfig::save_config_file()
section = "OpenGL";
outbool("VSync", sync_to_vblank);
- outbool("glFinish", use_glfinish);
- outbool("SyncControl", use_sync_control);
- outbool("UseNonPowerOfTwoTextures", npot_textures);
+ outbool("ReduceInputLag", reduce_input_lag);
outbool("EnableCustomShaders", use_shaders);
- outbool("UsePixelBufferObjects", use_pbos);
- outint("PixelBufferObjectBitDepth", pbo_format);
outstring("ShaderFile", shader_filename);
section = "Sound";
@@ -472,11 +464,7 @@ int Snes9xConfig::load_config_file()
section = "OpenGL";
inbool("VSync", sync_to_vblank);
- inbool("glFinish", use_glfinish);
- inbool("SyncControl", use_sync_control);
- inbool("UsePixelBufferObjects", use_pbos);
- inint("PixelBufferObjectBitDepth", pbo_format);
- inbool("UseNonPowerOfTwoTextures", npot_textures);
+ inbool("ReduceInputLag", reduce_input_lag);
inbool("EnableCustomShaders", use_shaders);
instr("ShaderFile", shader_filename);
@@ -642,9 +630,6 @@ int Snes9xConfig::load_config_file()
scale_method = 0;
#endif /* USE_XBRZ */
- if (pbo_format != 32)
- pbo_format = 16;
-
if (Settings.SkipFrames == THROTTLE_SOUND_SYNC)
Settings.SoundSync = true;
else
diff --git a/gtk/src/gtk_config.h b/gtk/src/gtk_config.h
index 73c0c215..207af3f5 100644
--- a/gtk/src/gtk_config.h
+++ b/gtk/src/gtk_config.h
@@ -150,13 +150,9 @@ class Snes9xConfig
XRRCrtcInfo *xrr_crtc_info;
bool sync_to_vblank;
- bool use_pbos;
- int pbo_format;
- bool npot_textures;
bool use_shaders;
std::string shader_filename;
- bool use_glfinish;
- bool use_sync_control;
+ bool reduce_input_lag;
JoyDevices joysticks;
int joystick_threshold;
diff --git a/gtk/src/gtk_display_driver_opengl.cpp b/gtk/src/gtk_display_driver_opengl.cpp
index b03c7de5..9e28bd77 100644
--- a/gtk/src/gtk_display_driver_opengl.cpp
+++ b/gtk/src/gtk_display_driver_opengl.cpp
@@ -89,7 +89,7 @@ S9xOpenGLDisplayDriver::S9xOpenGLDisplayDriver(Snes9xWindow *window, Snes9xConfi
void S9xOpenGLDisplayDriver::update(uint16_t *buffer, int width, int height, int stride_in_pixels)
{
Gtk::Allocation allocation = drawing_area->get_allocation();
-
+
if (output_window_width != allocation.get_width() ||
output_window_height != allocation.get_height())
{
@@ -119,61 +119,8 @@ void S9xOpenGLDisplayDriver::update(uint16_t *buffer, int width, int height, int
update_texture_size(width, height);
- if (using_pbos)
- {
- void *pbo_memory = NULL;
- GLbitfield bits = GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT | GL_MAP_UNSYNCHRONIZED_BIT;
-
- if (config->pbo_format == 16)
- {
- glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo);
- glBufferData(GL_PIXEL_UNPACK_BUFFER, width * height * 2, NULL, GL_STREAM_DRAW);
-
- if (version >= 30)
- pbo_memory = glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, width * height * 2, bits);
- else
- pbo_memory = glMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
-
- for (int y = 0; y < height; y++)
- {
- uint16 *dst = (uint16_t *)pbo_memory + (width * y);
- uint16 *src = &buffer[y * stride_in_pixels];
- memcpy(dst, src, width * 2);
- }
- glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
-
- glPixelStorei(GL_UNPACK_ROW_LENGTH, width);
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGB,
- GL_UNSIGNED_SHORT_5_6_5, BUFFER_OFFSET(0));
-
- glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
- }
- else /* 32-bit color */
- {
- glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo);
- glBufferData(GL_PIXEL_UNPACK_BUFFER, width * height * 4, NULL, GL_STREAM_DRAW);
-
- if (version >= 30)
- pbo_memory = glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, width * height * 4, bits);
- else
- pbo_memory = glMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
-
- /* Pixel swizzling in software */
- S9xConvert(buffer, pbo_memory, stride_in_pixels * 2, width * 4, width, height, 32);
-
- glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
-
- glPixelStorei(GL_UNPACK_ROW_LENGTH, width);
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_BGRA, GL_UNSIGNED_BYTE, BUFFER_OFFSET(0));
-
- glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
- }
- }
- else
- {
- glPixelStorei(GL_UNPACK_ROW_LENGTH, stride_in_pixels);
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, buffer);
- }
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, stride_in_pixels);
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, buffer);
if (using_glsl_shaders)
{
@@ -213,30 +160,15 @@ void S9xOpenGLDisplayDriver::update_texture_size(int width, int height)
{
glBindTexture(GL_TEXTURE_2D, texmap);
- if (using_pbos && config->pbo_format == 32)
- {
- glTexImage2D(GL_TEXTURE_2D,
- 0,
- GL_RGBA,
- width,
- height,
- 0,
- GL_BGRA,
- GL_UNSIGNED_BYTE,
- NULL);
- }
- else
- {
- glTexImage2D(GL_TEXTURE_2D,
- 0,
- GL_RGB565,
- width,
- height,
- 0,
- GL_RGB,
- GL_UNSIGNED_SHORT_5_6_5,
- NULL);
- }
+ glTexImage2D(GL_TEXTURE_2D,
+ 0,
+ GL_RGB565,
+ width,
+ height,
+ 0,
+ GL_RGB,
+ GL_UNSIGNED_SHORT_5_6_5,
+ NULL);
coords[9] = 1.0f;
coords[10] = 1.0f;
@@ -306,15 +238,6 @@ bool S9xOpenGLDisplayDriver::load_shaders(const char *shader_file)
bool S9xOpenGLDisplayDriver::opengl_defaults()
{
npot = false;
- using_pbos = false;
-
- if (config->use_pbos)
- {
- if (version >= 15)
- using_pbos = true;
- else
- config->use_pbos = false;
- }
using_glsl_shaders = false;
glsl_shader = NULL;
@@ -330,10 +253,7 @@ bool S9xOpenGLDisplayDriver::opengl_defaults()
texture_width = 1024;
texture_height = 1024;
- if (config->npot_textures)
- {
- npot = true;
- }
+ npot = true;
if (legacy)
{
@@ -402,45 +322,18 @@ bool S9xOpenGLDisplayDriver::opengl_defaults()
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
- if (config->use_pbos)
- {
- glGenBuffers(1, &pbo);
- glGenTextures(1, &texmap);
+ glGenTextures(1, &texmap);
- glBindTexture(GL_TEXTURE_2D, texmap);
- glTexImage2D(GL_TEXTURE_2D,
- 0,
- config->pbo_format == 16 ? GL_RGB565 : GL_RGBA,
- texture_width,
- texture_height,
- 0,
- config->pbo_format == 16 ? GL_RGB : GL_BGRA,
- config->pbo_format == 16 ? GL_UNSIGNED_SHORT_5_6_5 : GL_UNSIGNED_BYTE,
- NULL);
-
- glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo);
- glBufferData(GL_PIXEL_UNPACK_BUFFER,
- texture_width * texture_height * 3,
- NULL,
- GL_STREAM_DRAW);
-
- glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
- }
- else
- {
- glGenTextures(1, &texmap);
-
- glBindTexture(GL_TEXTURE_2D, texmap);
- glTexImage2D(GL_TEXTURE_2D,
- 0,
- GL_RGB565,
- texture_width,
- texture_height,
- 0,
- GL_RGB,
- GL_UNSIGNED_SHORT_5_6_5,
- NULL);
- }
+ glBindTexture(GL_TEXTURE_2D, texmap);
+ glTexImage2D(GL_TEXTURE_2D,
+ 0,
+ GL_RGB565,
+ texture_width,
+ texture_height,
+ 0,
+ GL_RGB,
+ GL_UNSIGNED_SHORT_5_6_5,
+ NULL);
glClearColor(0.0, 0.0, 0.0, 0.0);
@@ -535,7 +428,7 @@ void S9xOpenGLDisplayDriver::swap_buffers()
{
context->swap_buffers();
- if (config->use_glfinish && !config->use_sync_control)
+ if (config->reduce_input_lag)
{
usleep(0);
glFinish();
@@ -555,12 +448,6 @@ void S9xOpenGLDisplayDriver::deinit()
delete glsl_shader;
}
- if (using_pbos)
- {
- glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
- glDeleteBuffers(1, &pbo);
- }
-
glDeleteTextures(1, &texmap);
}
diff --git a/gtk/src/gtk_display_driver_opengl.h b/gtk/src/gtk_display_driver_opengl.h
index 9a80d58f..64dc8996 100644
--- a/gtk/src/gtk_display_driver_opengl.h
+++ b/gtk/src/gtk_display_driver_opengl.h
@@ -52,13 +52,11 @@ class S9xOpenGLDisplayDriver : public S9xDisplayDriver
GLint texture_width;
GLint texture_height;
GLuint texmap;
- GLuint pbo;
bool legacy;
bool core;
int version;
bool npot;
- bool using_pbos;
bool initialized;
bool using_glsl_shaders;
diff --git a/gtk/src/gtk_display_driver_vulkan.cpp b/gtk/src/gtk_display_driver_vulkan.cpp
index a16f0806..1c806e93 100644
--- a/gtk/src/gtk_display_driver_vulkan.cpp
+++ b/gtk/src/gtk_display_driver_vulkan.cpp
@@ -287,6 +287,9 @@ void S9xVulkanDisplayDriver::update(uint16_t *buffer, int width, int height, int
if (!context)
return;
+ if (gui_config->reduce_input_lag)
+ device.waitIdle();
+
auto viewport = S9xApplyAspect(width, height, current_width, current_height);
if (shaderchain)
diff --git a/gtk/src/gtk_glx_context.cpp b/gtk/src/gtk_glx_context.cpp
index 8eb2104c..463f2ae6 100644
--- a/gtk/src/gtk_glx_context.cpp
+++ b/gtk/src/gtk_glx_context.cpp
@@ -18,8 +18,6 @@ GTKGLXContext::GTKGLXContext()
version_major = -1;
version_minor = -1;
- use_oml_sync_control = false;
- ust = msc = sbc = 0;
}
GTKGLXContext::~GTKGLXContext()
@@ -93,9 +91,6 @@ bool GTKGLXContext::create_context()
return false;
}
- if (strstr(extensions, "GLX_OML_sync_control") && gui_config->use_sync_control)
- use_oml_sync_control = true;
-
return true;
}
@@ -116,24 +111,11 @@ void GTKGLXContext::resize()
void GTKGLXContext::swap_buffers()
{
- if (use_oml_sync_control)
- glXGetSyncValuesOML(display, xid, &ust, &msc, &sbc);
-
glXSwapBuffers(display, xid);
}
bool GTKGLXContext::ready()
{
- if (use_oml_sync_control)
- {
- int64 ust, msc, sbc;
- glXGetSyncValuesOML(display, xid, &ust, &msc, &sbc);
-
- if (sbc != this->sbc || msc - this->msc > 2)
- return true;
- return false;
- }
-
return true;
}
diff --git a/gtk/src/gtk_glx_context.h b/gtk/src/gtk_glx_context.h
index 59c954f1..272d7b61 100644
--- a/gtk/src/gtk_glx_context.h
+++ b/gtk/src/gtk_glx_context.h
@@ -32,9 +32,6 @@ class GTKGLXContext : public OpenGLContext
int version_major;
int version_minor;
-
- bool use_oml_sync_control;
- int64_t ust, msc, sbc;
};
#endif
diff --git a/gtk/src/gtk_preferences.cpp b/gtk/src/gtk_preferences.cpp
index e67460cf..df07108a 100644
--- a/gtk/src/gtk_preferences.cpp
+++ b/gtk/src/gtk_preferences.cpp
@@ -466,11 +466,7 @@ void Snes9xPreferences::move_settings_to_dialog()
set_check ("bilinear_filter", Settings.BilinearFilter);
set_check ("sync_to_vblank", config->sync_to_vblank);
- set_check ("use_glfinish", config->use_glfinish);
- set_check ("use_sync_control", config->use_sync_control);
- set_check ("use_pbos", config->use_pbos);
- set_combo ("pixel_format", config->pbo_format == 16 ? 0 : 1);
- set_check ("npot_textures", config->npot_textures);
+ set_check ("reduce_input_lag", config->reduce_input_lag);
set_check ("use_shaders", config->use_shaders);
set_entry_text ("fragment_shader", config->shader_filename.c_str ());
@@ -628,13 +624,7 @@ void Snes9xPreferences::get_settings_from_dialog()
Settings.InterpolationMethod = get_combo("sound_filter");
#endif
- int pbo_format = get_combo("pixel_format") == 1 ? 32 : 16;
-
if (config->sync_to_vblank != get_check("sync_to_vblank") ||
- config->use_sync_control != get_check("use_sync_control") ||
- config->npot_textures != get_check("npot_textures") ||
- config->use_pbos != get_check("use_pbos") ||
- config->pbo_format != pbo_format ||
config->use_shaders != get_check("use_shaders") ||
(config->shader_filename.compare(get_entry_text("fragment_shader"))))
{
@@ -642,13 +632,9 @@ void Snes9xPreferences::get_settings_from_dialog()
}
config->sync_to_vblank = get_check("sync_to_vblank");
- config->use_pbos = get_check("use_pbos");
- config->npot_textures = get_check("npot_textures");
config->use_shaders = get_check("use_shaders");
- config->use_glfinish = get_check("use_glfinish");
- config->use_sync_control = get_check("use_sync_control");
+ config->reduce_input_lag = get_check("reduce_input_lag");
config->shader_filename = get_entry_text ("fragment_shader");
- config->pbo_format = pbo_format;
std::string new_sram_directory = get_entry_text("sram_directory");
config->savestate_directory = get_entry_text("savestate_directory");
diff --git a/gtk/src/gtk_wayland_egl_context.cpp b/gtk/src/gtk_wayland_egl_context.cpp
index 1648b910..4e597a3b 100644
--- a/gtk/src/gtk_wayland_egl_context.cpp
+++ b/gtk/src/gtk_wayland_egl_context.cpp
@@ -53,8 +53,6 @@ WaylandEGLContext::WaylandEGLContext()
egl_context = NULL;
egl_config = NULL;
egl_window = NULL;
- use_sync_control = false;
- ust = msc = sbc = 0;
idle_inhibit_manager = NULL;
idle_inhibitor = NULL;
}
@@ -188,13 +186,6 @@ bool WaylandEGLContext::create_context()
}
}
- if (gui_config->use_sync_control && epoxy_has_egl_extension(egl_display, "EGL_CHROMIUM_sync_control"))
- {
- eglGetSyncValuesCHROMIUM = (PEGLGETSYNCVALUESCHROMIUM)eglGetProcAddress("eglGetSyncValuesCHROMIUM");
- if (eglGetSyncValuesCHROMIUM)
- use_sync_control = true;
- }
-
wl_surface_set_buffer_scale(child, scale);
gdk_window_invalidate_rect(gdk_window, NULL, false);
@@ -216,24 +207,12 @@ void WaylandEGLContext::resize()
void WaylandEGLContext::swap_buffers()
{
- if (use_sync_control)
- eglGetSyncValuesCHROMIUM(egl_display, egl_surface, &ust, &msc, &sbc);
-
eglSwapBuffers(egl_display, egl_surface);
wl_surface_commit(child);
}
bool WaylandEGLContext::ready()
{
- if (use_sync_control)
- {
- EGLuint64KHR ust, msc, sbc;
- eglGetSyncValuesCHROMIUM(egl_display, egl_surface, &ust, &msc, &sbc);
- if (sbc != this->sbc || msc - this->msc > 2)
- return true;
- return false;
- }
-
return true;
}
diff --git a/gtk/src/gtk_wayland_egl_context.h b/gtk/src/gtk_wayland_egl_context.h
index b494f579..f01c4590 100644
--- a/gtk/src/gtk_wayland_egl_context.h
+++ b/gtk/src/gtk_wayland_egl_context.h
@@ -45,11 +45,6 @@ class WaylandEGLContext : public OpenGLContext
wl_egl_window *egl_window;
- typedef EGLBoolean (*PEGLGETSYNCVALUESCHROMIUM)(EGLDisplay, EGLSurface, EGLuint64KHR *, EGLuint64KHR *, EGLuint64KHR *);
- PEGLGETSYNCVALUESCHROMIUM eglGetSyncValuesCHROMIUM;
- bool use_sync_control;
- EGLuint64KHR ust, msc, sbc;
-
struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager;
struct zwp_idle_inhibitor_v1 *idle_inhibitor;
};
diff --git a/gtk/src/snes9x.ui b/gtk/src/snes9x.ui
index e1bb91d5..961f3dcf 100644
--- a/gtk/src/snes9x.ui
+++ b/gtk/src/snes9x.ui
@@ -3826,8 +3826,8 @@
-
-
-
- Reduce input lag with sync control
- True
- True
- False
- More modern method for syncing the program with the video output to reduce input latency. Allows GUI events to occur in the meantime
- True
-
-
- False
- True
- 2
-
-
-
-
- Allow non-power-of-two textures
- True
- True
- False
- Prevents edge artifacts, but can slow performance
- True
-
-
- False
- True
- 3
-
-
-
-
- Use pixel-buffer objects
- True
- True
- False
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- Can be faster or slower depending on drivers
- True
-
-
- False
- True
- 4
-
-
-
-
- True
- False
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- 10
-
-
- True
- False
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- Different formats can yield highly different performance
- 10
-
-
- True
- False
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- Pixel-buffer format:
-
-
- False
- True
- 0
-
-
-
-
- True
- False
- GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- liststore8
-
-
-
- 0
-
-
-
-
- False
- True
- 1
-
-
-
-
-
-
- False
- True
- 5
-
-
True
@@ -3995,7 +3895,7 @@
False
True
- 6
+ 2