Implement live updating swap interval value for vulkan
This commit is contained in:
parent
3994ce5666
commit
a98a470ea8
@ -320,6 +320,14 @@ namespace GE
|
||||
{ return m_pre_rotation_matrix; }
|
||||
virtual void pauseRendering();
|
||||
virtual void unpauseRendering();
|
||||
void updateSwapInterval(int value)
|
||||
{
|
||||
if (m_params.SwapInterval == value)
|
||||
return;
|
||||
m_params.SwapInterval = value;
|
||||
destroySwapChainRelated(false/*handle_surface*/);
|
||||
createSwapChainRelated(false/*handle_surface*/);
|
||||
}
|
||||
private:
|
||||
struct SwapChainSupportDetails
|
||||
{
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "COpenGLExtensionHandler.h"
|
||||
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "ge_main.hpp"
|
||||
#include "glad/gl.h"
|
||||
#include "ge_vulkan_driver.hpp"
|
||||
#include "MoltenVK.h"
|
||||
@ -330,6 +331,13 @@ extern "C" void update_swap_interval(int swap_interval)
|
||||
if (swap_interval > 1)
|
||||
swap_interval = 1;
|
||||
|
||||
GE::GEVulkanDriver* gevk = GE::getVKDriver();
|
||||
if (gevk)
|
||||
{
|
||||
gevk->updateSwapInterval(swap_interval);
|
||||
return;
|
||||
}
|
||||
|
||||
// Try adaptive vsync first if support
|
||||
if (swap_interval > 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user