mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-03 16:39:01 -06:00 
			
		
		
		
	configure_graphics: Add Accelerate ASTC decoding setting
This commit is contained in:
		@@ -55,6 +55,7 @@ void LogSettings() {
 | 
			
		||||
    log_setting("Renderer_UseAsynchronousGpuEmulation",
 | 
			
		||||
                values.use_asynchronous_gpu_emulation.GetValue());
 | 
			
		||||
    log_setting("Renderer_UseNvdecEmulation", values.use_nvdec_emulation.GetValue());
 | 
			
		||||
    log_setting("Renderer_AccelerateASTC", values.accelerate_astc.GetValue());
 | 
			
		||||
    log_setting("Renderer_UseVsync", values.use_vsync.GetValue());
 | 
			
		||||
    log_setting("Renderer_UseAssemblyShaders", values.use_assembly_shaders.GetValue());
 | 
			
		||||
    log_setting("Renderer_UseAsynchronousShaders", values.use_asynchronous_shaders.GetValue());
 | 
			
		||||
@@ -135,6 +136,7 @@ void RestoreGlobalState(bool is_powered_on) {
 | 
			
		||||
    values.gpu_accuracy.SetGlobal(true);
 | 
			
		||||
    values.use_asynchronous_gpu_emulation.SetGlobal(true);
 | 
			
		||||
    values.use_nvdec_emulation.SetGlobal(true);
 | 
			
		||||
    values.accelerate_astc.SetGlobal(true);
 | 
			
		||||
    values.use_vsync.SetGlobal(true);
 | 
			
		||||
    values.use_assembly_shaders.SetGlobal(true);
 | 
			
		||||
    values.use_asynchronous_shaders.SetGlobal(true);
 | 
			
		||||
 
 | 
			
		||||
@@ -147,6 +147,7 @@ struct Values {
 | 
			
		||||
    Setting<GPUAccuracy> gpu_accuracy;
 | 
			
		||||
    Setting<bool> use_asynchronous_gpu_emulation;
 | 
			
		||||
    Setting<bool> use_nvdec_emulation;
 | 
			
		||||
    Setting<bool> accelerate_astc;
 | 
			
		||||
    Setting<bool> use_vsync;
 | 
			
		||||
    Setting<bool> use_assembly_shaders;
 | 
			
		||||
    Setting<bool> use_asynchronous_shaders;
 | 
			
		||||
 
 | 
			
		||||
@@ -230,6 +230,7 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader,
 | 
			
		||||
             Settings::values.use_asynchronous_gpu_emulation.GetValue());
 | 
			
		||||
    AddField(field_type, "Renderer_UseNvdecEmulation",
 | 
			
		||||
             Settings::values.use_nvdec_emulation.GetValue());
 | 
			
		||||
    AddField(field_type, "Renderer_AccelerateASTC", Settings::values.accelerate_astc.GetValue());
 | 
			
		||||
    AddField(field_type, "Renderer_UseVsync", Settings::values.use_vsync.GetValue());
 | 
			
		||||
    AddField(field_type, "Renderer_UseAssemblyShaders",
 | 
			
		||||
             Settings::values.use_assembly_shaders.GetValue());
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,8 @@
 | 
			
		||||
 | 
			
		||||
#include <glad/glad.h>
 | 
			
		||||
 | 
			
		||||
#include "common/settings.h"
 | 
			
		||||
 | 
			
		||||
#include "video_core/renderer_opengl/gl_device.h"
 | 
			
		||||
#include "video_core/renderer_opengl/gl_shader_manager.h"
 | 
			
		||||
#include "video_core/renderer_opengl/gl_state_tracker.h"
 | 
			
		||||
@@ -307,7 +309,9 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4
 | 
			
		||||
 | 
			
		||||
[[nodiscard]] bool CanBeAccelerated(const TextureCacheRuntime& runtime,
 | 
			
		||||
                                    const VideoCommon::ImageInfo& info) {
 | 
			
		||||
    return !runtime.HasNativeASTC() && IsPixelFormatASTC(info.format);
 | 
			
		||||
    if (IsPixelFormatASTC(info.format)) {
 | 
			
		||||
        return !runtime.HasNativeASTC() && Settings::values.accelerate_astc.GetValue();
 | 
			
		||||
    }
 | 
			
		||||
    // Disable other accelerated uploads for now as they don't implement swizzled uploads
 | 
			
		||||
    return false;
 | 
			
		||||
    switch (info.type) {
 | 
			
		||||
 
 | 
			
		||||
@@ -8,6 +8,7 @@
 | 
			
		||||
#include <vector>
 | 
			
		||||
 | 
			
		||||
#include "common/bit_cast.h"
 | 
			
		||||
#include "common/settings.h"
 | 
			
		||||
 | 
			
		||||
#include "video_core/engines/fermi_2d.h"
 | 
			
		||||
#include "video_core/renderer_vulkan/blit_image.h"
 | 
			
		||||
@@ -828,7 +829,11 @@ Image::Image(TextureCacheRuntime& runtime, const ImageInfo& info_, GPUVAddr gpu_
 | 
			
		||||
        commit = runtime.memory_allocator.Commit(buffer, MemoryUsage::DeviceLocal);
 | 
			
		||||
    }
 | 
			
		||||
    if (IsPixelFormatASTC(info.format) && !runtime.device.IsOptimalAstcSupported()) {
 | 
			
		||||
        flags |= VideoCommon::ImageFlagBits::AcceleratedUpload;
 | 
			
		||||
        if (Settings::values.accelerate_astc.GetValue()) {
 | 
			
		||||
            flags |= VideoCommon::ImageFlagBits::AcceleratedUpload;
 | 
			
		||||
        } else {
 | 
			
		||||
            flags |= VideoCommon::ImageFlagBits::Converted;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    if (runtime.device.HasDebuggingToolAttached()) {
 | 
			
		||||
        if (image) {
 | 
			
		||||
 
 | 
			
		||||
@@ -807,6 +807,7 @@ void Config::ReadRendererValues() {
 | 
			
		||||
                      QStringLiteral("use_asynchronous_gpu_emulation"), true);
 | 
			
		||||
    ReadSettingGlobal(Settings::values.use_nvdec_emulation, QStringLiteral("use_nvdec_emulation"),
 | 
			
		||||
                      true);
 | 
			
		||||
    ReadSettingGlobal(Settings::values.accelerate_astc, QStringLiteral("accelerate_astc"), true);
 | 
			
		||||
    ReadSettingGlobal(Settings::values.use_vsync, QStringLiteral("use_vsync"), true);
 | 
			
		||||
    ReadSettingGlobal(Settings::values.use_assembly_shaders, QStringLiteral("use_assembly_shaders"),
 | 
			
		||||
                      false);
 | 
			
		||||
@@ -1388,6 +1389,7 @@ void Config::SaveRendererValues() {
 | 
			
		||||
                       Settings::values.use_asynchronous_gpu_emulation, true);
 | 
			
		||||
    WriteSettingGlobal(QStringLiteral("use_nvdec_emulation"), Settings::values.use_nvdec_emulation,
 | 
			
		||||
                       true);
 | 
			
		||||
    WriteSettingGlobal(QStringLiteral("accelerate_astc"), Settings::values.accelerate_astc, true);
 | 
			
		||||
    WriteSettingGlobal(QStringLiteral("use_vsync"), Settings::values.use_vsync, true);
 | 
			
		||||
    WriteSettingGlobal(QStringLiteral("use_assembly_shaders"),
 | 
			
		||||
                       Settings::values.use_assembly_shaders, false);
 | 
			
		||||
 
 | 
			
		||||
@@ -70,10 +70,12 @@ void ConfigureGraphics::SetConfiguration() {
 | 
			
		||||
    ui->use_asynchronous_gpu_emulation->setEnabled(runtime_lock);
 | 
			
		||||
    ui->use_disk_shader_cache->setEnabled(runtime_lock);
 | 
			
		||||
    ui->use_nvdec_emulation->setEnabled(runtime_lock);
 | 
			
		||||
    ui->accelerate_astc->setEnabled(runtime_lock);
 | 
			
		||||
    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->use_nvdec_emulation->setChecked(Settings::values.use_nvdec_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()));
 | 
			
		||||
@@ -118,6 +120,8 @@ void ConfigureGraphics::ApplyConfiguration() {
 | 
			
		||||
                                             use_asynchronous_gpu_emulation);
 | 
			
		||||
    ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_nvdec_emulation,
 | 
			
		||||
                                             ui->use_nvdec_emulation, use_nvdec_emulation);
 | 
			
		||||
    ConfigurationShared::ApplyPerGameSetting(&Settings::values.accelerate_astc, ui->accelerate_astc,
 | 
			
		||||
                                             accelerate_astc);
 | 
			
		||||
 | 
			
		||||
    if (Settings::IsConfiguringGlobal()) {
 | 
			
		||||
        // Guard if during game and set to game-specific value
 | 
			
		||||
@@ -254,6 +258,7 @@ void ConfigureGraphics::SetupPerGameUI() {
 | 
			
		||||
        ui->use_asynchronous_gpu_emulation->setEnabled(
 | 
			
		||||
            Settings::values.use_asynchronous_gpu_emulation.UsingGlobal());
 | 
			
		||||
        ui->use_nvdec_emulation->setEnabled(Settings::values.use_nvdec_emulation.UsingGlobal());
 | 
			
		||||
        ui->accelerate_astc->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());
 | 
			
		||||
 | 
			
		||||
@@ -269,6 +274,8 @@ void ConfigureGraphics::SetupPerGameUI() {
 | 
			
		||||
        ui->use_disk_shader_cache, Settings::values.use_disk_shader_cache, use_disk_shader_cache);
 | 
			
		||||
    ConfigurationShared::SetColoredTristate(
 | 
			
		||||
        ui->use_nvdec_emulation, Settings::values.use_nvdec_emulation, use_nvdec_emulation);
 | 
			
		||||
    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);
 | 
			
		||||
 
 | 
			
		||||
@@ -47,6 +47,7 @@ private:
 | 
			
		||||
    QColor bg_color;
 | 
			
		||||
 | 
			
		||||
    ConfigurationShared::CheckState use_nvdec_emulation;
 | 
			
		||||
    ConfigurationShared::CheckState accelerate_astc;
 | 
			
		||||
    ConfigurationShared::CheckState use_disk_shader_cache;
 | 
			
		||||
    ConfigurationShared::CheckState use_asynchronous_gpu_emulation;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -104,6 +104,13 @@
 | 
			
		||||
          </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="fullscreen_mode_layout" native="true">
 | 
			
		||||
          <layout class="QHBoxLayout" name="horizontalLayout_1">
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user