allow control sharpness from [0,2.0]

This commit is contained in:
lizzie 2026-01-24 18:11:55 +00:00 committed by crueter
parent e5aeb03d98
commit ce09cfb0c6
6 changed files with 80 additions and 25 deletions

View file

@ -466,8 +466,8 @@
<string name="renderer_resolution">Resolution (Handheld/Docked)</string>
<string name="renderer_vsync">VSync mode</string>
<string name="renderer_scaling_filter">Window adapting filter</string>
<string name="fsr_sharpness">FSR sharpness</string>
<string name="fsr_sharpness_description">Determines how sharpened the image will look while using FSR\'s dynamic contrast</string>
<string name="fsr_sharpness">FSR/SGSR sharpness</string>
<string name="fsr_sharpness_description">Determines how sharpened the image will look while using FSR or SGSR filters</string>
<string name="renderer_anti_aliasing">Anti-aliasing method</string>
<string name="renderer_optimize_spirv_output">Optimize SPIRV output</string>
<string name="renderer_optimize_spirv_output_description">Optimizes compiled shaders to improve GPU efficiency, but may introduce longer loading times and initial slowdowns.</string>

View file

@ -149,7 +149,7 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QObject* parent) {
"Options lower than 1X can cause artifacts."));
INSERT(Settings, scaling_filter, tr("Window Adapting Filter:"), QString());
INSERT(Settings, fsr_sharpening_slider, tr("FSR Sharpness:"),
tr("Determines how sharpened the image will look using FSR's dynamic contrast."));
tr("Determines how sharpened the image will look using FSR's or SGSR's dynamic contrast."));
INSERT(Settings, anti_aliasing, tr("Anti-Aliasing Method:"),
tr("The anti-aliasing method to use.\nSMAA offers the best quality.\nFXAA "
"can produce a more stable picture in lower resolutions."));

View file

@ -6,6 +6,7 @@
layout( push_constant ) uniform constants {
highp vec4 ViewportInfo[1];
highp vec2 ResizeFactor;
highp float EdgeSharpness;
};
layout(location = 0) out highp vec2 texcoord;

View file

@ -17,7 +17,7 @@
namespace Vulkan {
using PushConstants = std::array<u32, 4 + 2>;
using PushConstants = std::array<u32, 4 + 2 + 1>;
SGSR::SGSR(const Device& device, MemoryAllocator& memory_allocator, size_t image_count, VkExtent2D extent, bool edge_dir)
: m_device{device}, m_memory_allocator{memory_allocator}
@ -102,9 +102,16 @@ VkImageView SGSR::Draw(Scheduler& scheduler, size_t image_index, VkImage source_
const f32 input_image_height = f32(input_image_extent.height);
const f32 viewport_width = (crop_rect.right - crop_rect.left) * input_image_width;
const f32 viewport_height = (crop_rect.bottom - crop_rect.top) * input_image_height;
// expected [0, 2]
const f32 sharpening = f32(Settings::values.fsr_sharpening_slider.GetValue()) / 100.0f;
// p = (tex * viewport) / input = [0,n] (normalized texcoords)
// p * input = [0,1024], [0,768]
// layout( push_constant ) uniform constants {
// highp vec4 ViewportInfo[1];
// highp vec2 ResizeFactor;
// highp float EdgeSharpness;
// };
PushConstants viewport_con{};
viewport_con[0] = std::bit_cast<u32>(1.f / viewport_width);
viewport_con[1] = std::bit_cast<u32>(1.f / viewport_height);
@ -112,6 +119,7 @@ VkImageView SGSR::Draw(Scheduler& scheduler, size_t image_index, VkImage source_
viewport_con[3] = std::bit_cast<u32>(viewport_height);
viewport_con[4] = std::bit_cast<u32>(viewport_width / input_image_width);
viewport_con[5] = std::bit_cast<u32>(viewport_height / input_image_height);
viewport_con[6] = std::bit_cast<u32>(sharpening);
UploadImages(scheduler);
UpdateDescriptorSets(source_image_view, image_index);

View file

@ -265,7 +265,7 @@ void ConfigureGraphics::Setup(const ConfigurationShared::Builder& builder) {
// FSR needs a reversed slider and a 0.5 multiplier
return builder.BuildWidget(
setting, apply_funcs, ConfigurationShared::RequestType::ReverseSlider, true,
0.5f, nullptr, tr("%", "FSR sharpening percentage (e.g. 50%)"));
0.5f, nullptr, tr("%", "FSR/SGSR sharpening percentage (e.g. 50%)"));
} else {
return builder.BuildWidget(setting, apply_funcs);
}