diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-01-14 06:14:27 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-02-07 02:20:57 +0100 |
commit | e78da8dc1f8b6fbb6e9c1aeff9e54fe7f879d3b1 (patch) | |
tree | 6f58b2cc9761c54cfcaf2d80918faf7525b8a2ca | |
parent | gl_shader_disk_cache: Invalidate shader cache changes with CMake hash (diff) | |
download | yuzu-e78da8dc1f8b6fbb6e9c1aeff9e54fe7f879d3b1.tar yuzu-e78da8dc1f8b6fbb6e9c1aeff9e54fe7f879d3b1.tar.gz yuzu-e78da8dc1f8b6fbb6e9c1aeff9e54fe7f879d3b1.tar.bz2 yuzu-e78da8dc1f8b6fbb6e9c1aeff9e54fe7f879d3b1.tar.lz yuzu-e78da8dc1f8b6fbb6e9c1aeff9e54fe7f879d3b1.tar.xz yuzu-e78da8dc1f8b6fbb6e9c1aeff9e54fe7f879d3b1.tar.zst yuzu-e78da8dc1f8b6fbb6e9c1aeff9e54fe7f879d3b1.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/settings.h | 1 | ||||
-rw-r--r-- | src/core/telemetry_session.cpp | 2 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_disk_cache.cpp | 21 | ||||
-rw-r--r-- | src/yuzu/configuration/config.cpp | 3 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_graphics.cpp | 2 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_graphics.ui | 7 | ||||
-rw-r--r-- | src/yuzu_cmd/config.cpp | 2 | ||||
-rw-r--r-- | src/yuzu_cmd/default_ini.h | 4 |
8 files changed, 42 insertions, 0 deletions
diff --git a/src/core/settings.h b/src/core/settings.h index c97387fc7..7e76e0466 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -391,6 +391,7 @@ struct Values { float resolution_factor; bool use_frame_limit; u16 frame_limit; + bool use_disk_shader_cache; bool use_accurate_gpu_emulation; float bg_red; diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index 09ed74d78..58dfcc4df 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp @@ -158,6 +158,8 @@ TelemetrySession::TelemetrySession() { AddField(Telemetry::FieldType::UserConfig, "Renderer_UseFrameLimit", Settings::values.use_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", Settings::values.use_accurate_gpu_emulation); AddField(Telemetry::FieldType::UserConfig, "System_UseDockedMode", diff --git a/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp index 4b0e50b90..6a23b8fe2 100644 --- a/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp @@ -17,6 +17,7 @@ #include "core/core.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_disk_cache.h" @@ -78,6 +79,10 @@ void ShaderDiskCacheRaw::Save(FileUtil::IOFile& file) const { bool ShaderDiskCacheOpenGL::LoadTransferable(std::vector<ShaderDiskCacheRaw>& raws, std::vector<ShaderDiskCacheUsage>& usages) { + if (!Settings::values.use_disk_shader_cache) { + return false; + } + FileUtil::IOFile file(GetTransferablePath(), "rb"); if (!file.IsOpen()) { 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() { + if (!Settings::values.use_disk_shader_cache) { + return {}; + } + FileUtil::IOFile file(GetPrecompiledPath(), "rb"); if (!file.IsOpen()) { 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) { + if (!Settings::values.use_disk_shader_cache) { + return; + } + const u64 id = entry.GetUniqueIdentifier(); if (transferable.find(id) != transferable.end()) { // The shader already exists @@ -190,6 +203,10 @@ void ShaderDiskCacheOpenGL::SaveRaw(const ShaderDiskCacheRaw& entry) { } void ShaderDiskCacheOpenGL::SaveUsage(const ShaderDiskCacheUsage& usage) { + if (!Settings::values.use_disk_shader_cache) { + return; + } + const auto it = transferable.find(usage.unique_identifier); if (it == transferable.end()) { 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) { + if (!Settings::values.use_disk_shader_cache) { + return; + } + FileUtil::IOFile file = AppendPrecompiledFile(); if (!file.IsOpen()) { return; diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index ddf4cf552..e9546dadf 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -370,6 +370,8 @@ void Config::ReadValues() { 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.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 = 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("use_frame_limit", Settings::values.use_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); // Cast to double because Qt's written float values are not human-readable diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index d21f95469..0f5dd534b 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -73,6 +73,7 @@ void ConfigureGraphics::setConfiguration() { static_cast<int>(FromResolutionFactor(Settings::values.resolution_factor))); ui->toggle_frame_limit->setChecked(Settings::values.use_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); UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red, Settings::values.bg_green, Settings::values.bg_blue)); @@ -83,6 +84,7 @@ void ConfigureGraphics::applyConfiguration() { ToResolutionFactor(static_cast<Resolution>(ui->resolution_factor_combobox->currentIndex())); Settings::values.use_frame_limit = ui->toggle_frame_limit->isChecked(); 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.bg_red = static_cast<float>(bg_color.redF()); Settings::values.bg_green = static_cast<float>(bg_color.greenF()); diff --git a/src/yuzu/configuration/configure_graphics.ui b/src/yuzu/configuration/configure_graphics.ui index e278cdd05..824f5810a 100644 --- a/src/yuzu/configuration/configure_graphics.ui +++ b/src/yuzu/configuration/configure_graphics.ui @@ -50,6 +50,13 @@ </layout> </item> <item> + <widget class="QCheckBox" name="use_disk_shader_cache"> + <property name="text"> + <string>Use disk shader cache</string> + </property> + </widget> + </item> + <item> <widget class="QCheckBox" name="use_accurate_gpu_emulation"> <property name="text"> <string>Use accurate GPU emulation (slow)</string> diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index 7a77f76e8..ff05b3179 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp @@ -350,6 +350,8 @@ void Config::ReadValues() { Settings::values.use_frame_limit = sdl2_config->GetBoolean("Renderer", "use_frame_limit", true); Settings::values.frame_limit = 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 = sdl2_config->GetBoolean("Renderer", "use_accurate_gpu_emulation", false); diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h index ba51a4a51..a81986f8e 100644 --- a/src/yuzu_cmd/default_ini.h +++ b/src/yuzu_cmd/default_ini.h @@ -110,6 +110,10 @@ use_frame_limit = # 1 - 9999: Speed limit as a percentage of target game speed. 100 (default) frame_limit = +# Whether to use disk based shader cache +# 0 (default): Off, 1 : On +use_disk_shader_cache = + # Whether to use accurate GPU emulation # 0 (default): Off (fast), 1 : On (slow) use_accurate_gpu_emulation = |