From 29985f69e141add91a18b9fd01f232d9572fa255 Mon Sep 17 00:00:00 2001 From: Joel Linn Date: Sun, 20 Nov 2022 19:42:26 +0100 Subject: [PATCH] [ImGui] Fix fsr sharpness slider scaling https://github.com/ocornut/imgui/issues/3361#issuecomment-1287045159 --- src/xenia/app/emulator_window.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/xenia/app/emulator_window.cc b/src/xenia/app/emulator_window.cc index cab817a101..fd47e60184 100644 --- a/src/xenia/app/emulator_window.cc +++ b/src/xenia/app/emulator_window.cc @@ -399,12 +399,17 @@ void EmulatorWindow::DisplayConfigDialog::OnDraw(ImGuiIO& io) { new_presenter_config.GetFsrSharpnessReduction(); ImGui::TextUnformatted( "FSR sharpness reduction when upscaling (lower is sharper):"); - // Power 2.0 as the reduction is in stops, used in exp2. + const auto label = + fmt::format("{:.3f} stops", fsr_sharpness_reduction); + // Power 2.0 scaling as the reduction is in stops, used in exp2. + fsr_sharpness_reduction = sqrt(2.f * fsr_sharpness_reduction); ImGui::SliderFloat( "##FSRSharpnessReduction", &fsr_sharpness_reduction, ui::Presenter::GuestOutputPaintConfig::kFsrSharpnessReductionMin, ui::Presenter::GuestOutputPaintConfig::kFsrSharpnessReductionMax, - "%.3f stops", 2.0f); + label.c_str(), ImGuiSliderFlags_NoInput); + fsr_sharpness_reduction = + .5f * fsr_sharpness_reduction * fsr_sharpness_reduction; ImGui::SameLine(); if (ImGui::Button("Reset##ResetFSRSharpnessReduction")) { fsr_sharpness_reduction = ui::Presenter::GuestOutputPaintConfig ::