vulkan: handle swap chain surface loss errors.

This commit is contained in:
Sasha Szpakowski
2026-07-05 10:50:22 -03:00
parent 51114ee01c
commit 4758d54af6
2 changed files with 44 additions and 15 deletions
+9 -1
View File
@@ -305,6 +305,13 @@ protected:
private:
enum SwapChainRequestFlags
{
SWAP_CHAIN_REQUEST_KEEP = 0,
SWAP_CHAIN_REQUEST_RECREATE = (1 << 0),
SWAP_CHAIN_REQUEST_RECREATE_SURFACE = (1 << 1),
};
struct SharedDescriptorPoolsRef
{
SharedDescriptorPools *pools = nullptr;
@@ -319,6 +326,7 @@ private:
void createPipelineCache();
void initVMA();
void createSurface();
void cleanupSurface();
SwapChainSupportDetails querySwapChainSupport(VkPhysicalDevice device);
VkSurfaceFormatKHR chooseSwapSurfaceFormat(const std::vector<VkSurfaceFormatKHR> &availableFormats);
VkPresentModeKHR chooseSwapPresentMode(const std::vector<VkPresentModeKHR> &availablePresentModes);
@@ -405,7 +413,7 @@ private:
size_t currentFrame = 0;
uint32_t imageIndex = 0;
uint64 realFrameIndex = 0;
bool swapChainRecreationRequested = false;
uint32 swapChainRequestFlags = 0;
bool windowIsFullscreenExclusive = false;
bool transitionColorDepthLayouts = false;
VmaAllocator vmaAllocator = VK_NULL_HANDLE;