From 5cffa342884df531d911555f7b3db9d2f6d1d1f0 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Wed, 3 May 2023 20:42:33 -0400 Subject: settings,video_core: Consolidate ASTC decoding options Just puts them all neatly into one place. --- src/common/settings.cpp | 2 - src/common/settings.h | 11 ++++- src/core/telemetry_session.cpp | 15 ++++++- .../renderer_opengl/gl_texture_cache.cpp | 8 ++-- .../renderer_vulkan/vk_texture_cache.cpp | 19 +++++--- src/yuzu/configuration/config.cpp | 12 +++-- src/yuzu/configuration/config.h | 1 + src/yuzu/configuration/configure_graphics.cpp | 19 +++++--- src/yuzu/configuration/configure_graphics.ui | 51 +++++++++++++++++++--- .../configuration/configure_graphics_advanced.cpp | 7 --- .../configuration/configure_graphics_advanced.ui | 10 ----- src/yuzu_cmd/config.cpp | 2 - 12 files changed, 105 insertions(+), 52 deletions(-) diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 5972480e5..3f56afe94 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -82,7 +82,6 @@ void LogSettings() { values.use_asynchronous_gpu_emulation.GetValue()); log_setting("Renderer_NvdecEmulation", values.nvdec_emulation.GetValue()); log_setting("Renderer_AccelerateASTC", values.accelerate_astc.GetValue()); - log_setting("Renderer_AsyncASTC", values.async_astc.GetValue()); log_setting("Renderer_AstcRecompression", values.astc_recompression.GetValue()); log_setting("Renderer_UseVsync", values.vsync_mode.GetValue()); log_setting("Renderer_UseReactiveFlushing", values.use_reactive_flushing.GetValue()); @@ -246,7 +245,6 @@ void RestoreGlobalState(bool is_powered_on) { values.use_asynchronous_gpu_emulation.SetGlobal(true); values.nvdec_emulation.SetGlobal(true); values.accelerate_astc.SetGlobal(true); - values.async_astc.SetGlobal(true); values.astc_recompression.SetGlobal(true); values.use_reactive_flushing.SetGlobal(true); values.shader_backend.SetGlobal(true); diff --git a/src/common/settings.h b/src/common/settings.h index 59e96e74f..b8ab34f7f 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -16,6 +16,12 @@ namespace Settings { +enum class AstcDecodeMode : u32 { + CPU = 0, + GPU = 1, + CPUAsynchronous = 2, +}; + enum class VSyncMode : u32 { Immediate = 0, Mailbox = 1, @@ -467,8 +473,9 @@ struct Values { GPUAccuracy::Extreme, "gpu_accuracy"}; SwitchableSetting use_asynchronous_gpu_emulation{true, "use_asynchronous_gpu_emulation"}; SwitchableSetting nvdec_emulation{NvdecEmulation::GPU, "nvdec_emulation"}; - SwitchableSetting accelerate_astc{true, "accelerate_astc"}; - SwitchableSetting async_astc{false, "async_astc"}; + SwitchableSetting accelerate_astc{ + AstcDecodeMode::CPU, AstcDecodeMode::CPU, AstcDecodeMode::CPUAsynchronous, + "accelerate_astc"}; Setting vsync_mode{VSyncMode::FIFO, VSyncMode::Immediate, VSyncMode::FIFORelaxed, "use_vsync"}; SwitchableSetting use_reactive_flushing{true, "use_reactive_flushing"}; diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index 7a2f3c90a..665ffe3a2 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp @@ -99,6 +99,18 @@ static constexpr const char* TranslateVSyncMode(Settings::VSyncMode mode) { return "Unknown"; } +static constexpr const char* TranslateASTCDecodeMode(Settings::AstcDecodeMode mode) { + switch (mode) { + case Settings::AstcDecodeMode::CPU: + return "CPU"; + case Settings::AstcDecodeMode::GPU: + return "GPU"; + case Settings::AstcDecodeMode::CPUAsynchronous: + return "CPU Asynchronous"; + } + return "Unknown"; +} + u64 GetTelemetryId() { u64 telemetry_id{}; const auto filename = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ConfigDir) / "telemetry_id"; @@ -254,7 +266,8 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader, Settings::values.use_asynchronous_gpu_emulation.GetValue()); AddField(field_type, "Renderer_NvdecEmulation", TranslateNvdecEmulation(Settings::values.nvdec_emulation.GetValue())); - AddField(field_type, "Renderer_AccelerateASTC", Settings::values.accelerate_astc.GetValue()); + AddField(field_type, "Renderer_AccelerateASTC", + TranslateASTCDecodeMode(Settings::values.accelerate_astc.GetValue())); AddField(field_type, "Renderer_UseVsync", TranslateVSyncMode(Settings::values.vsync_mode.GetValue())); AddField(field_type, "Renderer_ShaderBackend", diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index 3b446be07..38ae12d8e 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp @@ -232,10 +232,9 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::arrayViewFormats(info.format))), aspect_mask(ImageAspectMask(info.format)) { if (IsPixelFormatASTC(info.format) && !runtime->device.IsOptimalAstcSupported()) { - if (Settings::values.async_astc.GetValue()) { + switch (Settings::values.accelerate_astc.GetValue()) { + case Settings::AstcDecodeMode::GPU: + if (Settings::values.astc_recompression.GetValue() == + Settings::AstcRecompression::Uncompressed && + info.size.depth == 1) { + flags |= VideoCommon::ImageFlagBits::AcceleratedUpload; + } + break; + case Settings::AstcDecodeMode::CPUAsynchronous: flags |= VideoCommon::ImageFlagBits::AsynchronousDecode; - } else if (Settings::values.astc_recompression.GetValue() == - Settings::AstcRecompression::Uncompressed && - Settings::values.accelerate_astc.GetValue() && info.size.depth == 1) { - flags |= VideoCommon::ImageFlagBits::AcceleratedUpload; + break; + default: + break; } flags |= VideoCommon::ImageFlagBits::Converted; flags |= VideoCommon::ImageFlagBits::CostlyLoad; diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 195d3556c..786c1222f 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -764,10 +764,8 @@ void Config::ReadRendererValues() { ReadGlobalSetting(Settings::values.use_asynchronous_gpu_emulation); ReadGlobalSetting(Settings::values.nvdec_emulation); ReadGlobalSetting(Settings::values.accelerate_astc); - ReadGlobalSetting(Settings::values.async_astc); ReadGlobalSetting(Settings::values.astc_recompression); ReadGlobalSetting(Settings::values.use_reactive_flushing); - ReadGlobalSetting(Settings::values.shader_backend); ReadGlobalSetting(Settings::values.use_asynchronous_shaders); ReadGlobalSetting(Settings::values.use_fast_gpu_time); ReadGlobalSetting(Settings::values.use_vulkan_driver_pipeline_cache); @@ -1428,13 +1426,19 @@ void Config::SaveRendererValues() { static_cast(Settings::values.nvdec_emulation.GetValue(global)), static_cast(Settings::values.nvdec_emulation.GetDefault()), Settings::values.nvdec_emulation.UsingGlobal()); - WriteGlobalSetting(Settings::values.accelerate_astc); - WriteGlobalSetting(Settings::values.async_astc); + WriteSetting(QString::fromStdString(Settings::values.accelerate_astc.GetLabel()), + static_cast(Settings::values.accelerate_astc.GetValue(global)), + static_cast(Settings::values.accelerate_astc.GetDefault()), + Settings::values.accelerate_astc.UsingGlobal()); WriteSetting(QString::fromStdString(Settings::values.astc_recompression.GetLabel()), static_cast(Settings::values.astc_recompression.GetValue(global)), static_cast(Settings::values.astc_recompression.GetDefault()), Settings::values.astc_recompression.UsingGlobal()); WriteGlobalSetting(Settings::values.use_reactive_flushing); + WriteSetting(QString::fromStdString(Settings::values.accelerate_astc.GetLabel()), + static_cast(Settings::values.accelerate_astc.GetValue(global)), + static_cast(Settings::values.accelerate_astc.GetDefault()), + Settings::values.shader_backend.UsingGlobal()); WriteSetting(QString::fromStdString(Settings::values.shader_backend.GetLabel()), static_cast(Settings::values.shader_backend.GetValue(global)), static_cast(Settings::values.shader_backend.GetDefault()), diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h index 1211389d2..e066f7552 100644 --- a/src/yuzu/configuration/config.h +++ b/src/yuzu/configuration/config.h @@ -218,3 +218,4 @@ Q_DECLARE_METATYPE(Settings::AntiAliasing); Q_DECLARE_METATYPE(Settings::RendererBackend); Q_DECLARE_METATYPE(Settings::ShaderBackend); Q_DECLARE_METATYPE(Settings::AstcRecompression); +Q_DECLARE_METATYPE(Settings::AstcDecodeMode); diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index a4965524a..e70781357 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -194,14 +194,13 @@ void ConfigureGraphics::SetConfiguration() { ui->use_disk_shader_cache->setEnabled(runtime_lock); ui->nvdec_emulation_widget->setEnabled(runtime_lock); ui->resolution_combobox->setEnabled(runtime_lock); - ui->accelerate_astc->setEnabled(runtime_lock); + ui->astc_decode_mode_combobox->setEnabled(runtime_lock); ui->vsync_mode_layout->setEnabled(runtime_lock || Settings::values.renderer_backend.GetValue() == Settings::RendererBackend::Vulkan); ui->use_disk_shader_cache->setChecked(Settings::values.use_disk_shader_cache.GetValue()); ui->use_asynchronous_gpu_emulation->setChecked( Settings::values.use_asynchronous_gpu_emulation.GetValue()); - ui->accelerate_astc->setChecked(Settings::values.accelerate_astc.GetValue()); if (Settings::IsConfiguringGlobal()) { ui->api->setCurrentIndex(static_cast(Settings::values.renderer_backend.GetValue())); @@ -222,6 +221,11 @@ void ConfigureGraphics::SetConfiguration() { ConfigurationShared::SetHighlight(ui->api_widget, !Settings::values.renderer_backend.UsingGlobal()); + ConfigurationShared::SetPerGameSetting(ui->astc_decode_mode_combobox, + &Settings::values.accelerate_astc); + ConfigurationShared::SetHighlight(ui->astc_decode_mode_layout, + !Settings::values.accelerate_astc.UsingGlobal()); + ConfigurationShared::SetPerGameSetting(ui->nvdec_emulation, &Settings::values.nvdec_emulation); ConfigurationShared::SetHighlight(ui->nvdec_emulation_widget, @@ -337,8 +341,8 @@ void ConfigureGraphics::ApplyConfiguration() { ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_gpu_emulation, ui->use_asynchronous_gpu_emulation, use_asynchronous_gpu_emulation); - ConfigurationShared::ApplyPerGameSetting(&Settings::values.accelerate_astc, ui->accelerate_astc, - accelerate_astc); + ConfigurationShared::ApplyPerGameSetting(&Settings::values.accelerate_astc, + ui->astc_decode_mode_combobox); if (Settings::IsConfiguringGlobal()) { // Guard if during game and set to game-specific value @@ -555,7 +559,7 @@ void ConfigureGraphics::SetupPerGameUI() { ui->use_asynchronous_gpu_emulation->setEnabled( Settings::values.use_asynchronous_gpu_emulation.UsingGlobal()); ui->nvdec_emulation->setEnabled(Settings::values.nvdec_emulation.UsingGlobal()); - ui->accelerate_astc->setEnabled(Settings::values.accelerate_astc.UsingGlobal()); + ui->astc_decode_mode_combobox->setEnabled(Settings::values.accelerate_astc.UsingGlobal()); ui->use_disk_shader_cache->setEnabled(Settings::values.use_disk_shader_cache.UsingGlobal()); ui->bg_button->setEnabled(Settings::values.bg_red.UsingGlobal()); ui->fsr_slider_layout->setEnabled(Settings::values.fsr_sharpening_slider.UsingGlobal()); @@ -577,8 +581,6 @@ void ConfigureGraphics::SetupPerGameUI() { ConfigurationShared::SetColoredTristate( ui->use_disk_shader_cache, Settings::values.use_disk_shader_cache, use_disk_shader_cache); - ConfigurationShared::SetColoredTristate(ui->accelerate_astc, Settings::values.accelerate_astc, - accelerate_astc); ConfigurationShared::SetColoredTristate(ui->use_asynchronous_gpu_emulation, Settings::values.use_asynchronous_gpu_emulation, use_asynchronous_gpu_emulation); @@ -597,6 +599,9 @@ void ConfigureGraphics::SetupPerGameUI() { ConfigurationShared::SetColoredComboBox( ui->anti_aliasing_combobox, ui->anti_aliasing_label, static_cast(Settings::values.anti_aliasing.GetValue(true))); + ConfigurationShared::SetColoredComboBox( + ui->astc_decode_mode_combobox, ui->astc_decode_mode_label, + static_cast(Settings::values.accelerate_astc.GetValue(true))); ConfigurationShared::InsertGlobalItem( ui->api, static_cast(Settings::values.renderer_backend.GetValue(true))); ConfigurationShared::InsertGlobalItem( diff --git a/src/yuzu/configuration/configure_graphics.ui b/src/yuzu/configuration/configure_graphics.ui index 39f70e406..91b09625b 100644 --- a/src/yuzu/configuration/configure_graphics.ui +++ b/src/yuzu/configuration/configure_graphics.ui @@ -181,13 +181,6 @@ - - - - Accelerate ASTC texture decoding - - - @@ -226,6 +219,50 @@ Immediate (no synchronization) just presents whatever is available and can exhib + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + ASTC Texture Decoding Method: + + + + + + + + CPU + + + + + GPU Compute + + + + + CPU Asynchronous (Hack) + + + + + + + diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp index c0a044767..e5c99f742 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.cpp +++ b/src/yuzu/configuration/configure_graphics_advanced.cpp @@ -26,7 +26,6 @@ void ConfigureGraphicsAdvanced::SetConfiguration() { ui->use_reactive_flushing->setEnabled(runtime_lock); ui->async_present->setEnabled(runtime_lock); ui->renderer_force_max_clock->setEnabled(runtime_lock); - ui->async_astc->setEnabled(runtime_lock); ui->astc_recompression_combobox->setEnabled(runtime_lock); ui->use_asynchronous_shaders->setEnabled(runtime_lock); ui->anisotropic_filtering_combobox->setEnabled(runtime_lock); @@ -35,7 +34,6 @@ void ConfigureGraphicsAdvanced::SetConfiguration() { ui->async_present->setChecked(Settings::values.async_presentation.GetValue()); ui->renderer_force_max_clock->setChecked(Settings::values.renderer_force_max_clock.GetValue()); ui->use_reactive_flushing->setChecked(Settings::values.use_reactive_flushing.GetValue()); - ui->async_astc->setChecked(Settings::values.async_astc.GetValue()); ui->use_asynchronous_shaders->setChecked(Settings::values.use_asynchronous_shaders.GetValue()); ui->use_fast_gpu_time->setChecked(Settings::values.use_fast_gpu_time.GetValue()); ui->use_vulkan_driver_pipeline_cache->setChecked( @@ -79,8 +77,6 @@ void ConfigureGraphicsAdvanced::ApplyConfiguration() { ui->anisotropic_filtering_combobox); ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_reactive_flushing, ui->use_reactive_flushing, use_reactive_flushing); - ConfigurationShared::ApplyPerGameSetting(&Settings::values.async_astc, ui->async_astc, - async_astc); ConfigurationShared::ApplyPerGameSetting(&Settings::values.astc_recompression, ui->astc_recompression_combobox); ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders, @@ -121,7 +117,6 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() { ui->renderer_force_max_clock->setEnabled( Settings::values.renderer_force_max_clock.UsingGlobal()); ui->use_reactive_flushing->setEnabled(Settings::values.use_reactive_flushing.UsingGlobal()); - ui->async_astc->setEnabled(Settings::values.async_astc.UsingGlobal()); ui->astc_recompression_combobox->setEnabled( Settings::values.astc_recompression.UsingGlobal()); ui->use_asynchronous_shaders->setEnabled( @@ -148,8 +143,6 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() { renderer_force_max_clock); ConfigurationShared::SetColoredTristate( ui->use_reactive_flushing, Settings::values.use_reactive_flushing, use_reactive_flushing); - ConfigurationShared::SetColoredTristate(ui->async_astc, Settings::values.async_astc, - async_astc); ConfigurationShared::SetColoredTristate(ui->use_asynchronous_shaders, Settings::values.use_asynchronous_shaders, use_asynchronous_shaders); diff --git a/src/yuzu/configuration/configure_graphics_advanced.ui b/src/yuzu/configuration/configure_graphics_advanced.ui index d527a6f38..859ab9366 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.ui +++ b/src/yuzu/configuration/configure_graphics_advanced.ui @@ -130,16 +130,6 @@ - - - - Enables asynchronous ASTC texture decoding, which may reduce load time stutter. This feature is experimental. - - - Decode ASTC textures asynchronously (Hack) - - - diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index c5bc472ca..b2049ae57 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp @@ -317,9 +317,7 @@ void Config::ReadValues() { ReadSetting("Renderer", Settings::values.use_asynchronous_shaders); ReadSetting("Renderer", Settings::values.nvdec_emulation); ReadSetting("Renderer", Settings::values.accelerate_astc); - ReadSetting("Renderer", Settings::values.async_astc); ReadSetting("Renderer", Settings::values.astc_recompression); - ReadSetting("Renderer", Settings::values.use_fast_gpu_time); ReadSetting("Renderer", Settings::values.use_vulkan_driver_pipeline_cache); ReadSetting("Renderer", Settings::values.bg_red); -- cgit v1.2.3