mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-31 04:20:34 +00:00
- don't let Vulkan access the vid_vsync variable directly.
Since the FrameBuffers have a SetVsync method anything these last set must count, not the global variable directly.
This commit is contained in:
parent
b9d4e77214
commit
5179a69fdb
5 changed files with 9 additions and 6 deletions
|
@ -92,7 +92,6 @@
|
|||
|
||||
@end
|
||||
|
||||
EXTERN_CVAR(Bool, vid_vsync)
|
||||
EXTERN_CVAR(Bool, vid_hidpi)
|
||||
EXTERN_CVAR(Int, vid_defwidth)
|
||||
EXTERN_CVAR(Int, vid_defheight)
|
||||
|
|
|
@ -63,7 +63,6 @@ CVAR(Int, vid_showpalette, 0, 0)
|
|||
EXTERN_CVAR(Bool, ticker)
|
||||
EXTERN_CVAR(Float, vid_brightness)
|
||||
EXTERN_CVAR(Float, vid_contrast)
|
||||
EXTERN_CVAR(Bool, vid_vsync)
|
||||
EXTERN_CVAR(Int, vid_maxfps)
|
||||
EXTERN_CVAR(Bool, cl_capfps)
|
||||
EXTERN_CVAR(Int, screenblocks)
|
||||
|
|
|
@ -636,6 +636,7 @@ const char* VulkanFrameBuffer::DeviceName() const
|
|||
void VulkanFrameBuffer::SetVSync(bool vsync)
|
||||
{
|
||||
// This is handled in VulkanSwapChain::AcquireImage.
|
||||
cur_vsync = vsync;
|
||||
}
|
||||
|
||||
void VulkanFrameBuffer::CleanForRestart()
|
||||
|
|
|
@ -25,6 +25,7 @@ public:
|
|||
VulkanDevice *device;
|
||||
std::unique_ptr<VulkanSwapChain> swapChain;
|
||||
uint32_t presentImageIndex = 0xffffffff;
|
||||
bool cur_vsync;
|
||||
|
||||
VulkanCommandBuffer *GetTransferCommands();
|
||||
VulkanCommandBuffer *GetDrawCommands();
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
#include "vk_objects.h"
|
||||
#include "c_cvars.h"
|
||||
#include "version.h"
|
||||
#include "v_video.h"
|
||||
#include "vk_framebuffer.h"
|
||||
|
||||
EXTERN_CVAR(Bool, vid_vsync);
|
||||
|
||||
CVAR(Bool, vk_hdr, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||
|
||||
|
@ -21,12 +22,13 @@ VulkanSwapChain::~VulkanSwapChain()
|
|||
|
||||
uint32_t VulkanSwapChain::AcquireImage(int width, int height, VulkanSemaphore *semaphore, VulkanFence *fence)
|
||||
{
|
||||
if (lastSwapWidth != width || lastSwapHeight != height || lastVsync != vid_vsync || lastHdr != vk_hdr || !swapChain)
|
||||
auto vsync = static_cast<VulkanFrameBuffer*>(screen)->cur_vsync;
|
||||
if (lastSwapWidth != width || lastSwapHeight != height || lastVsync != vsync || lastHdr != vk_hdr || !swapChain)
|
||||
{
|
||||
Recreate();
|
||||
lastSwapWidth = width;
|
||||
lastSwapHeight = height;
|
||||
lastVsync = vid_vsync;
|
||||
lastVsync = vsync;
|
||||
lastHdr = vk_hdr;
|
||||
}
|
||||
|
||||
|
@ -271,7 +273,8 @@ void VulkanSwapChain::SelectPresentMode()
|
|||
VulkanError("No surface present modes supported");
|
||||
|
||||
swapChainPresentMode = VK_PRESENT_MODE_FIFO_KHR;
|
||||
if (vid_vsync)
|
||||
auto vsync = static_cast<VulkanFrameBuffer*>(screen)->cur_vsync;
|
||||
if (vsync)
|
||||
{
|
||||
bool supportsFifoRelaxed = std::find(presentModes.begin(), presentModes.end(), VK_PRESENT_MODE_FIFO_RELAXED_KHR) != presentModes.end();
|
||||
if (supportsFifoRelaxed)
|
||||
|
|
Loading…
Reference in a new issue