211: Return VkResult from get_physical_device_surface_support r=MaikKlein a=cormac-obrien

Fixes #185

Co-authored-by: Mac O'Brien <cormac@c-obrien.org>
This commit is contained in:
bors[bot] 2019-05-18 22:04:53 +00:00
commit be5e233545
2 changed files with 14 additions and 8 deletions

View file

@ -34,15 +34,19 @@ impl Surface {
physical_device: vk::PhysicalDevice, physical_device: vk::PhysicalDevice,
queue_index: u32, queue_index: u32,
surface: vk::SurfaceKHR, surface: vk::SurfaceKHR,
) -> bool { ) -> VkResult<bool> {
let mut b = mem::uninitialized(); let mut b = mem::uninitialized();
self.surface_fn.get_physical_device_surface_support_khr( let err_code = self.surface_fn.get_physical_device_surface_support_khr(
physical_device, physical_device,
queue_index, queue_index,
surface, surface,
&mut b, &mut b,
); );
b > 0
match err_code {
vk::Result::SUCCESS => Ok(b > 0),
_ => Err(err_code),
}
} }
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/vkGetPhysicalDeviceSurfacePresentModesKHR.html>"] #[doc = "<https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/vkGetPhysicalDeviceSurfacePresentModesKHR.html>"]

View file

@ -378,11 +378,13 @@ impl ExampleBase {
.filter_map(|(index, ref info)| { .filter_map(|(index, ref info)| {
let supports_graphic_and_surface = let supports_graphic_and_surface =
info.queue_flags.contains(vk::QueueFlags::GRAPHICS) info.queue_flags.contains(vk::QueueFlags::GRAPHICS)
&& surface_loader.get_physical_device_surface_support( && surface_loader
.get_physical_device_surface_support(
*pdevice, *pdevice,
index as u32, index as u32,
surface, surface,
); )
.unwrap();
match supports_graphic_and_surface { match supports_graphic_and_surface {
true => Some((*pdevice, index)), true => Some((*pdevice, index)),
_ => None, _ => None,