Better handling for vsync image count

This commit is contained in:
maik klein 2017-01-06 08:47:39 +01:00
parent 4565b1f3b3
commit 4e9f1429cd

View file

@ -358,12 +358,10 @@ impl ExampleBase {
let surface_capabilities = let surface_capabilities =
surface_loader.get_physical_device_surface_capabilities_khr(pdevice, surface) surface_loader.get_physical_device_surface_capabilities_khr(pdevice, surface)
.unwrap(); .unwrap();
// Stick with the min image count for now let mut desired_image_count = surface_capabilities.min_image_count + 1;
let desired_image_count = surface_capabilities.min_image_count; if surface_capabilities.max_image_count > 0 && desired_image_count > surface_capabilities.max_image_count{
assert!(surface_capabilities.min_image_count <= desired_image_count && desired_image_count = surface_capabilities.max_image_count;
(surface_capabilities.max_image_count >= desired_image_count || }
surface_capabilities.max_image_count == 0),
"Image count err");
let surface_resolution = match surface_capabilities.current_extent.width { let surface_resolution = match surface_capabilities.current_extent.width {
std::u32::MAX => { std::u32::MAX => {
vk::Extent2D { vk::Extent2D {
@ -373,7 +371,6 @@ impl ExampleBase {
} }
_ => surface_capabilities.current_extent, _ => surface_capabilities.current_extent,
}; };
let pre_transform = if surface_capabilities.supported_transforms let pre_transform = if surface_capabilities.supported_transforms
.subset(vk::SURFACE_TRANSFORM_IDENTITY_BIT_KHR) { .subset(vk::SURFACE_TRANSFORM_IDENTITY_BIT_KHR) {
vk::SURFACE_TRANSFORM_IDENTITY_BIT_KHR vk::SURFACE_TRANSFORM_IDENTITY_BIT_KHR