- if !surface.is_null() {
- let surface = SharedHandle::from(surface).unwrap();
- match surface.platform {
- api::VK_ICD_WSI_PLATFORM_MIR => {
- panic!("unimplemented platform: VK_ICD_WSI_PLATFORM_MIR")
- }
- api::VK_ICD_WSI_PLATFORM_WAYLAND => {
- panic!("unimplemented platform: VK_ICD_WSI_PLATFORM_WAYLAND")
- }
- api::VK_ICD_WSI_PLATFORM_WIN32 => {
- panic!("unimplemented platform: VK_ICD_WSI_PLATFORM_WIN32")
- }
- api::VK_ICD_WSI_PLATFORM_XCB => {
- Box::from_raw(surface.take().get().unwrap().as_ptr() as *mut api::VkIcdSurfaceXcb);
- }
- api::VK_ICD_WSI_PLATFORM_XLIB => {
- panic!("unimplemented platform: VK_ICD_WSI_PLATFORM_XLIB")
- }
- api::VK_ICD_WSI_PLATFORM_ANDROID => {
- panic!("unimplemented platform: VK_ICD_WSI_PLATFORM_ANDROID")
- }
- api::VK_ICD_WSI_PLATFORM_MACOS => {
- panic!("unimplemented platform: VK_ICD_WSI_PLATFORM_MACOS")
- }
- api::VK_ICD_WSI_PLATFORM_IOS => {
- panic!("unimplemented platform: VK_ICD_WSI_PLATFORM_IOS")
- }
- api::VK_ICD_WSI_PLATFORM_DISPLAY => {
- panic!("unimplemented platform: VK_ICD_WSI_PLATFORM_DISPLAY")
- }
- platform => panic!("unknown VkSurfaceKHR platform: {:?}", platform),
- }
+ if let Some(surface) = SharedHandle::from(surface) {
+ let surface_implementation = SurfacePlatform::from(surface.platform)
+ .unwrap()
+ .get_surface_implementation();
+ surface_implementation.destroy_surface(surface.into_nonnull());