mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Fixed Validation Error for Zero MaxImageCount (#1844)
Correctly handle a zero max image count in VkSurfaceCapabilitiesKHR which indicates no upper limit to the number of images in a swapchain. Fixes validation error VUID-VkSwapchainCreateInfoKHR-minImageCount-01271
This commit is contained in:
parent
3134b1b42a
commit
df42194eec
@ -120,7 +120,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
|
|
||||||
vk::SwapchainCreateInfoKHR swapChainCreateInfo( vk::SwapchainCreateFlagsKHR(),
|
vk::SwapchainCreateInfoKHR swapChainCreateInfo( vk::SwapchainCreateFlagsKHR(),
|
||||||
surface,
|
surface,
|
||||||
vk::su::clamp( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
vk::su::clampSurfaceImageCount( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
||||||
format,
|
format,
|
||||||
vk::ColorSpaceKHR::eSrgbNonlinear,
|
vk::ColorSpaceKHR::eSrgbNonlinear,
|
||||||
swapchainExtent,
|
swapchainExtent,
|
||||||
|
@ -123,7 +123,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
|
|
||||||
vk::SwapchainCreateInfoKHR swapChainCreateInfo( vk::SwapchainCreateFlagsKHR(),
|
vk::SwapchainCreateInfoKHR swapChainCreateInfo( vk::SwapchainCreateFlagsKHR(),
|
||||||
surface,
|
surface,
|
||||||
vk::su::clamp( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
vk::su::clampSurfaceImageCount( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
||||||
format,
|
format,
|
||||||
vk::ColorSpaceKHR::eSrgbNonlinear,
|
vk::ColorSpaceKHR::eSrgbNonlinear,
|
||||||
swapchainExtent,
|
swapchainExtent,
|
||||||
|
@ -826,7 +826,7 @@ namespace vk
|
|||||||
vk::PresentModeKHR presentMode = vk::su::pickPresentMode( physicalDevice.getSurfacePresentModesKHR( surface ) );
|
vk::PresentModeKHR presentMode = vk::su::pickPresentMode( physicalDevice.getSurfacePresentModesKHR( surface ) );
|
||||||
vk::SwapchainCreateInfoKHR swapChainCreateInfo( {},
|
vk::SwapchainCreateInfoKHR swapChainCreateInfo( {},
|
||||||
surface,
|
surface,
|
||||||
vk::su::clamp( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
vk::su::clampSurfaceImageCount( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
||||||
colorFormat,
|
colorFormat,
|
||||||
surfaceFormat.colorSpace,
|
surfaceFormat.colorSpace,
|
||||||
swapchainExtent,
|
swapchainExtent,
|
||||||
|
@ -74,6 +74,16 @@ namespace vk
|
|||||||
return v < lo ? lo : hi < v ? hi : v;
|
return v < lo ? lo : hi < v ? hi : v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VULKAN_HPP_INLINE uint32_t clampSurfaceImageCount( const uint32_t desiredImageCount, const uint32_t minImageCount, const uint32_t maxImageCount )
|
||||||
|
{
|
||||||
|
uint32_t imageCount = std::max( desiredImageCount, minImageCount );
|
||||||
|
if( maxImageCount > 0 )
|
||||||
|
{
|
||||||
|
imageCount = std::min( imageCount, maxImageCount );
|
||||||
|
}
|
||||||
|
return imageCount;
|
||||||
|
}
|
||||||
|
|
||||||
void setImageLayout(
|
void setImageLayout(
|
||||||
vk::CommandBuffer const & commandBuffer, vk::Image image, vk::Format format, vk::ImageLayout oldImageLayout, vk::ImageLayout newImageLayout );
|
vk::CommandBuffer const & commandBuffer, vk::Image image, vk::Format format, vk::ImageLayout oldImageLayout, vk::ImageLayout newImageLayout );
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ vk::UniqueSwapchainKHR createSwapchainKHRUnique( vk::PhysicalDevice physicalDevi
|
|||||||
: vk::CompositeAlphaFlagBitsKHR::eOpaque;
|
: vk::CompositeAlphaFlagBitsKHR::eOpaque;
|
||||||
vk::SwapchainCreateInfoKHR swapChainCreateInfo( {},
|
vk::SwapchainCreateInfoKHR swapChainCreateInfo( {},
|
||||||
surface,
|
surface,
|
||||||
vk::su::clamp( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
vk::su::clampSurfaceImageCount( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
||||||
surfaceFormat.format,
|
surfaceFormat.format,
|
||||||
surfaceFormat.colorSpace,
|
surfaceFormat.colorSpace,
|
||||||
swapchainExtent,
|
swapchainExtent,
|
||||||
|
Loading…
Reference in New Issue
Block a user