This commit is contained in:
Бранимир Караџић
2021-09-30 17:24:16 -07:00
parent be2c110781
commit 22d5747719
2 changed files with 16 additions and 16 deletions

View File

@@ -2828,7 +2828,7 @@ VK_IMPORT_DEVICE
newFrameBuffer.acquire(m_commandBuffer);
int64_t now = bx::getHPCounter();
if (NULL != newFrameBuffer.m_nwh)
{
m_presentElapsed += now - start;
@@ -6795,8 +6795,8 @@ VK_DESTROY
const uint32_t minSwapBufferCount = bx::max<uint32_t>(surfaceCapabilities.minImageCount, 2);
const uint32_t maxSwapBufferCount = surfaceCapabilities.maxImageCount == 0
? SwapChainVK::MaxBackBuffers
: bx::min<uint32_t>(surfaceCapabilities.maxImageCount, SwapChainVK::MaxBackBuffers)
? kMaxBackBuffers
: bx::min<uint32_t>(surfaceCapabilities.maxImageCount, kMaxBackBuffers)
;
if (minSwapBufferCount > maxSwapBufferCount)
@@ -6804,7 +6804,7 @@ VK_DESTROY
BX_TRACE("Create swapchain error: Incompatible swapchain image count (min: %d, max: %d, MaxBackBuffers: %d)."
, minSwapBufferCount
, maxSwapBufferCount
, SwapChainVK::MaxBackBuffers
, kMaxBackBuffers
);
return VK_ERROR_INITIALIZATION_FAILED;
}

View File

@@ -660,6 +660,8 @@ VK_DESTROY_FUNC(DescriptorSet);
static VkImageAspectFlags getAspectMask(VkFormat _format);
};
constexpr uint32_t kMaxBackBuffers = bx::max(BGFX_CONFIG_MAX_BACK_BUFFERS, 10);
struct SwapChainVK
{
SwapChainVK()
@@ -672,7 +674,7 @@ VK_DESTROY_FUNC(DescriptorSet);
}
VkResult create(VkCommandBuffer _commandBuffer, void* _nwh, const Resolution& _resolution, TextureFormat::Enum _depthFormat = TextureFormat::Count);
void destroy();
void update(VkCommandBuffer _commandBuffer, void* _nwh, const Resolution& _resolution);
@@ -704,29 +706,27 @@ VK_DESTROY_FUNC(DescriptorSet);
TextureFormat::Enum m_colorFormat;
TextureFormat::Enum m_depthFormat;
static constexpr size_t MaxBackBuffers = bx::max(BGFX_CONFIG_MAX_BACK_BUFFERS, 10);
VkSurfaceKHR m_surface;
VkSwapchainKHR m_swapchain;
uint32_t m_numSwapchainImages;
VkImageLayout m_backBufferColorImageLayout[MaxBackBuffers];
VkImage m_backBufferColorImage[MaxBackBuffers];
VkImageView m_backBufferColorImageView[MaxBackBuffers];
VkFramebuffer m_backBufferFrameBuffer[MaxBackBuffers];
VkFence m_backBufferFence[MaxBackBuffers];
VkImageLayout m_backBufferColorImageLayout[kMaxBackBuffers];
VkImage m_backBufferColorImage[kMaxBackBuffers];
VkImageView m_backBufferColorImageView[kMaxBackBuffers];
VkFramebuffer m_backBufferFrameBuffer[kMaxBackBuffers];
VkFence m_backBufferFence[kMaxBackBuffers];
uint32_t m_backBufferColorIdx;
VkSemaphore m_presentDoneSemaphore[MaxBackBuffers];
VkSemaphore m_renderDoneSemaphore[MaxBackBuffers];
VkSemaphore m_presentDoneSemaphore[kMaxBackBuffers];
VkSemaphore m_renderDoneSemaphore[kMaxBackBuffers];
uint32_t m_currentSemaphore;
VkSemaphore m_lastImageRenderedSemaphore;
VkSemaphore m_lastImageAcquiredSemaphore;
bool m_needPresent;
bool m_needToRefreshSwapchain;
bool m_needToRecreateSurface;
TextureVK m_backBufferDepthStencil;
VkImageView m_backBufferDepthStencilImageView;