1
0
Fork 0
forked from suyu/suyu

settings,video_core: Consolidate ASTC decoding options

Just puts them all neatly into one place.
This commit is contained in:
lat9nq 2023-05-03 20:42:33 -04:00
parent c0202da9ac
commit 5cffa34288
12 changed files with 105 additions and 52 deletions

View file

@ -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);

View file

@ -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<bool> use_asynchronous_gpu_emulation{true, "use_asynchronous_gpu_emulation"};
SwitchableSetting<NvdecEmulation> nvdec_emulation{NvdecEmulation::GPU, "nvdec_emulation"};
SwitchableSetting<bool> accelerate_astc{true, "accelerate_astc"};
SwitchableSetting<bool> async_astc{false, "async_astc"};
SwitchableSetting<AstcDecodeMode, true> accelerate_astc{
AstcDecodeMode::CPU, AstcDecodeMode::CPU, AstcDecodeMode::CPUAsynchronous,
"accelerate_astc"};
Setting<VSyncMode, true> vsync_mode{VSyncMode::FIFO, VSyncMode::Immediate,
VSyncMode::FIFORelaxed, "use_vsync"};
SwitchableSetting<bool> use_reactive_flushing{true, "use_reactive_flushing"};

View file

@ -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",

View file

@ -232,10 +232,9 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4
[[nodiscard]] bool CanBeAccelerated(const TextureCacheRuntime& runtime,
const VideoCommon::ImageInfo& info) {
if (IsPixelFormatASTC(info.format) && info.size.depth == 1 && !runtime.HasNativeASTC()) {
return Settings::values.accelerate_astc.GetValue() &&
return Settings::values.accelerate_astc.GetValue() == Settings::AstcDecodeMode::GPU &&
Settings::values.astc_recompression.GetValue() ==
Settings::AstcRecompression::Uncompressed &&
!Settings::values.async_astc.GetValue();
Settings::AstcRecompression::Uncompressed;
}
// Disable other accelerated uploads for now as they don't implement swizzled uploads
return false;
@ -267,7 +266,8 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4
[[nodiscard]] bool CanBeDecodedAsync(const TextureCacheRuntime& runtime,
const VideoCommon::ImageInfo& info) {
if (IsPixelFormatASTC(info.format) && !runtime.HasNativeASTC()) {
return Settings::values.async_astc.GetValue();
return Settings::values.accelerate_astc.GetValue() ==
Settings::AstcDecodeMode::CPUAsynchronous;
}
return false;
}

View file

@ -817,7 +817,7 @@ TextureCacheRuntime::TextureCacheRuntime(const Device& device_, Scheduler& sched
: device{device_}, scheduler{scheduler_}, memory_allocator{memory_allocator_},
staging_buffer_pool{staging_buffer_pool_}, blit_image_helper{blit_image_helper_},
render_pass_cache{render_pass_cache_}, resolution{Settings::values.resolution_info} {
if (Settings::values.accelerate_astc) {
if (Settings::values.accelerate_astc.GetValue() == Settings::AstcDecodeMode::GPU) {
astc_decoder_pass.emplace(device, scheduler, descriptor_pool, staging_buffer_pool,
compute_pass_descriptor_queue, memory_allocator);
}
@ -1301,13 +1301,20 @@ Image::Image(TextureCacheRuntime& runtime_, const ImageInfo& info_, GPUVAddr gpu
runtime->ViewFormats(info.format))),
aspect_mask(ImageAspectMask(info.format)) {
if (IsPixelFormatASTC(info.format) && !runtime->device.IsOptimalAstcSupported()) {
if (Settings::values.async_astc.GetValue()) {
flags |= VideoCommon::ImageFlagBits::AsynchronousDecode;
} else if (Settings::values.astc_recompression.GetValue() ==
switch (Settings::values.accelerate_astc.GetValue()) {
case Settings::AstcDecodeMode::GPU:
if (Settings::values.astc_recompression.GetValue() ==
Settings::AstcRecompression::Uncompressed &&
Settings::values.accelerate_astc.GetValue() && info.size.depth == 1) {
info.size.depth == 1) {
flags |= VideoCommon::ImageFlagBits::AcceleratedUpload;
}
break;
case Settings::AstcDecodeMode::CPUAsynchronous:
flags |= VideoCommon::ImageFlagBits::AsynchronousDecode;
break;
default:
break;
}
flags |= VideoCommon::ImageFlagBits::Converted;
flags |= VideoCommon::ImageFlagBits::CostlyLoad;
}

View file

@ -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<u32>(Settings::values.nvdec_emulation.GetValue(global)),
static_cast<u32>(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<u32>(Settings::values.accelerate_astc.GetValue(global)),
static_cast<u32>(Settings::values.accelerate_astc.GetDefault()),
Settings::values.accelerate_astc.UsingGlobal());
WriteSetting(QString::fromStdString(Settings::values.astc_recompression.GetLabel()),
static_cast<u32>(Settings::values.astc_recompression.GetValue(global)),
static_cast<u32>(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<u32>(Settings::values.accelerate_astc.GetValue(global)),
static_cast<u32>(Settings::values.accelerate_astc.GetDefault()),
Settings::values.shader_backend.UsingGlobal());
WriteSetting(QString::fromStdString(Settings::values.shader_backend.GetLabel()),
static_cast<u32>(Settings::values.shader_backend.GetValue(global)),
static_cast<u32>(Settings::values.shader_backend.GetDefault()),

View file

@ -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);

View file

@ -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<int>(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<int>(Settings::values.anti_aliasing.GetValue(true)));
ConfigurationShared::SetColoredComboBox(
ui->astc_decode_mode_combobox, ui->astc_decode_mode_label,
static_cast<int>(Settings::values.accelerate_astc.GetValue(true)));
ConfigurationShared::InsertGlobalItem(
ui->api, static_cast<int>(Settings::values.renderer_backend.GetValue(true)));
ConfigurationShared::InsertGlobalItem(

View file

@ -181,13 +181,6 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="accelerate_astc">
<property name="text">
<string>Accelerate ASTC texture decoding</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="vsync_mode_layout" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_4">
@ -226,6 +219,50 @@ Immediate (no synchronization) just presents whatever is available and can exhib
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="astc_decode_mode_layout" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="astc_decode_mode_label">
<property name="text">
<string>ASTC Texture Decoding Method:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="astc_decode_mode_combobox">
<item>
<property name="text">
<string>CPU</string>
</property>
</item>
<item>
<property name="text">
<string>GPU Compute</string>
</property>
</item>
<item>
<property name="text">
<string>CPU Asynchronous (Hack)</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="nvdec_emulation_widget" native="true">
<layout class="QHBoxLayout" name="nvdec_emulation_layout">

View file

@ -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);

View file

@ -130,16 +130,6 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="async_astc">
<property name="toolTip">
<string>Enables asynchronous ASTC texture decoding, which may reduce load time stutter. This feature is experimental.</string>
</property>
<property name="text">
<string>Decode ASTC textures asynchronously (Hack)</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="use_reactive_flushing">
<property name="toolTip">

View file

@ -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);