vk: option to duplicate frames to simulate swap interval > 1

Issue #293
This commit is contained in:
Flyinghead 2021-11-10 20:55:22 +01:00
parent ac5abd96bb
commit 7583db3bef
4 changed files with 16 additions and 4 deletions

View File

@ -96,6 +96,7 @@ Option<bool> VSync("rend.vsync", true);
Option<u64> PixelBufferSize("rend.PixelBufferSize", 512 * 1024 * 1024);
Option<int> AnisotropicFiltering("rend.AnisotropicFiltering", 1);
Option<bool> ThreadedRendering("rend.ThreadedRendering", true);
Option<bool> DupeFrames("rend.DupeFrames", false);
// Misc

View File

@ -436,6 +436,7 @@ extern Option<bool> VSync;
extern Option<u64> PixelBufferSize;
extern Option<int> AnisotropicFiltering;
extern Option<bool> ThreadedRendering;
extern Option<bool> DupeFrames;
// Misc

View File

@ -1616,6 +1616,19 @@ static void gui_display_settings()
#ifndef TARGET_IPHONE
OptionCheckbox("VSync", config::VSync, "Synchronizes the frame rate with the screen refresh rate. Recommended");
#endif
ImGui::Indent();
if (!config::VSync || !isVulkan(config::RendererType))
{
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
}
OptionCheckbox("Duplicate frames", config::DupeFrames, "Duplicate frames on high refresh rate monitors (120 Hz and higher)");
if (!config::VSync || !isVulkan(config::RendererType))
{
ImGui::PopItemFlag();
ImGui::PopStyleVar();
}
ImGui::Unindent();
OptionCheckbox("Show FPS Counter", config::ShowFPS, "Show on-screen frame/sec counter");
OptionCheckbox("Show VMU In-game", config::FloatVMUs, "Show the VMU LCD screens while in-game");
OptionCheckbox("Rotate Screen 90°", config::Rotate90, "Rotate the screen 90° counterclockwise");

View File

@ -567,12 +567,9 @@ void VulkanContext::CreateSwapChain()
break;
}
}
/*
if (swapOnVSync && settings.display.refreshRate > 60.f)
// TODO config option to enable duped frames
if (swapOnVSync && config::DupeFrames && settings.display.refreshRate > 60.f)
swapInterval = settings.display.refreshRate / 60.f;
else
*/
swapInterval = 1;
vk::SurfaceTransformFlagBitsKHR preTransform = (surfaceCapabilities.supportedTransforms & vk::SurfaceTransformFlagBitsKHR::eIdentity) ? vk::SurfaceTransformFlagBitsKHR::eIdentity : surfaceCapabilities.currentTransform;