mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-11-14 12:53:03 +00:00
settings: Hide shader cache behind a setting
This commit is contained in:
parent
be4641c43f
commit
e78da8dc1f
|
@ -391,6 +391,7 @@ struct Values {
|
||||||
float resolution_factor;
|
float resolution_factor;
|
||||||
bool use_frame_limit;
|
bool use_frame_limit;
|
||||||
u16 frame_limit;
|
u16 frame_limit;
|
||||||
|
bool use_disk_shader_cache;
|
||||||
bool use_accurate_gpu_emulation;
|
bool use_accurate_gpu_emulation;
|
||||||
|
|
||||||
float bg_red;
|
float bg_red;
|
||||||
|
|
|
@ -158,6 +158,8 @@ TelemetrySession::TelemetrySession() {
|
||||||
AddField(Telemetry::FieldType::UserConfig, "Renderer_UseFrameLimit",
|
AddField(Telemetry::FieldType::UserConfig, "Renderer_UseFrameLimit",
|
||||||
Settings::values.use_frame_limit);
|
Settings::values.use_frame_limit);
|
||||||
AddField(Telemetry::FieldType::UserConfig, "Renderer_FrameLimit", Settings::values.frame_limit);
|
AddField(Telemetry::FieldType::UserConfig, "Renderer_FrameLimit", Settings::values.frame_limit);
|
||||||
|
AddField(Telemetry::FieldType::UserConfig, "Renderer_UseDiskShaderCache",
|
||||||
|
Settings::values.use_disk_shader_cache);
|
||||||
AddField(Telemetry::FieldType::UserConfig, "Renderer_UseAccurateGpuEmulation",
|
AddField(Telemetry::FieldType::UserConfig, "Renderer_UseAccurateGpuEmulation",
|
||||||
Settings::values.use_accurate_gpu_emulation);
|
Settings::values.use_accurate_gpu_emulation);
|
||||||
AddField(Telemetry::FieldType::UserConfig, "System_UseDockedMode",
|
AddField(Telemetry::FieldType::UserConfig, "System_UseDockedMode",
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/hle/kernel/process.h"
|
#include "core/hle/kernel/process.h"
|
||||||
|
#include "core/settings.h"
|
||||||
|
|
||||||
#include "video_core/renderer_opengl/gl_shader_cache.h"
|
#include "video_core/renderer_opengl/gl_shader_cache.h"
|
||||||
#include "video_core/renderer_opengl/gl_shader_disk_cache.h"
|
#include "video_core/renderer_opengl/gl_shader_disk_cache.h"
|
||||||
|
@ -78,6 +79,10 @@ void ShaderDiskCacheRaw::Save(FileUtil::IOFile& file) const {
|
||||||
|
|
||||||
bool ShaderDiskCacheOpenGL::LoadTransferable(std::vector<ShaderDiskCacheRaw>& raws,
|
bool ShaderDiskCacheOpenGL::LoadTransferable(std::vector<ShaderDiskCacheRaw>& raws,
|
||||||
std::vector<ShaderDiskCacheUsage>& usages) {
|
std::vector<ShaderDiskCacheUsage>& usages) {
|
||||||
|
if (!Settings::values.use_disk_shader_cache) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
FileUtil::IOFile file(GetTransferablePath(), "rb");
|
FileUtil::IOFile file(GetTransferablePath(), "rb");
|
||||||
if (!file.IsOpen()) {
|
if (!file.IsOpen()) {
|
||||||
LOG_INFO(Render_OpenGL, "No transferable shader cache found for game with title id={}",
|
LOG_INFO(Render_OpenGL, "No transferable shader cache found for game with title id={}",
|
||||||
|
@ -129,6 +134,10 @@ bool ShaderDiskCacheOpenGL::LoadTransferable(std::vector<ShaderDiskCacheRaw>& ra
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ShaderDiskCachePrecompiledEntry> ShaderDiskCacheOpenGL::LoadPrecompiled() {
|
std::vector<ShaderDiskCachePrecompiledEntry> ShaderDiskCacheOpenGL::LoadPrecompiled() {
|
||||||
|
if (!Settings::values.use_disk_shader_cache) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
FileUtil::IOFile file(GetPrecompiledPath(), "rb");
|
FileUtil::IOFile file(GetPrecompiledPath(), "rb");
|
||||||
if (!file.IsOpen()) {
|
if (!file.IsOpen()) {
|
||||||
LOG_INFO(Render_OpenGL, "No precompiled shader cache found for game with title id={}",
|
LOG_INFO(Render_OpenGL, "No precompiled shader cache found for game with title id={}",
|
||||||
|
@ -173,6 +182,10 @@ void ShaderDiskCacheOpenGL::InvalidatePrecompiled() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShaderDiskCacheOpenGL::SaveRaw(const ShaderDiskCacheRaw& entry) {
|
void ShaderDiskCacheOpenGL::SaveRaw(const ShaderDiskCacheRaw& entry) {
|
||||||
|
if (!Settings::values.use_disk_shader_cache) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const u64 id = entry.GetUniqueIdentifier();
|
const u64 id = entry.GetUniqueIdentifier();
|
||||||
if (transferable.find(id) != transferable.end()) {
|
if (transferable.find(id) != transferable.end()) {
|
||||||
// The shader already exists
|
// The shader already exists
|
||||||
|
@ -190,6 +203,10 @@ void ShaderDiskCacheOpenGL::SaveRaw(const ShaderDiskCacheRaw& entry) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShaderDiskCacheOpenGL::SaveUsage(const ShaderDiskCacheUsage& usage) {
|
void ShaderDiskCacheOpenGL::SaveUsage(const ShaderDiskCacheUsage& usage) {
|
||||||
|
if (!Settings::values.use_disk_shader_cache) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const auto it = transferable.find(usage.unique_identifier);
|
const auto it = transferable.find(usage.unique_identifier);
|
||||||
if (it == transferable.end()) {
|
if (it == transferable.end()) {
|
||||||
LOG_CRITICAL(Render_OpenGL, "Saving shader usage without storing raw previously");
|
LOG_CRITICAL(Render_OpenGL, "Saving shader usage without storing raw previously");
|
||||||
|
@ -208,6 +225,10 @@ void ShaderDiskCacheOpenGL::SaveUsage(const ShaderDiskCacheUsage& usage) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShaderDiskCacheOpenGL::SavePrecompiled(const ShaderDiskCacheUsage& usage, GLuint program) {
|
void ShaderDiskCacheOpenGL::SavePrecompiled(const ShaderDiskCacheUsage& usage, GLuint program) {
|
||||||
|
if (!Settings::values.use_disk_shader_cache) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FileUtil::IOFile file = AppendPrecompiledFile();
|
FileUtil::IOFile file = AppendPrecompiledFile();
|
||||||
if (!file.IsOpen()) {
|
if (!file.IsOpen()) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -370,6 +370,8 @@ void Config::ReadValues() {
|
||||||
Settings::values.resolution_factor = qt_config->value("resolution_factor", 1.0).toFloat();
|
Settings::values.resolution_factor = qt_config->value("resolution_factor", 1.0).toFloat();
|
||||||
Settings::values.use_frame_limit = qt_config->value("use_frame_limit", true).toBool();
|
Settings::values.use_frame_limit = qt_config->value("use_frame_limit", true).toBool();
|
||||||
Settings::values.frame_limit = qt_config->value("frame_limit", 100).toInt();
|
Settings::values.frame_limit = qt_config->value("frame_limit", 100).toInt();
|
||||||
|
Settings::values.use_disk_shader_cache =
|
||||||
|
qt_config->value("use_disk_shader_cache", false).toBool();
|
||||||
Settings::values.use_accurate_gpu_emulation =
|
Settings::values.use_accurate_gpu_emulation =
|
||||||
qt_config->value("use_accurate_gpu_emulation", false).toBool();
|
qt_config->value("use_accurate_gpu_emulation", false).toBool();
|
||||||
|
|
||||||
|
@ -629,6 +631,7 @@ void Config::SaveValues() {
|
||||||
qt_config->setValue("resolution_factor", (double)Settings::values.resolution_factor);
|
qt_config->setValue("resolution_factor", (double)Settings::values.resolution_factor);
|
||||||
qt_config->setValue("use_frame_limit", Settings::values.use_frame_limit);
|
qt_config->setValue("use_frame_limit", Settings::values.use_frame_limit);
|
||||||
qt_config->setValue("frame_limit", Settings::values.frame_limit);
|
qt_config->setValue("frame_limit", Settings::values.frame_limit);
|
||||||
|
qt_config->setValue("use_disk_shader_cache", Settings::values.use_disk_shader_cache);
|
||||||
qt_config->setValue("use_accurate_gpu_emulation", Settings::values.use_accurate_gpu_emulation);
|
qt_config->setValue("use_accurate_gpu_emulation", Settings::values.use_accurate_gpu_emulation);
|
||||||
|
|
||||||
// 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
|
||||||
|
|
|
@ -73,6 +73,7 @@ void ConfigureGraphics::setConfiguration() {
|
||||||
static_cast<int>(FromResolutionFactor(Settings::values.resolution_factor)));
|
static_cast<int>(FromResolutionFactor(Settings::values.resolution_factor)));
|
||||||
ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit);
|
ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit);
|
||||||
ui->frame_limit->setValue(Settings::values.frame_limit);
|
ui->frame_limit->setValue(Settings::values.frame_limit);
|
||||||
|
ui->use_disk_shader_cache->setChecked(Settings::values.use_disk_shader_cache);
|
||||||
ui->use_accurate_gpu_emulation->setChecked(Settings::values.use_accurate_gpu_emulation);
|
ui->use_accurate_gpu_emulation->setChecked(Settings::values.use_accurate_gpu_emulation);
|
||||||
UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red, Settings::values.bg_green,
|
UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red, Settings::values.bg_green,
|
||||||
Settings::values.bg_blue));
|
Settings::values.bg_blue));
|
||||||
|
@ -83,6 +84,7 @@ void ConfigureGraphics::applyConfiguration() {
|
||||||
ToResolutionFactor(static_cast<Resolution>(ui->resolution_factor_combobox->currentIndex()));
|
ToResolutionFactor(static_cast<Resolution>(ui->resolution_factor_combobox->currentIndex()));
|
||||||
Settings::values.use_frame_limit = ui->toggle_frame_limit->isChecked();
|
Settings::values.use_frame_limit = ui->toggle_frame_limit->isChecked();
|
||||||
Settings::values.frame_limit = ui->frame_limit->value();
|
Settings::values.frame_limit = ui->frame_limit->value();
|
||||||
|
Settings::values.use_disk_shader_cache = ui->use_disk_shader_cache->isChecked();
|
||||||
Settings::values.use_accurate_gpu_emulation = ui->use_accurate_gpu_emulation->isChecked();
|
Settings::values.use_accurate_gpu_emulation = ui->use_accurate_gpu_emulation->isChecked();
|
||||||
Settings::values.bg_red = static_cast<float>(bg_color.redF());
|
Settings::values.bg_red = static_cast<float>(bg_color.redF());
|
||||||
Settings::values.bg_green = static_cast<float>(bg_color.greenF());
|
Settings::values.bg_green = static_cast<float>(bg_color.greenF());
|
||||||
|
|
|
@ -49,6 +49,13 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="use_disk_shader_cache">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use disk shader cache</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="use_accurate_gpu_emulation">
|
<widget class="QCheckBox" name="use_accurate_gpu_emulation">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
|
@ -350,6 +350,8 @@ void Config::ReadValues() {
|
||||||
Settings::values.use_frame_limit = sdl2_config->GetBoolean("Renderer", "use_frame_limit", true);
|
Settings::values.use_frame_limit = sdl2_config->GetBoolean("Renderer", "use_frame_limit", true);
|
||||||
Settings::values.frame_limit =
|
Settings::values.frame_limit =
|
||||||
static_cast<u16>(sdl2_config->GetInteger("Renderer", "frame_limit", 100));
|
static_cast<u16>(sdl2_config->GetInteger("Renderer", "frame_limit", 100));
|
||||||
|
Settings::values.use_disk_shader_cache =
|
||||||
|
sdl2_config->GetBoolean("Renderer", "use_disk_shader_cache", false);
|
||||||
Settings::values.use_accurate_gpu_emulation =
|
Settings::values.use_accurate_gpu_emulation =
|
||||||
sdl2_config->GetBoolean("Renderer", "use_accurate_gpu_emulation", false);
|
sdl2_config->GetBoolean("Renderer", "use_accurate_gpu_emulation", false);
|
||||||
|
|
||||||
|
|
|
@ -110,6 +110,10 @@ use_frame_limit =
|
||||||
# 1 - 9999: Speed limit as a percentage of target game speed. 100 (default)
|
# 1 - 9999: Speed limit as a percentage of target game speed. 100 (default)
|
||||||
frame_limit =
|
frame_limit =
|
||||||
|
|
||||||
|
# Whether to use disk based shader cache
|
||||||
|
# 0 (default): Off, 1 : On
|
||||||
|
use_disk_shader_cache =
|
||||||
|
|
||||||
# Whether to use accurate GPU emulation
|
# Whether to use accurate GPU emulation
|
||||||
# 0 (default): Off (fast), 1 : On (slow)
|
# 0 (default): Off (fast), 1 : On (slow)
|
||||||
use_accurate_gpu_emulation =
|
use_accurate_gpu_emulation =
|
||||||
|
|
Loading…
Reference in a new issue