1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-29 19:24:10 +01:00

[vulkan] Don't create a swap chain if the window size is 0

This can actually happen on win32, and creating a zero-sized swap
chain is illegal.
This commit is contained in:
Philip Rebohle 2019-12-15 11:32:43 +01:00
parent ae7189f9a4
commit 2d0c9127f3
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 18 additions and 0 deletions

View File

@ -131,6 +131,12 @@ namespace dxvk::vk {
m_info.imageExtent = pickImageExtent(caps, desc.imageExtent);
m_info.imageCount = pickImageCount(caps, m_info.presentMode, desc.imageCount);
if (!m_info.imageExtent.width || !m_info.imageExtent.height) {
m_info.imageCount = 0;
m_info.format = { VK_FORMAT_UNDEFINED, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR };
return VK_SUCCESS;
}
VkSurfaceFullScreenExclusiveInfoEXT fullScreenInfo;
fullScreenInfo.sType = VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT;
fullScreenInfo.pNext = nullptr;

View File

@ -177,6 +177,18 @@ namespace dxvk::vk {
VkResult recreateSwapChain(
const PresenterDesc& desc);
/**
* \brief Checks whether a Vulkan swap chain exists
*
* On Windows, there are situations where we cannot create
* a swap chain as the surface size can reach zero, and no
* presentation can be performed.
* \returns \c true if the presenter has a swap chain.
*/
bool hasSwapChain() const {
return m_swapchain;
}
private:
Rc<InstanceFn> m_vki;