1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

rsx/interpreter: merge shader settings

- merge disable_asynchronous_shader_compiler and interpreter_mode
- removes disable_asynchronous_shader_compiler setting
- Adds the resulting settings as radio buttons to the gui tab
This commit is contained in:
Megamouse 2020-04-27 16:37:31 +02:00 committed by Ivan
parent 2281c4f662
commit 8f0af6a6fe
12 changed files with 226 additions and 111 deletions

View File

@ -69,7 +69,9 @@ void GLGSRender::on_init_thread()
// This allows context sharing to work (both GLRCs passed to wglShareLists have to be idle or you get ERROR_BUSY)
m_context = m_frame->make_context();
if (!g_cfg.video.disable_asynchronous_shader_compiler)
const auto shadermode = g_cfg.video.shadermode.get();
if (shadermode == shader_mode::async_recompiler || shadermode == shader_mode::async_with_interpreter)
{
m_decompiler_context = m_frame->make_context();
}
@ -222,7 +224,7 @@ void GLGSRender::on_init_thread()
m_texture_parameters_buffer->create(gl::buffer::target::uniform, 16 * 0x100000);
m_vertex_layout_buffer->create(gl::buffer::target::uniform, 16 * 0x100000);
if (g_cfg.video.interpreter_mode != shader_interpreter_mode::disabled)
if (shadermode == shader_mode::async_with_interpreter || shadermode == shader_mode::interpreter_only)
{
m_vertex_instructions_buffer->create(gl::buffer::target::ssbo, 16 * 0x100000);
m_fragment_instructions_buffer->create(gl::buffer::target::ssbo, 16 * 0x100000);
@ -610,7 +612,8 @@ void GLGSRender::clear_surface(u32 arg)
bool GLGSRender::load_program()
{
const auto interpreter_mode = g_cfg.video.interpreter_mode.get();
const auto shadermode = g_cfg.video.shadermode.get();
if (m_interpreter_state = (m_graphics_state & rsx::pipeline_state::invalidate_pipeline_bits))
{
get_current_fragment_program(fs_sampler_state);
@ -628,7 +631,7 @@ bool GLGSRender::load_program()
return true;
}
if (interpreter_mode == shader_interpreter_mode::forced)
if (shadermode == shader_mode::interpreter_only)
{
m_program = m_shader_interpreter.get(current_fp_metadata);
return true;
@ -636,11 +639,11 @@ bool GLGSRender::load_program()
}
const bool was_interpreter = m_shader_interpreter.is_interpreter(m_program);
if (interpreter_mode != shader_interpreter_mode::forced) [[likely]]
if (shadermode != shader_mode::interpreter_only) [[likely]]
{
void* pipeline_properties = nullptr;
m_program = m_prog_buffer.get_graphics_pipeline(current_vertex_program, current_fragment_program, pipeline_properties,
!g_cfg.video.disable_asynchronous_shader_compiler, true).get();
shadermode != shader_mode::recompiler, true).get();
if (m_prog_buffer.check_cache_missed())
{
@ -673,7 +676,7 @@ bool GLGSRender::load_program()
m_program = nullptr;
}
if (!m_program && interpreter_mode != shader_interpreter_mode::disabled)
if (!m_program && (shadermode == shader_mode::async_with_interpreter || shadermode == shader_mode::interpreter_only))
{
// Fall back to interpreter
m_program = m_shader_interpreter.get(current_fp_metadata);

View File

@ -561,7 +561,9 @@ namespace rsx
g_fxo->init<named_thread>("RSX Decompiler Thread", [this]
{
if (g_cfg.video.disable_asynchronous_shader_compiler)
const auto shadermode = g_cfg.video.shadermode.get();
if (shadermode != shader_mode::async_recompiler && shadermode != shader_mode::async_with_interpreter)
{
// Die
return;

View File

@ -465,7 +465,9 @@ VKGSRender::VKGSRender() : GSRender()
m_index_buffer_ring_info.create(VK_BUFFER_USAGE_INDEX_BUFFER_BIT, VK_INDEX_RING_BUFFER_SIZE_M * 0x100000, "index buffer");
m_texture_upload_buffer_ring_info.create(VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VK_TEXTURE_UPLOAD_RING_BUFFER_SIZE_M * 0x100000, "texture upload buffer", 32 * 0x100000);
if (g_cfg.video.interpreter_mode != shader_interpreter_mode::disabled)
const auto shadermode = g_cfg.video.shadermode.get();
if (shadermode == shader_mode::async_with_interpreter || shadermode == shader_mode::interpreter_only)
{
m_vertex_instructions_buffer.create(VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, 64 * 0x100000, "vertex instructions buffer", 512 * 16);
m_fragment_instructions_buffer.create(VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, 64 * 0x100000, "fragment instructions buffer", 2048);
@ -550,7 +552,7 @@ VKGSRender::VKGSRender() : GSRender()
m_occlusion_query_pool.initialize(*m_current_command_buffer);
if (g_cfg.video.interpreter_mode != shader_interpreter_mode::disabled)
if (shadermode == shader_mode::async_with_interpreter || shadermode == shader_mode::interpreter_only)
{
m_shader_interpreter.init(*m_device);
}
@ -1583,15 +1585,17 @@ bool VKGSRender::load_program()
}
}
if (g_cfg.video.interpreter_mode != shader_interpreter_mode::forced) [[likely]]
const auto shadermode = g_cfg.video.shadermode.get();
if (shadermode != shader_mode::interpreter_only) [[likely]]
{
vk::enter_uninterruptible();
//Load current program from buffer
// Load current program from buffer
vertex_program.skip_vertex_input_check = true;
fragment_program.unnormalized_coords = 0;
m_program = m_prog_buffer->get_graphics_pipeline(vertex_program, fragment_program, properties,
!g_cfg.video.disable_asynchronous_shader_compiler, true, *m_device, pipeline_layout).get();
shadermode != shader_mode::recompiler, true, *m_device, pipeline_layout).get();
vk::leave_uninterruptible();
@ -1621,7 +1625,7 @@ bool VKGSRender::load_program()
m_program = nullptr;
}
if (!m_program && g_cfg.video.interpreter_mode != shader_interpreter_mode::disabled)
if (!m_program && (shadermode == shader_mode::async_with_interpreter || shadermode == shader_mode::interpreter_only))
{
if (!m_shader_interpreter.is_interpreter(old_program))
{

View File

@ -217,7 +217,9 @@ void VKGSRender::frame_context_cleanup(vk::frame_context_t *ctx, bool free_resou
ctx->buffer_views_to_clean.clear();
if (g_cfg.video.interpreter_mode != shader_interpreter_mode::disabled)
const auto shadermode = g_cfg.video.shadermode.get();
if (shadermode == shader_mode::async_with_interpreter || shadermode == shader_mode::interpreter_only)
{
// TODO: This is jank AF
m_vertex_instructions_buffer.reset_allocation_stats();

View File

@ -101,7 +101,7 @@ struct cfg_root : cfg::node
cfg::_enum<video_aspect> aspect_ratio{ this, "Aspect ratio", video_aspect::_16_9 };
cfg::_enum<frame_limit_type> frame_limit{ this, "Frame limit", frame_limit_type::none, true };
cfg::_enum<msaa_level> antialiasing_level{ this, "MSAA", msaa_level::_auto };
cfg::_enum<shader_interpreter_mode> interpreter_mode{ this, "Shader interpreter mode", shader_interpreter_mode::disabled };
cfg::_enum<shader_mode> shadermode{ this, "Shader Mode", shader_mode::async_recompiler };
cfg::_bool write_color_buffers{ this, "Write Color Buffers" };
cfg::_bool write_depth_buffer{ this, "Write Depth Buffer" };
@ -124,7 +124,6 @@ struct cfg_root : cfg::node
cfg::_bool disable_on_disk_shader_cache{ this, "Disable On-Disk Shader Cache", false };
cfg::_bool disable_vulkan_mem_allocator{ this, "Disable Vulkan Memory Allocator", false };
cfg::_bool full_rgb_range_output{ this, "Use full RGB output range", true, true }; // Video out dynamic range
cfg::_bool disable_asynchronous_shader_compiler{ this, "Disable Asynchronous Shader Compiler", false };
cfg::_bool strict_texture_flushing{ this, "Strict Texture Flushing", false };
cfg::_bool disable_native_float16{ this, "Disable native float16 support", false };
cfg::_bool multithreaded_rsx{ this, "Multithreaded RSX", false };

View File

@ -389,15 +389,16 @@ void fmt_class_string<ppu_decoder_type>::format(std::string& out, u64 arg)
}
template <>
void fmt_class_string<shader_interpreter_mode>::format(std::string& out, u64 arg)
void fmt_class_string<shader_mode>::format(std::string& out, u64 arg)
{
format_enum(out, arg, [](shader_interpreter_mode value)
format_enum(out, arg, [](shader_mode value)
{
switch (value)
{
case shader_interpreter_mode::disabled: return "Disabled";
case shader_interpreter_mode::enabled: return "Enabled";
case shader_interpreter_mode::forced: return "Forced";
case shader_mode::recompiler: return "Shader Recompiler";
case shader_mode::async_recompiler: return "Async Shader Recompiler";
case shader_mode::async_with_interpreter: return "Async with Shader Interpreter";
case shader_mode::interpreter_only: return "Shader Interpreter only";
}
return unknown;

View File

@ -180,9 +180,10 @@ enum np_psn_status
fake,
};
enum class shader_interpreter_mode
enum class shader_mode
{
disabled,
enabled,
forced
recompiler,
async_recompiler,
async_with_interpreter,
interpreter_only
};

View File

@ -529,6 +529,15 @@ QString emu_settings::GetLocalizedSetting(const QString& original, emu_settings_
case video_renderer::vulkan: return tr("Vulkan", "Video renderer");
}
break;
case emu_settings_type::ShaderMode:
switch (static_cast<shader_mode>(index))
{
case shader_mode::recompiler: return tr("Legacy (single threaded)", "Shader Mode");
case shader_mode::async_recompiler: return tr("Async (multi threaded)", "Shader Mode");
case shader_mode::async_with_interpreter: return tr("Async with Shader Interpreter", "Shader Mode");
case shader_mode::interpreter_only: return tr("Shader Interpreter only", "Shader Mode");
}
break;
case emu_settings_type::FrameLimit:
switch (static_cast<frame_limit_type>(index))
{

View File

@ -64,7 +64,7 @@ enum class emu_settings_type
ForceCPUBlitEmulation,
DisableOnDiskShaderCache,
DisableVulkanMemAllocator,
DisableAsyncShaderCompiler,
ShaderMode,
MultithreadedRSX,
VBlankRate,
RelaxedZCULL,
@ -197,7 +197,7 @@ static const QMap<emu_settings_type, cfg_location> settings_location =
{ emu_settings_type::ForceCPUBlitEmulation, { "Video", "Force CPU Blit"}},
{ emu_settings_type::DisableOnDiskShaderCache, { "Video", "Disable On-Disk Shader Cache"}},
{ emu_settings_type::DisableVulkanMemAllocator, { "Video", "Disable Vulkan Memory Allocator"}},
{ emu_settings_type::DisableAsyncShaderCompiler, { "Video", "Disable Asynchronous Shader Compiler"}},
{ emu_settings_type::ShaderMode, { "Video", "Shader Mode"}},
{ emu_settings_type::MultithreadedRSX, { "Video", "Multithreaded RSX"}},
{ emu_settings_type::RelaxedZCULL, { "Video", "Relaxed ZCULL Sync"}},
{ emu_settings_type::AnisotropicFilterOverride, { "Video", "Anisotropic Filter Override"}},

View File

@ -406,9 +406,6 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
});
ui->disableVertexCache->setEnabled(!ui->multithreadedRSX->isChecked());
m_emu_settings->EnhanceCheckBox(ui->disableAsyncShaders, emu_settings_type::DisableAsyncShaderCompiler);
SubscribeTooltip(ui->disableAsyncShaders, tooltips.settings.disable_async_shaders);
m_emu_settings->EnhanceCheckBox(ui->scrictModeRendering, emu_settings_type::StrictRenderingMode);
SubscribeTooltip(ui->scrictModeRendering, tooltips.settings.strict_rendering_mode);
connect(ui->scrictModeRendering, &QCheckBox::clicked, [this](bool checked)
@ -418,6 +415,21 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
ui->gb_anisotropicFilter->setEnabled(!checked);
});
// Radio buttons
SubscribeTooltip(ui->rb_legacy_recompiler, tooltips.settings.legacy_shader_recompiler);
SubscribeTooltip(ui->rb_async_recompiler, tooltips.settings.async_shader_recompiler);
SubscribeTooltip(ui->rb_async_with_shader_interpreter, tooltips.settings.async_with_shader_interpreter);
SubscribeTooltip(ui->rb_shader_interpreter_only, tooltips.settings.shader_interpreter_only);
QButtonGroup *shader_mode_bg = new QButtonGroup(this);
shader_mode_bg->addButton(ui->rb_legacy_recompiler, static_cast<int>(shader_mode::recompiler));
shader_mode_bg->addButton(ui->rb_async_recompiler, static_cast<int>(shader_mode::async_recompiler));
shader_mode_bg->addButton(ui->rb_async_with_shader_interpreter, static_cast<int>(shader_mode::async_with_interpreter));
shader_mode_bg->addButton(ui->rb_shader_interpreter_only, static_cast<int>(shader_mode::interpreter_only));
m_emu_settings->EnhanceRadioButton(shader_mode_bg, emu_settings_type::ShaderMode);
// Sliders
m_emu_settings->EnhanceSlider(ui->resolutionScale, emu_settings_type::ResolutionScale);

View File

@ -432,6 +432,22 @@
</layout>
</widget>
</item>
<item>
<spacer name="gpu_tab_layout_right_spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
@ -594,90 +610,152 @@
</item>
</layout>
</item>
<item>
<spacer name="gpu_tab_layout_middle_spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="gb_additional_settings">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<layout class="QVBoxLayout" name="gpuTabLayoutRight">
<property name="rightMargin">
<number>12</number>
</property>
<property name="title">
<string>Additional Settings</string>
<property name="bottomMargin">
<number>12</number>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<layout class="QVBoxLayout" name="gb_additional_settings_layout">
<item>
<widget class="QCheckBox" name="dumpColor">
<property name="text">
<string>Write Color Buffers</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="scrictModeRendering">
<property name="text">
<string>Strict Rendering Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="vsync">
<property name="text">
<string>VSync</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="stretchToDisplayArea">
<property name="text">
<string>Stretch To Display Area</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="disableVertexCache">
<property name="text">
<string>Disable Vertex Cache</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="multithreadedRSX">
<property name="text">
<string>Multithreaded RSX</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="disableAsyncShaders">
<property name="text">
<string>Disable Async Shader Compiler</string>
</property>
</widget>
</item>
<item>
<spacer name="additional_settings_spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<item>
<widget class="QGroupBox" name="gb_shader_mode">
<property name="minimumSize">
<size>
<width>0</width>
<height>123</height>
</size>
</property>
<property name="title">
<string>Shader Mode</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="rb_legacy_recompiler">
<property name="text">
<string notr="true">Legacy (single threaded)</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rb_async_recompiler">
<property name="text">
<string notr="true">Async (multi threaded)</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rb_async_with_shader_interpreter">
<property name="text">
<string notr="true">Async with Shader Interpreter</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="rb_shader_interpreter_only">
<property name="text">
<string notr="true">Shader Interpreter only</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gb_additional_settings">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Additional Settings</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<layout class="QVBoxLayout" name="gb_additional_settings_layout">
<item>
<widget class="QCheckBox" name="dumpColor">
<property name="text">
<string>Write Color Buffers</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="scrictModeRendering">
<property name="text">
<string>Strict Rendering Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="vsync">
<property name="text">
<string>VSync</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="stretchToDisplayArea">
<property name="text">
<string>Stretch To Display Area</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="disableVertexCache">
<property name="text">
<string>Disable Vertex Cache</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="multithreadedRSX">
<property name="text">
<string>Multithreaded RSX</string>
</property>
</widget>
</item>
<item>
<spacer name="additional_settings_spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</item>

View File

@ -139,10 +139,14 @@ public:
const QString vsync = tr("By having this off you might obtain a higher frame rate at the cost of tearing artifacts in the game.");
const QString strict_rendering_mode = tr("Enforces strict compliance to the API specification.\nMight result in degraded performance in some games.\nCan resolve rare cases of missing graphics and flickering.\nIf unsure, don't use this option.");
const QString disable_vertex_cache = tr("Disables the vertex cache.\nMight resolve missing or flickering graphics output.\nMay degrade performance.");
const QString disable_async_shaders = tr("Disables asynchronous shader compilation.\nFixes missing graphics while shaders are compiling but introduces stuttering.\nDisable if you do not want to deal with graphics pop-in, or for testing before filing any bug reports.");
const QString stretch_to_display_area = tr("Overrides the aspect ratio and stretches the image to the full display area.");
const QString multithreaded_rsx = tr("Offloads some RSX operations to a secondary thread.\nMay improve performance for some high-core processors.\nMay cause slowdown in some situations due to the extra worker thread load.");
const QString legacy_shader_recompiler = tr("Disables asynchronous shader compilation.\nFixes missing graphics while shaders are compiling but introduces severe stuttering or lag.\nUse this if you do not want to deal with graphics pop-in, or for testing before filing any bug reports.");
const QString async_shader_recompiler = tr("This is the recommended option.\nIf a shader is not found in the cache, nothing will be rendered for this shader until it has compiled.\nYou may experience graphics pop-in.");
const QString async_with_shader_interpreter = tr("Hybrid rendering mode.\nIf a shader is not found in the cache, the interpreter will be used to render approximated graphics for this shader until it has compiled.");
const QString shader_interpreter_only = tr("All rendering is handled by the interpreter with no attempt to compile native shaders.\nThis mode is very slow and experimental.");
// gui
const QString log_limit = tr("Sets the maximum amount of blocks that the log can display.\nThis usually equals the number of lines.\nSet 0 in order to remove the limit.");