forked from suyu/suyu
GPU: Add Fast GPU Time Option.
This commit is contained in:
parent
18a88d19dc
commit
b8aef40c56
7 changed files with 21 additions and 1 deletions
|
@ -446,6 +446,7 @@ struct Values {
|
||||||
bool use_asynchronous_gpu_emulation;
|
bool use_asynchronous_gpu_emulation;
|
||||||
bool use_vsync;
|
bool use_vsync;
|
||||||
bool force_30fps_mode;
|
bool force_30fps_mode;
|
||||||
|
bool use_fast_gpu_time;
|
||||||
|
|
||||||
float bg_red;
|
float bg_red;
|
||||||
float bg_green;
|
float bg_green;
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "core/core_timing_util.h"
|
#include "core/core_timing_util.h"
|
||||||
#include "core/frontend/emu_window.h"
|
#include "core/frontend/emu_window.h"
|
||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
|
#include "core/settings.h"
|
||||||
#include "video_core/engines/fermi_2d.h"
|
#include "video_core/engines/fermi_2d.h"
|
||||||
#include "video_core/engines/kepler_compute.h"
|
#include "video_core/engines/kepler_compute.h"
|
||||||
#include "video_core/engines/kepler_memory.h"
|
#include "video_core/engines/kepler_memory.h"
|
||||||
|
@ -154,7 +155,10 @@ u64 GPU::GetTicks() const {
|
||||||
constexpr u64 gpu_ticks_den = 625;
|
constexpr u64 gpu_ticks_den = 625;
|
||||||
|
|
||||||
const u64 cpu_ticks = system.CoreTiming().GetTicks();
|
const u64 cpu_ticks = system.CoreTiming().GetTicks();
|
||||||
const u64 nanoseconds = Core::Timing::CyclesToNs(cpu_ticks).count();
|
u64 nanoseconds = Core::Timing::CyclesToNs(cpu_ticks).count();
|
||||||
|
if (Settings::values.use_fast_gpu_time) {
|
||||||
|
nanoseconds /= 256;
|
||||||
|
}
|
||||||
const u64 nanoseconds_num = nanoseconds / gpu_ticks_den;
|
const u64 nanoseconds_num = nanoseconds / gpu_ticks_den;
|
||||||
const u64 nanoseconds_rem = nanoseconds % gpu_ticks_den;
|
const u64 nanoseconds_rem = nanoseconds % gpu_ticks_den;
|
||||||
return nanoseconds_num * gpu_ticks_num + (nanoseconds_rem * gpu_ticks_num) / gpu_ticks_den;
|
return nanoseconds_num * gpu_ticks_num + (nanoseconds_rem * gpu_ticks_num) / gpu_ticks_den;
|
||||||
|
|
|
@ -644,6 +644,7 @@ void Config::ReadRendererValues() {
|
||||||
Settings::values.use_asynchronous_gpu_emulation =
|
Settings::values.use_asynchronous_gpu_emulation =
|
||||||
ReadSetting(QStringLiteral("use_asynchronous_gpu_emulation"), false).toBool();
|
ReadSetting(QStringLiteral("use_asynchronous_gpu_emulation"), false).toBool();
|
||||||
Settings::values.use_vsync = ReadSetting(QStringLiteral("use_vsync"), true).toBool();
|
Settings::values.use_vsync = ReadSetting(QStringLiteral("use_vsync"), true).toBool();
|
||||||
|
Settings::values.use_fast_gpu_time = ReadSetting(QStringLiteral("use_fast_gpu_time"), true).toBool();
|
||||||
Settings::values.force_30fps_mode =
|
Settings::values.force_30fps_mode =
|
||||||
ReadSetting(QStringLiteral("force_30fps_mode"), false).toBool();
|
ReadSetting(QStringLiteral("force_30fps_mode"), false).toBool();
|
||||||
|
|
||||||
|
@ -1085,6 +1086,7 @@ void Config::SaveRendererValues() {
|
||||||
WriteSetting(QStringLiteral("use_asynchronous_gpu_emulation"),
|
WriteSetting(QStringLiteral("use_asynchronous_gpu_emulation"),
|
||||||
Settings::values.use_asynchronous_gpu_emulation, false);
|
Settings::values.use_asynchronous_gpu_emulation, false);
|
||||||
WriteSetting(QStringLiteral("use_vsync"), Settings::values.use_vsync, true);
|
WriteSetting(QStringLiteral("use_vsync"), Settings::values.use_vsync, true);
|
||||||
|
WriteSetting(QStringLiteral("use_fast_gpu_time"), Settings::values.use_fast_gpu_time, true);
|
||||||
WriteSetting(QStringLiteral("force_30fps_mode"), Settings::values.force_30fps_mode, false);
|
WriteSetting(QStringLiteral("force_30fps_mode"), Settings::values.force_30fps_mode, false);
|
||||||
|
|
||||||
// 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
|
||||||
|
|
|
@ -22,6 +22,7 @@ void ConfigureGraphicsAdvanced::SetConfiguration() {
|
||||||
ui->gpu_accuracy->setCurrentIndex(static_cast<int>(Settings::values.gpu_accuracy));
|
ui->gpu_accuracy->setCurrentIndex(static_cast<int>(Settings::values.gpu_accuracy));
|
||||||
ui->use_vsync->setEnabled(runtime_lock);
|
ui->use_vsync->setEnabled(runtime_lock);
|
||||||
ui->use_vsync->setChecked(Settings::values.use_vsync);
|
ui->use_vsync->setChecked(Settings::values.use_vsync);
|
||||||
|
ui->use_fast_gpu_time->setChecked(Settings::values.use_fast_gpu_time);
|
||||||
ui->force_30fps_mode->setEnabled(runtime_lock);
|
ui->force_30fps_mode->setEnabled(runtime_lock);
|
||||||
ui->force_30fps_mode->setChecked(Settings::values.force_30fps_mode);
|
ui->force_30fps_mode->setChecked(Settings::values.force_30fps_mode);
|
||||||
ui->anisotropic_filtering_combobox->setEnabled(runtime_lock);
|
ui->anisotropic_filtering_combobox->setEnabled(runtime_lock);
|
||||||
|
@ -32,6 +33,7 @@ void ConfigureGraphicsAdvanced::ApplyConfiguration() {
|
||||||
auto gpu_accuracy = static_cast<Settings::GPUAccuracy>(ui->gpu_accuracy->currentIndex());
|
auto gpu_accuracy = static_cast<Settings::GPUAccuracy>(ui->gpu_accuracy->currentIndex());
|
||||||
Settings::values.gpu_accuracy = gpu_accuracy;
|
Settings::values.gpu_accuracy = gpu_accuracy;
|
||||||
Settings::values.use_vsync = ui->use_vsync->isChecked();
|
Settings::values.use_vsync = ui->use_vsync->isChecked();
|
||||||
|
Settings::values.use_fast_gpu_time = ui->use_fast_gpu_time->isChecked();
|
||||||
Settings::values.force_30fps_mode = ui->force_30fps_mode->isChecked();
|
Settings::values.force_30fps_mode = ui->force_30fps_mode->isChecked();
|
||||||
Settings::values.max_anisotropy = ui->anisotropic_filtering_combobox->currentIndex();
|
Settings::values.max_anisotropy = ui->anisotropic_filtering_combobox->currentIndex();
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="use_fast_gpu_time">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use Fast GPU Time</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_1">
|
<layout class="QHBoxLayout" name="horizontalLayout_1">
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -394,6 +394,8 @@ void Config::ReadValues() {
|
||||||
sdl2_config->GetBoolean("Renderer", "use_asynchronous_gpu_emulation", false);
|
sdl2_config->GetBoolean("Renderer", "use_asynchronous_gpu_emulation", false);
|
||||||
Settings::values.use_vsync =
|
Settings::values.use_vsync =
|
||||||
static_cast<u16>(sdl2_config->GetInteger("Renderer", "use_vsync", 1));
|
static_cast<u16>(sdl2_config->GetInteger("Renderer", "use_vsync", 1));
|
||||||
|
Settings::values.use_fast_gpu_time =
|
||||||
|
sdl2_config->GetBoolean("Renderer", "use_fast_gpu_time", true);
|
||||||
|
|
||||||
Settings::values.bg_red = static_cast<float>(sdl2_config->GetReal("Renderer", "bg_red", 0.0));
|
Settings::values.bg_red = static_cast<float>(sdl2_config->GetReal("Renderer", "bg_red", 0.0));
|
||||||
Settings::values.bg_green =
|
Settings::values.bg_green =
|
||||||
|
|
|
@ -130,6 +130,8 @@ void Config::ReadValues() {
|
||||||
Settings::values.gpu_accuracy = static_cast<Settings::GPUAccuracy>(gpu_accuracy_level);
|
Settings::values.gpu_accuracy = static_cast<Settings::GPUAccuracy>(gpu_accuracy_level);
|
||||||
Settings::values.use_asynchronous_gpu_emulation =
|
Settings::values.use_asynchronous_gpu_emulation =
|
||||||
sdl2_config->GetBoolean("Renderer", "use_asynchronous_gpu_emulation", false);
|
sdl2_config->GetBoolean("Renderer", "use_asynchronous_gpu_emulation", false);
|
||||||
|
Settings::values.use_fast_gpu_time =
|
||||||
|
sdl2_config->GetBoolean("Renderer", "use_fast_gpu_time", true);
|
||||||
|
|
||||||
Settings::values.bg_red = static_cast<float>(sdl2_config->GetReal("Renderer", "bg_red", 0.0));
|
Settings::values.bg_red = static_cast<float>(sdl2_config->GetReal("Renderer", "bg_red", 0.0));
|
||||||
Settings::values.bg_green =
|
Settings::values.bg_green =
|
||||||
|
|
Loading…
Reference in a new issue