rsx: Add Ultra shader precision setting for costly accuracy settings

This commit is contained in:
kd-11 2023-04-18 13:19:57 +03:00 committed by kd-11
parent f725ea7d0d
commit 9ff6003dfc
4 changed files with 31 additions and 14 deletions

View file

@ -1,10 +1,11 @@
#include "stdafx.h" #include "stdafx.h"
#include "Utilities/StrFmt.h"
#include "GLSLCommon.h" #include "GLSLCommon.h"
#include "RSXFragmentProgram.h" #include "RSXFragmentProgram.h"
#include "../gcm_enums.h" #include "Emu/system_config.h"
#include "Emu/RSX/gcm_enums.h"
#include "Utilities/StrFmt.h"
namespace program_common namespace program_common
{ {
@ -1245,7 +1246,10 @@ namespace glsl
// Interpolate the input attributes manually. // Interpolate the input attributes manually.
// Matches AMD behavior where gl_BaryCoordSmoothAMD only provides x and y with z being autogenerated. // Matches AMD behavior where gl_BaryCoordSmoothAMD only provides x and y with z being autogenerated.
OS << fmt::replace_all( std::string interpolate_function_block;
if (g_cfg.video.shader_precision == gpu_preset_level::ultra)
{
interpolate_function_block =
"\n" "\n"
"vec4 _interpolate_varying3(const in vec4[3] v)\n" "vec4 _interpolate_varying3(const in vec4[3] v)\n"
"{\n" "{\n"
@ -1253,10 +1257,20 @@ namespace glsl
" const double _gl_BaryCoord_y = double($gl_BaryCoord.y);\n" " const double _gl_BaryCoord_y = double($gl_BaryCoord.y);\n"
" const double _gl_BaryCoord_z = double(1.0) - (_gl_BaryCoord_x + _gl_BaryCoord_y);\n" " const double _gl_BaryCoord_z = double(1.0) - (_gl_BaryCoord_x + _gl_BaryCoord_y);\n"
" return vec4(_gl_BaryCoord_x * v[0] + _gl_BaryCoord_y * v[1] + _gl_BaryCoord_z * v[2]);\n" " return vec4(_gl_BaryCoord_x * v[0] + _gl_BaryCoord_y * v[1] + _gl_BaryCoord_z * v[2]);\n"
"}\n\n", "}\n\n";
}
else
{ {
{ "$gl_BaryCoord", "gl_BaryCoord"s + std::string(ext_flavour) } interpolate_function_block =
}); "\n"
"vec4 _interpolate_varying3(const in vec4[3] v)\n"
"{\n"
" vec3 _gl_BaryCoord = vec3($gl_BaryCoord.xy, 1.f);\n"
" _gl_BaryCoord.z = dot(_gl_BaryCoord, vec3(-1.f, -1.f, 1.f));\n"
" return vec4(_gl_BaryCoord.x * v[0] + _gl_BaryCoord.y * v[1] + _gl_BaryCoord.z * v[2]);\n"
"}\n\n";
}
OS << fmt::replace_all(interpolate_function_block, {{ "$gl_BaryCoord", "gl_BaryCoord"s + std::string(ext_flavour) }});
for (const auto& reg : varying_list) for (const auto& reg : varying_list)
{ {

View file

@ -608,6 +608,7 @@ void fmt_class_string<gpu_preset_level>::format(std::string& out, u64 arg)
switch (value) switch (value)
{ {
case gpu_preset_level::_auto: return "Auto"; case gpu_preset_level::_auto: return "Auto";
case gpu_preset_level::ultra: return "Ultra";
case gpu_preset_level::high: return "High"; case gpu_preset_level::high: return "High";
case gpu_preset_level::low: return "Low"; case gpu_preset_level::low: return "Low";
} }

View file

@ -301,6 +301,7 @@ enum class zcull_precision_level
enum class gpu_preset_level enum class gpu_preset_level
{ {
ultra,
high, high,
low, low,
_auto _auto

View file

@ -947,6 +947,7 @@ QString emu_settings::GetLocalizedSetting(const QString& original, emu_settings_
switch (static_cast<gpu_preset_level>(index)) switch (static_cast<gpu_preset_level>(index))
{ {
case gpu_preset_level::_auto: return tr("Auto", "Shader Precision"); case gpu_preset_level::_auto: return tr("Auto", "Shader Precision");
case gpu_preset_level::ultra: return tr("Ultra", "Shader Precision");
case gpu_preset_level::high: return tr("High", "Shader Precision"); case gpu_preset_level::high: return tr("High", "Shader Precision");
case gpu_preset_level::low: return tr("Low", "Shader Precision"); case gpu_preset_level::low: return tr("Low", "Shader Precision");
} }