mirror of https://github.com/snes9xgit/snes9x.git
Vulkan: Simplify set_vsync. Remove relaxed fifo.
It looks like relaxed fifo tears when refresh rate doesn't match because it always misses a refresh interval.
This commit is contained in:
parent
3980a9d6d4
commit
008cbcd1a1
|
@ -18,13 +18,9 @@ Swapchain::~Swapchain()
|
|||
{
|
||||
}
|
||||
|
||||
bool Swapchain::set_vsync(bool new_setting)
|
||||
void Swapchain::set_vsync(bool new_setting)
|
||||
{
|
||||
if (new_setting == vsync)
|
||||
return false;
|
||||
|
||||
vsync = new_setting;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Swapchain::on_render_pass_end(std::function<void ()> function)
|
||||
|
@ -104,14 +100,14 @@ static bool vector_find(std::vector<T> haystack, T&& needle)
|
|||
|
||||
vk::PresentModeKHR Swapchain::get_present_mode() {
|
||||
auto present_mode = vk::PresentModeKHR::eFifo;
|
||||
if (supports_relaxed)
|
||||
present_mode = vk::PresentModeKHR::eFifoRelaxed;
|
||||
|
||||
if (!vsync) {
|
||||
if (supports_mailbox)
|
||||
present_mode = vk::PresentModeKHR::eMailbox;
|
||||
if (supports_immediate)
|
||||
present_mode = vk::PresentModeKHR::eImmediate;
|
||||
}
|
||||
|
||||
return present_mode;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,7 @@ class Swapchain
|
|||
void end_frame_without_swap();
|
||||
bool swap();
|
||||
void wait_on_frames();
|
||||
// Returns true if vsync setting was changed, false if it was the same
|
||||
bool set_vsync(bool on);
|
||||
void set_vsync(bool on);
|
||||
void on_render_pass_end(std::function<void()> function);
|
||||
int get_num_frames() { return num_swapchain_images; }
|
||||
vk::PresentModeKHR get_present_mode();
|
||||
|
|
|
@ -70,6 +70,8 @@ bool CVulkan::Initialize(HWND hWnd)
|
|||
return false;
|
||||
}
|
||||
|
||||
context->swapchain->set_vsync(GUI.Vsync);
|
||||
|
||||
if (!Settings.AutoDisplayMessages)
|
||||
{
|
||||
Settings.DisplayIndicators = true;
|
||||
|
@ -91,11 +93,6 @@ bool CVulkan::Initialize(HWND hWnd)
|
|||
}
|
||||
}
|
||||
|
||||
if (context->swapchain->set_vsync(GUI.Vsync))
|
||||
{
|
||||
context->recreate_swapchain();
|
||||
}
|
||||
|
||||
simple_output = std::make_unique<Vulkan::SimpleOutput>(context.get(), vk::Format::eR5G6B5UnormPack16);
|
||||
|
||||
return true;
|
||||
|
@ -181,8 +178,6 @@ bool CVulkan::ChangeRenderSize(unsigned int newWidth, unsigned int newHeight)
|
|||
if (!context)
|
||||
return false;
|
||||
|
||||
bool vsync_changed = context->swapchain->set_vsync(GUI.Vsync);
|
||||
|
||||
if (newWidth != current_width || newHeight != current_height || vsync_changed)
|
||||
{
|
||||
context->recreate_swapchain(newWidth, newHeight);
|
||||
|
@ -218,10 +213,7 @@ bool CVulkan::ApplyDisplayChanges(void)
|
|||
current_shadername = shadername;
|
||||
}
|
||||
|
||||
if (context->swapchain->set_vsync(GUI.Vsync))
|
||||
{
|
||||
context->recreate_swapchain();
|
||||
}
|
||||
context->swapchain->set_vsync(GUI.Vsync);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue