Fix issue with semaphore being reused to early

This commit is contained in:
2023-09-05 13:23:22 +02:00
parent 11e207774b
commit f9688792c4
4 changed files with 17 additions and 15 deletions

View File

@@ -43,6 +43,8 @@ namespace openVulkanoCpp
vk::PresentModeKHR presentMode;
vk::Viewport fullscreenViewport;
vk::Rect2D fullscreenScissor;
std::vector<vk::Semaphore> imageAvailableSemaphores;
uint32_t currentSemaphoreId = 0;
bool useVsync = false;
#ifdef __APPLE__
@@ -54,7 +56,6 @@ namespace openVulkanoCpp
public:
vk::SwapchainKHR swapChain;
vk::Semaphore imageAvailableSemaphore;
SwapChain() = default;
~SwapChain() override { if (device) SwapChain::Close(); }
@@ -105,12 +106,14 @@ namespace openVulkanoCpp
return images.size();
}
vk::Semaphore& GetCurrentSemaphore() { return imageAvailableSemaphores[currentSemaphoreId]; }
private:
void CreateSwapChain(vk::Extent2D size);
void CreateSwapChainImages();
void DestroySwapChain() const;
void DestroySwapChain();
protected:
vk::Format FindColorFormat() override