mirror of
https://github.com/KhronosGroup/Vulkan-Hpp
synced 2024-11-09 14:10:07 +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(),
|
||||
surface,
|
||||
vk::su::clamp( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
||||
vk::su::clampSurfaceImageCount( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
||||
format,
|
||||
vk::ColorSpaceKHR::eSrgbNonlinear,
|
||||
swapchainExtent,
|
||||
|
@ -123,7 +123,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
|
||||
vk::SwapchainCreateInfoKHR swapChainCreateInfo( vk::SwapchainCreateFlagsKHR(),
|
||||
surface,
|
||||
vk::su::clamp( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
||||
vk::su::clampSurfaceImageCount( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
||||
format,
|
||||
vk::ColorSpaceKHR::eSrgbNonlinear,
|
||||
swapchainExtent,
|
||||
|
@ -826,7 +826,7 @@ namespace vk
|
||||
vk::PresentModeKHR presentMode = vk::su::pickPresentMode( physicalDevice.getSurfacePresentModesKHR( surface ) );
|
||||
vk::SwapchainCreateInfoKHR swapChainCreateInfo( {},
|
||||
surface,
|
||||
vk::su::clamp( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
||||
vk::su::clampSurfaceImageCount( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
||||
colorFormat,
|
||||
surfaceFormat.colorSpace,
|
||||
swapchainExtent,
|
||||
|
@ -74,6 +74,16 @@ namespace vk
|
||||
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(
|
||||
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::SwapchainCreateInfoKHR swapChainCreateInfo( {},
|
||||
surface,
|
||||
vk::su::clamp( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
||||
vk::su::clampSurfaceImageCount( 3u, surfaceCapabilities.minImageCount, surfaceCapabilities.maxImageCount ),
|
||||
surfaceFormat.format,
|
||||
surfaceFormat.colorSpace,
|
||||
swapchainExtent,
|
||||
|
Loading…
Reference in New Issue
Block a user