rsx: Move fp16 toggle to a global shader precision option

This commit is contained in:
kd-11 2022-10-10 16:19:11 +03:00 committed by kd-11
parent e839595053
commit d246a37b11
9 changed files with 49 additions and 26 deletions

View file

@ -354,7 +354,7 @@ void GLFragmentProgram::Decompile(const RSXFragmentProgram& prog)
std::string source;
GLFragmentDecompilerThread decompiler(source, parr, prog, size);
if (!g_cfg.video.disable_native_float16)
if (g_cfg.video.shader_precision == gpu_preset_level::low)
{
const auto driver_caps = gl::get_driver_caps();
decompiler.device_props.has_native_half_support = driver_caps.NV_gpu_shader5_supported || driver_caps.AMD_gpu_shader_half_float_supported;

View file

@ -419,7 +419,7 @@ void VKFragmentProgram::Decompile(const RSXFragmentProgram& prog)
VKFragmentDecompilerThread decompiler(source, parr, prog, size, *this);
const auto pdev = vk::get_current_renderer();
if (!g_cfg.video.disable_native_float16)
if (g_cfg.video.shader_precision == gpu_preset_level::low)
{
decompiler.device_props.has_native_half_support = pdev->get_shader_types_support().allow_float16;
}

View file

@ -132,6 +132,7 @@ struct cfg_root : cfg::node
cfg::_enum<frame_limit_type> frame_limit{ this, "Frame limit", frame_limit_type::_auto, true };
cfg::_enum<msaa_level> antialiasing_level{ this, "MSAA", msaa_level::_auto };
cfg::_enum<shader_mode> shadermode{ this, "Shader Mode", shader_mode::async_recompiler };
cfg::_enum<gpu_preset_level> shader_precision{ this, "Shader Precision", gpu_preset_level::high };
cfg::_bool write_color_buffers{ this, "Write Color Buffers" };
cfg::_bool write_depth_buffer{ this, "Write Depth Buffer" };
@ -156,11 +157,6 @@ struct cfg_root : cfg::node
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 strict_texture_flushing{ this, "Strict Texture Flushing", false };
#ifdef __APPLE__
cfg::_bool disable_native_float16{ this, "Disable native float16 support", true };
#else
cfg::_bool disable_native_float16{ this, "Disable native float16 support", false };
#endif
cfg::_bool multithreaded_rsx{ this, "Multithreaded RSX", false };
cfg::_bool relaxed_zcull_sync{ this, "Relaxed ZCULL Sync", false };
cfg::_bool enable_3d{ this, "Enable 3D", false };

View file

@ -596,3 +596,18 @@ void fmt_class_string<thread_scheduler_mode>::format(std::string& out, u64 arg)
return unknown;
});
}
template <>
void fmt_class_string<gpu_preset_level>::format(std::string& out, u64 arg)
{
format_enum(out, arg, [](gpu_preset_level value)
{
switch (value)
{
case gpu_preset_level::high: return "High";
case gpu_preset_level::low: return "Low";
}
return unknown;
});
}

View file

@ -288,3 +288,10 @@ enum class zcull_precision_level
relaxed,
undefined
};
enum class gpu_preset_level
{
high,
low,
_auto
};

View file

@ -74,7 +74,7 @@ enum class emu_settings_type
DisableVideoOutput,
DisableFIFOReordering,
StrictTextureFlushing,
DisableNativefloat16,
ShaderPrecisionQuality,
Enable3D,
AnisotropicFilterOverride,
ResolutionScale,
@ -246,7 +246,6 @@ inline static const QMap<emu_settings_type, cfg_location> settings_location =
{ emu_settings_type::DisableOcclusionQueries, { "Video", "Disable ZCull Occlusion Queries"}},
{ emu_settings_type::DisableVideoOutput, { "Video", "Disable Video Output"}},
{ emu_settings_type::DisableFIFOReordering, { "Video", "Disable FIFO Reordering"}},
{ emu_settings_type::DisableNativefloat16, { "Video", "Disable native float16 support"}},
{ emu_settings_type::Enable3D, { "Video", "Enable 3D"}},
{ emu_settings_type::StrictTextureFlushing, { "Video", "Strict Texture Flushing"}},
{ emu_settings_type::ForceCPUBlitEmulation, { "Video", "Force CPU Blit"}},
@ -254,6 +253,7 @@ inline static const QMap<emu_settings_type, cfg_location> settings_location =
{ emu_settings_type::DisableVulkanMemAllocator, { "Video", "Disable Vulkan Memory Allocator"}},
{ emu_settings_type::ShaderMode, { "Video", "Shader Mode"}},
{ emu_settings_type::ShaderCompilerNumThreads, { "Video", "Shader Compiler Threads"}},
{ emu_settings_type::ShaderPrecisionQuality, { "Video", "Shader Precision"}},
{ emu_settings_type::MultithreadedRSX, { "Video", "Multithreaded RSX"}},
{ emu_settings_type::RelaxedZCULL, { "Video", "Relaxed ZCULL Sync"}},
{ emu_settings_type::PreciseZCULL, { "Video", "Accurate ZCULL stats"}},

View file

@ -546,6 +546,9 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
}
}
m_emu_settings->EnhanceComboBox(ui->shaderPrecision, emu_settings_type::ShaderPrecisionQuality);
SubscribeTooltip(ui->gb_antiAliasing, tooltips.settings.shader_precision);
// Comboboxes
m_emu_settings->EnhanceComboBox(ui->shaderCompilerThreads, emu_settings_type::ShaderCompilerNumThreads, true);
SubscribeTooltip(ui->gb_shader_compiler_threads, tooltips.settings.shader_compiler_threads);
@ -2123,9 +2126,6 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
m_emu_settings->EnhanceCheckBox(ui->strictTextureFlushing, emu_settings_type::StrictTextureFlushing);
SubscribeTooltip(ui->strictTextureFlushing, tooltips.settings.strict_texture_flushing);
m_emu_settings->EnhanceCheckBox(ui->disableNativefp16, emu_settings_type::DisableNativefloat16);
SubscribeTooltip(ui->disableNativefp16, tooltips.settings.disable_native_fp16);
m_emu_settings->EnhanceCheckBox(ui->Enable3D, emu_settings_type::Enable3D);
SubscribeTooltip(ui->Enable3D, tooltips.settings.enable_3d);

View file

@ -43,8 +43,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>838</width>
<height>641</height>
<width>821</width>
<height>678</height>
</rect>
</property>
<property name="sizePolicy">
@ -54,7 +54,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="coreTab">
<attribute name="title">
@ -209,8 +209,8 @@
<widget class="QSlider" name="maxPreemptCount">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
@ -519,7 +519,7 @@
</item>
<item>
<widget class="QWidget" name="widget_gpu_3" native="true">
<layout class="QHBoxLayout" name="widget_gpu_3_layout" stretch="1">
<layout class="QHBoxLayout" name="widget_gpu_3_layout" stretch="1,1">
<property name="leftMargin">
<number>0</number>
</property>
@ -544,6 +544,18 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gbShaderPrecision">
<property name="title">
<string>Shader Quality</string>
</property>
<layout class="QVBoxLayout" name="gbShaderPrecision_layout">
<item>
<widget class="QComboBox" name="shaderPrecision"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
@ -2537,13 +2549,6 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="disableNativefp16">
<property name="text">
<string>Disable native float16 support</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="allowHostGPULabels">
<property name="text">

View file

@ -110,7 +110,6 @@ public:
const QString disable_fifo_reordering = tr("Disables RSX FIFO optimizations completely. Draws are processed as they are received by the DMA puller.");
const QString gpu_texture_scaling = tr("Force all texture transfer, scaling and conversion operations on the GPU.\nMay cause texture corruption in some cases.");
const QString strict_texture_flushing = tr("Forces texture flushing even in situations where it is not necessary/correct. Known to cause visual artifacts, but useful for debugging certain texture cache issues.");
const QString disable_native_fp16 = tr("Disables hardware half-float support which is known to cause problems in some rare cases on some GPUs.");
const QString enable_3d = tr("Enables 3D stereo rendering.\nNote that only anaglyph viewing is supported at the moment.");
const QString accurate_ppu_128_loop = tr("When enabled, PPU atomic operations will operate on entire cache line data, as opposed to a single 64bit block of memory when disabled.\nNumerical values control whether or not to enable the accurate version based on the atomic operation's length.");
const QString enable_performance_report = tr("Measure certain events and print a chart after the emulator is stopped. Don't enable if not asked to.");
@ -176,6 +175,7 @@ public:
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.");
const QString shader_compiler_threads = tr("Number of threads to use for the shader compiler backend.\nOnly has an impact when shader mode is set to one of the asynchronous modes.");
const QString shader_precision = tr("Controls the precision level of generated shaders. Low precision leverages native fp16 support of your host GPU but can produce incorrect results in some cases.");
const QString async_texture_streaming = tr("Stream textures to GPU in parallel with 3D rendering using asynchronous compute.\nCan improve performance on more powerful GPUs that have spare headroom.\nOnly works with Vulkan renderer and greatly benefits from having MTRSX enabled if you have a capable CPU.");
const QString force_disable_exclusive_fullscreen_mode = tr("Forces borderless windowed mode for all fullscreen windows. Disables exclusive fullscreen graphics driver optimizations.\nUse when you wish to stream using Vulkan or if your screen goes dim using HDR.\nNote: RPCS3 does not use HDR at all.");