mirror of
https://github.com/azahar-emu/azahar
synced 2025-11-06 23:19:57 +01:00
Add toggle to disable SPIRV optimization pass (#1080)
* Add toggle to disable SPIRV optimization pass * vk_shader_util.cpp: Nitpicky comment tweak * Consistently refer to "optimizer" instead of "optimization" --------- Co-authored-by: OpenSauce04 <opensauce04@gmail.com>
This commit is contained in:
parent
fd2551439e
commit
fd2ce82b6e
@ -12,6 +12,7 @@ enum class BooleanSetting(
|
|||||||
EXPAND_TO_CUTOUT_AREA("expand_to_cutout_area", Settings.SECTION_LAYOUT, false),
|
EXPAND_TO_CUTOUT_AREA("expand_to_cutout_area", Settings.SECTION_LAYOUT, false),
|
||||||
SPIRV_SHADER_GEN("spirv_shader_gen", Settings.SECTION_RENDERER, true),
|
SPIRV_SHADER_GEN("spirv_shader_gen", Settings.SECTION_RENDERER, true),
|
||||||
ASYNC_SHADERS("async_shader_compilation", Settings.SECTION_RENDERER, false),
|
ASYNC_SHADERS("async_shader_compilation", Settings.SECTION_RENDERER, false),
|
||||||
|
DISABLE_SPIRV_OPTIMIZER("disable_spirv_optimizer", Settings.SECTION_RENDERER, true),
|
||||||
PLUGIN_LOADER("plugin_loader", Settings.SECTION_SYSTEM, false),
|
PLUGIN_LOADER("plugin_loader", Settings.SECTION_SYSTEM, false),
|
||||||
ALLOW_PLUGIN_LOADER("allow_plugin_loader", Settings.SECTION_SYSTEM, true),
|
ALLOW_PLUGIN_LOADER("allow_plugin_loader", Settings.SECTION_SYSTEM, true),
|
||||||
SWAP_SCREEN("swap_screen", Settings.SECTION_LAYOUT, false),
|
SWAP_SCREEN("swap_screen", Settings.SECTION_LAYOUT, false),
|
||||||
|
|||||||
@ -839,6 +839,15 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView)
|
|||||||
BooleanSetting.SPIRV_SHADER_GEN.defaultValue,
|
BooleanSetting.SPIRV_SHADER_GEN.defaultValue,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
add(
|
||||||
|
SwitchSetting(
|
||||||
|
BooleanSetting.DISABLE_SPIRV_OPTIMIZER,
|
||||||
|
R.string.disable_spirv_optimizer,
|
||||||
|
R.string.disable_spirv_optimizer_description,
|
||||||
|
BooleanSetting.DISABLE_SPIRV_OPTIMIZER.key,
|
||||||
|
BooleanSetting.DISABLE_SPIRV_OPTIMIZER.defaultValue,
|
||||||
|
)
|
||||||
|
)
|
||||||
add(
|
add(
|
||||||
SwitchSetting(
|
SwitchSetting(
|
||||||
BooleanSetting.ASYNC_SHADERS,
|
BooleanSetting.ASYNC_SHADERS,
|
||||||
|
|||||||
@ -142,6 +142,7 @@ void Config::ReadValues() {
|
|||||||
ReadSetting("Renderer", Settings::values.async_presentation);
|
ReadSetting("Renderer", Settings::values.async_presentation);
|
||||||
ReadSetting("Renderer", Settings::values.async_shader_compilation);
|
ReadSetting("Renderer", Settings::values.async_shader_compilation);
|
||||||
ReadSetting("Renderer", Settings::values.spirv_shader_gen);
|
ReadSetting("Renderer", Settings::values.spirv_shader_gen);
|
||||||
|
ReadSetting("Renderer", Settings::values.disable_spirv_optimizer);
|
||||||
ReadSetting("Renderer", Settings::values.use_hw_shader);
|
ReadSetting("Renderer", Settings::values.use_hw_shader);
|
||||||
ReadSetting("Renderer", Settings::values.use_shader_jit);
|
ReadSetting("Renderer", Settings::values.use_shader_jit);
|
||||||
ReadSetting("Renderer", Settings::values.resolution_factor);
|
ReadSetting("Renderer", Settings::values.resolution_factor);
|
||||||
|
|||||||
@ -113,6 +113,10 @@ async_shader_compilation =
|
|||||||
# 0: GLSL, 1: SPIR-V (default)
|
# 0: GLSL, 1: SPIR-V (default)
|
||||||
spirv_shader_gen =
|
spirv_shader_gen =
|
||||||
|
|
||||||
|
# Whether to disable the SPIRV optimizer. Disabling it reduces stutter, but may slightly worsen performance
|
||||||
|
# 0: Enabled, 1: Disabled (default)
|
||||||
|
disable_spirv_optimizer =
|
||||||
|
|
||||||
# Whether to use hardware shaders to emulate 3DS shaders
|
# Whether to use hardware shaders to emulate 3DS shaders
|
||||||
# 0: Software, 1 (default): Hardware
|
# 0: Software, 1 (default): Hardware
|
||||||
use_hw_shader =
|
use_hw_shader =
|
||||||
|
|||||||
@ -870,5 +870,7 @@
|
|||||||
<string name="emulation_quickload">Quickload</string>
|
<string name="emulation_quickload">Quickload</string>
|
||||||
<string name="emulation_occupied_quicksave_slot">Quicksave - %1$tF %1$tR</string>
|
<string name="emulation_occupied_quicksave_slot">Quicksave - %1$tF %1$tR</string>
|
||||||
<string name="quickload_not_found">No Quicksave available.</string>
|
<string name="quickload_not_found">No Quicksave available.</string>
|
||||||
|
<string name="disable_spirv_optimizer">Disable SPIR-V Optimizer</string>
|
||||||
|
<string name="disable_spirv_optimizer_description">Disables the SPIR-V optimization pass, reducing stuttering considerably while barely affecting performance.</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2016 Citra Emulator Project
|
// Copyright Citra Emulator Project / Azahar Emulator Project
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
@ -59,6 +59,7 @@ ConfigureGraphics::ConfigureGraphics(QString gl_renderer, std::span<const QStrin
|
|||||||
|
|
||||||
ui->physical_device_combo->setVisible(false);
|
ui->physical_device_combo->setVisible(false);
|
||||||
ui->spirv_shader_gen->setVisible(false);
|
ui->spirv_shader_gen->setVisible(false);
|
||||||
|
ui->disable_spirv_optimizer->setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
for (const QString& name : physical_devices) {
|
for (const QString& name : physical_devices) {
|
||||||
ui->physical_device_combo->addItem(name);
|
ui->physical_device_combo->addItem(name);
|
||||||
@ -143,6 +144,7 @@ void ConfigureGraphics::SetConfiguration() {
|
|||||||
ui->toggle_disk_shader_cache->setChecked(Settings::values.use_disk_shader_cache.GetValue());
|
ui->toggle_disk_shader_cache->setChecked(Settings::values.use_disk_shader_cache.GetValue());
|
||||||
ui->toggle_vsync_new->setChecked(Settings::values.use_vsync_new.GetValue());
|
ui->toggle_vsync_new->setChecked(Settings::values.use_vsync_new.GetValue());
|
||||||
ui->spirv_shader_gen->setChecked(Settings::values.spirv_shader_gen.GetValue());
|
ui->spirv_shader_gen->setChecked(Settings::values.spirv_shader_gen.GetValue());
|
||||||
|
ui->disable_spirv_optimizer->setChecked(Settings::values.disable_spirv_optimizer.GetValue());
|
||||||
ui->toggle_async_shaders->setChecked(Settings::values.async_shader_compilation.GetValue());
|
ui->toggle_async_shaders->setChecked(Settings::values.async_shader_compilation.GetValue());
|
||||||
ui->toggle_async_present->setChecked(Settings::values.async_presentation.GetValue());
|
ui->toggle_async_present->setChecked(Settings::values.async_presentation.GetValue());
|
||||||
|
|
||||||
@ -162,6 +164,8 @@ void ConfigureGraphics::ApplyConfiguration() {
|
|||||||
ui->toggle_async_present, async_presentation);
|
ui->toggle_async_present, async_presentation);
|
||||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.spirv_shader_gen,
|
ConfigurationShared::ApplyPerGameSetting(&Settings::values.spirv_shader_gen,
|
||||||
ui->spirv_shader_gen, spirv_shader_gen);
|
ui->spirv_shader_gen, spirv_shader_gen);
|
||||||
|
ConfigurationShared::ApplyPerGameSetting(&Settings::values.disable_spirv_optimizer,
|
||||||
|
ui->disable_spirv_optimizer, disable_spirv_optimizer);
|
||||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_hw_shader, ui->toggle_hw_shader,
|
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_hw_shader, ui->toggle_hw_shader,
|
||||||
use_hw_shader);
|
use_hw_shader);
|
||||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.shaders_accurate_mul,
|
ConfigurationShared::ApplyPerGameSetting(&Settings::values.shaders_accurate_mul,
|
||||||
@ -241,6 +245,9 @@ void ConfigureGraphics::SetupPerGameUI() {
|
|||||||
ui->toggle_async_present, Settings::values.async_presentation, async_presentation);
|
ui->toggle_async_present, Settings::values.async_presentation, async_presentation);
|
||||||
ConfigurationShared::SetColoredTristate(ui->spirv_shader_gen, Settings::values.spirv_shader_gen,
|
ConfigurationShared::SetColoredTristate(ui->spirv_shader_gen, Settings::values.spirv_shader_gen,
|
||||||
spirv_shader_gen);
|
spirv_shader_gen);
|
||||||
|
ConfigurationShared::SetColoredTristate(ui->disable_spirv_optimizer,
|
||||||
|
Settings::values.disable_spirv_optimizer,
|
||||||
|
disable_spirv_optimizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureGraphics::SetPhysicalDeviceComboVisibility(int index) {
|
void ConfigureGraphics::SetPhysicalDeviceComboVisibility(int index) {
|
||||||
@ -263,5 +270,6 @@ void ConfigureGraphics::SetPhysicalDeviceComboVisibility(int index) {
|
|||||||
|
|
||||||
ui->physical_device_group->setVisible(effective_api == Settings::GraphicsAPI::Vulkan);
|
ui->physical_device_group->setVisible(effective_api == Settings::GraphicsAPI::Vulkan);
|
||||||
ui->spirv_shader_gen->setVisible(effective_api == Settings::GraphicsAPI::Vulkan);
|
ui->spirv_shader_gen->setVisible(effective_api == Settings::GraphicsAPI::Vulkan);
|
||||||
|
ui->disable_spirv_optimizer->setVisible(effective_api == Settings::GraphicsAPI::Vulkan);
|
||||||
ui->opengl_renderer_group->setVisible(effective_api == Settings::GraphicsAPI::OpenGL);
|
ui->opengl_renderer_group->setVisible(effective_api == Settings::GraphicsAPI::OpenGL);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2016 Citra Emulator Project
|
// Copyright Citra Emulator Project / Azahar Emulator Project
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
@ -42,6 +42,7 @@ private:
|
|||||||
ConfigurationShared::CheckState async_shader_compilation;
|
ConfigurationShared::CheckState async_shader_compilation;
|
||||||
ConfigurationShared::CheckState async_presentation;
|
ConfigurationShared::CheckState async_presentation;
|
||||||
ConfigurationShared::CheckState spirv_shader_gen;
|
ConfigurationShared::CheckState spirv_shader_gen;
|
||||||
|
ConfigurationShared::CheckState disable_spirv_optimizer;
|
||||||
std::unique_ptr<Ui::ConfigureGraphics> ui;
|
std::unique_ptr<Ui::ConfigureGraphics> ui;
|
||||||
QColor bg_color;
|
QColor bg_color;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -136,6 +136,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="disable_spirv_optimizer">
|
||||||
|
<property name="text">
|
||||||
|
<string>Disable GLSL -> SPIR-V Optimizer</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Disables the SPIR-V optimization pass, reducing stuttering considerably while barely affecting performance.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@ -498,6 +498,7 @@ struct Values {
|
|||||||
Setting<bool> renderer_debug{false, "renderer_debug"};
|
Setting<bool> renderer_debug{false, "renderer_debug"};
|
||||||
Setting<bool> dump_command_buffers{false, "dump_command_buffers"};
|
Setting<bool> dump_command_buffers{false, "dump_command_buffers"};
|
||||||
SwitchableSetting<bool> spirv_shader_gen{true, "spirv_shader_gen"};
|
SwitchableSetting<bool> spirv_shader_gen{true, "spirv_shader_gen"};
|
||||||
|
SwitchableSetting<bool> disable_spirv_optimizer{true, "disable_spirv_optimizer"};
|
||||||
SwitchableSetting<bool> async_shader_compilation{false, "async_shader_compilation"};
|
SwitchableSetting<bool> async_shader_compilation{false, "async_shader_compilation"};
|
||||||
SwitchableSetting<bool> async_presentation{true, "async_presentation"};
|
SwitchableSetting<bool> async_presentation{true, "async_presentation"};
|
||||||
SwitchableSetting<bool> use_hw_shader{true, "use_hw_shader"};
|
SwitchableSetting<bool> use_hw_shader{true, "use_hw_shader"};
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2023 Citra Emulator Project
|
// Copyright Citra Emulator Project / Azahar Emulator Project
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
@ -9,6 +9,7 @@
|
|||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/literals.h"
|
#include "common/literals.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
|
#include "common/settings.h"
|
||||||
#include "video_core/renderer_vulkan/vk_shader_util.h"
|
#include "video_core/renderer_vulkan/vk_shader_util.h"
|
||||||
|
|
||||||
namespace Vulkan {
|
namespace Vulkan {
|
||||||
@ -203,8 +204,8 @@ vk::ShaderModule Compile(std::string_view code, vk::ShaderStageFlagBits stage, v
|
|||||||
spv::SpvBuildLogger logger;
|
spv::SpvBuildLogger logger;
|
||||||
glslang::SpvOptions options;
|
glslang::SpvOptions options;
|
||||||
|
|
||||||
// Enable optimizations on the generated SPIR-V code.
|
// Controls optimizations on the generated SPIR-V code.
|
||||||
options.disableOptimizer = false;
|
options.disableOptimizer = Settings::values.disable_spirv_optimizer.GetValue();
|
||||||
options.validate = false;
|
options.validate = false;
|
||||||
options.optimizeSize = true;
|
options.optimizeSize = true;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user