mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +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:
parent
ae7189f9a4
commit
2d0c9127f3
@ -131,6 +131,12 @@ namespace dxvk::vk {
|
|||||||
m_info.imageExtent = pickImageExtent(caps, desc.imageExtent);
|
m_info.imageExtent = pickImageExtent(caps, desc.imageExtent);
|
||||||
m_info.imageCount = pickImageCount(caps, m_info.presentMode, desc.imageCount);
|
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;
|
VkSurfaceFullScreenExclusiveInfoEXT fullScreenInfo;
|
||||||
fullScreenInfo.sType = VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT;
|
fullScreenInfo.sType = VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT;
|
||||||
fullScreenInfo.pNext = nullptr;
|
fullScreenInfo.pNext = nullptr;
|
||||||
|
@ -177,6 +177,18 @@ namespace dxvk::vk {
|
|||||||
VkResult recreateSwapChain(
|
VkResult recreateSwapChain(
|
||||||
const PresenterDesc& desc);
|
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:
|
private:
|
||||||
|
|
||||||
Rc<InstanceFn> m_vki;
|
Rc<InstanceFn> m_vki;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user