mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-27 17:42:40 -06:00
config: Add a setting for graphics V-Sync.
This commit is contained in:
parent
2267f98941
commit
08ad9b36d4
9 changed files with 20 additions and 1 deletions
|
@ -71,6 +71,7 @@ void Config::ReadValues() {
|
||||||
Settings::values.use_hw_renderer = sdl2_config->GetBoolean("Renderer", "use_hw_renderer", true);
|
Settings::values.use_hw_renderer = sdl2_config->GetBoolean("Renderer", "use_hw_renderer", true);
|
||||||
Settings::values.use_shader_jit = sdl2_config->GetBoolean("Renderer", "use_shader_jit", true);
|
Settings::values.use_shader_jit = sdl2_config->GetBoolean("Renderer", "use_shader_jit", true);
|
||||||
Settings::values.use_scaled_resolution = sdl2_config->GetBoolean("Renderer", "use_scaled_resolution", false);
|
Settings::values.use_scaled_resolution = sdl2_config->GetBoolean("Renderer", "use_scaled_resolution", false);
|
||||||
|
Settings::values.use_vsync = sdl2_config->GetBoolean("Renderer", "use_vsync", false);
|
||||||
|
|
||||||
Settings::values.bg_red = (float)sdl2_config->GetReal("Renderer", "bg_red", 1.0);
|
Settings::values.bg_red = (float)sdl2_config->GetReal("Renderer", "bg_red", 1.0);
|
||||||
Settings::values.bg_green = (float)sdl2_config->GetReal("Renderer", "bg_green", 1.0);
|
Settings::values.bg_green = (float)sdl2_config->GetReal("Renderer", "bg_green", 1.0);
|
||||||
|
|
|
@ -55,6 +55,10 @@ use_shader_jit =
|
||||||
# 0 (default): Native, 1: Scaled
|
# 0 (default): Native, 1: Scaled
|
||||||
use_scaled_resolution =
|
use_scaled_resolution =
|
||||||
|
|
||||||
|
# Whether to enable V-Sync (caps the framerate at 60FPS) or not.
|
||||||
|
# 0 (default): Off, 1: On
|
||||||
|
use_vsync =
|
||||||
|
|
||||||
# The clear color for the renderer. What shows up on the sides of the bottom screen.
|
# The clear color for the renderer. What shows up on the sides of the bottom screen.
|
||||||
# Must be in range of 0.0-1.0. Defaults to 1.0 for all.
|
# Must be in range of 0.0-1.0. Defaults to 1.0 for all.
|
||||||
bg_red =
|
bg_red =
|
||||||
|
|
|
@ -108,6 +108,7 @@ EmuWindow_SDL2::EmuWindow_SDL2() {
|
||||||
OnResize();
|
OnResize();
|
||||||
OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size);
|
OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size);
|
||||||
SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
|
SDL_GL_SetSwapInterval(Settings::values.use_vsync);
|
||||||
|
|
||||||
DoneCurrent();
|
DoneCurrent();
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,6 +119,7 @@ GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) :
|
||||||
QGLFormat fmt;
|
QGLFormat fmt;
|
||||||
fmt.setVersion(3,3);
|
fmt.setVersion(3,3);
|
||||||
fmt.setProfile(QGLFormat::CoreProfile);
|
fmt.setProfile(QGLFormat::CoreProfile);
|
||||||
|
fmt.setSwapInterval(VideoCore::g_vsync_enabled);
|
||||||
// Requests a forward-compatible context, which is required to get a 3.2+ context on OS X
|
// Requests a forward-compatible context, which is required to get a 3.2+ context on OS X
|
||||||
fmt.setOption(QGL::NoDeprecatedFunctions);
|
fmt.setOption(QGL::NoDeprecatedFunctions);
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ void Config::ReadValues() {
|
||||||
Settings::values.use_hw_renderer = qt_config->value("use_hw_renderer", true).toBool();
|
Settings::values.use_hw_renderer = qt_config->value("use_hw_renderer", true).toBool();
|
||||||
Settings::values.use_shader_jit = qt_config->value("use_shader_jit", true).toBool();
|
Settings::values.use_shader_jit = qt_config->value("use_shader_jit", true).toBool();
|
||||||
Settings::values.use_scaled_resolution = qt_config->value("use_scaled_resolution", false).toBool();
|
Settings::values.use_scaled_resolution = qt_config->value("use_scaled_resolution", false).toBool();
|
||||||
|
Settings::values.use_vsync = qt_config->value("use_vsync", false).toBool();
|
||||||
|
|
||||||
Settings::values.bg_red = qt_config->value("bg_red", 1.0).toFloat();
|
Settings::values.bg_red = qt_config->value("bg_red", 1.0).toFloat();
|
||||||
Settings::values.bg_green = qt_config->value("bg_green", 1.0).toFloat();
|
Settings::values.bg_green = qt_config->value("bg_green", 1.0).toFloat();
|
||||||
|
@ -139,6 +140,7 @@ void Config::SaveValues() {
|
||||||
qt_config->setValue("use_hw_renderer", Settings::values.use_hw_renderer);
|
qt_config->setValue("use_hw_renderer", Settings::values.use_hw_renderer);
|
||||||
qt_config->setValue("use_shader_jit", Settings::values.use_shader_jit);
|
qt_config->setValue("use_shader_jit", Settings::values.use_shader_jit);
|
||||||
qt_config->setValue("use_scaled_resolution", Settings::values.use_scaled_resolution);
|
qt_config->setValue("use_scaled_resolution", Settings::values.use_scaled_resolution);
|
||||||
|
qt_config->setValue("use_vsync", Settings::values.use_vsync);
|
||||||
|
|
||||||
// Cast to double because Qt's written float values are not human-readable
|
// Cast to double because Qt's written float values are not human-readable
|
||||||
qt_config->setValue("bg_red", (double)Settings::values.bg_red);
|
qt_config->setValue("bg_red", (double)Settings::values.bg_red);
|
||||||
|
|
|
@ -22,11 +22,12 @@ void ConfigureGraphics::setConfiguration() {
|
||||||
ui->toogle_hw_renderer->setChecked(Settings::values.use_hw_renderer);
|
ui->toogle_hw_renderer->setChecked(Settings::values.use_hw_renderer);
|
||||||
ui->toogle_shader_jit->setChecked(Settings::values.use_shader_jit);
|
ui->toogle_shader_jit->setChecked(Settings::values.use_shader_jit);
|
||||||
ui->toogle_scaled_resolution->setChecked(Settings::values.use_scaled_resolution);
|
ui->toogle_scaled_resolution->setChecked(Settings::values.use_scaled_resolution);
|
||||||
|
ui->toogle_vsync->setChecked(Settings::values.use_vsync);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureGraphics::applyConfiguration() {
|
void ConfigureGraphics::applyConfiguration() {
|
||||||
Settings::values.use_hw_renderer = ui->toogle_hw_renderer->isChecked();
|
Settings::values.use_hw_renderer = ui->toogle_hw_renderer->isChecked();
|
||||||
Settings::values.use_shader_jit = ui->toogle_shader_jit->isChecked();
|
Settings::values.use_shader_jit = ui->toogle_shader_jit->isChecked();
|
||||||
Settings::values.use_scaled_resolution = ui->toogle_scaled_resolution->isChecked();
|
Settings::values.use_vsync = ui->toogle_vsync->isChecked();
|
||||||
Settings::Apply();
|
Settings::Apply();
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="toogle_vsync">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable V-Sync</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -72,6 +72,7 @@ struct Values {
|
||||||
bool use_hw_renderer;
|
bool use_hw_renderer;
|
||||||
bool use_shader_jit;
|
bool use_shader_jit;
|
||||||
bool use_scaled_resolution;
|
bool use_scaled_resolution;
|
||||||
|
bool use_vsync;
|
||||||
|
|
||||||
float bg_red;
|
float bg_red;
|
||||||
float bg_green;
|
float bg_green;
|
||||||
|
|
|
@ -22,6 +22,7 @@ std::unique_ptr<RendererBase> g_renderer; ///< Renderer plugin
|
||||||
std::atomic<bool> g_hw_renderer_enabled;
|
std::atomic<bool> g_hw_renderer_enabled;
|
||||||
std::atomic<bool> g_shader_jit_enabled;
|
std::atomic<bool> g_shader_jit_enabled;
|
||||||
std::atomic<bool> g_scaled_resolution_enabled;
|
std::atomic<bool> g_scaled_resolution_enabled;
|
||||||
|
std::atomic<bool> g_vsync_enabled;
|
||||||
|
|
||||||
/// Initialize the video core
|
/// Initialize the video core
|
||||||
bool Init(EmuWindow* emu_window) {
|
bool Init(EmuWindow* emu_window) {
|
||||||
|
|
Loading…
Reference in a new issue