mirror of
https://github.com/italicsjenga/portability.git
synced 2024-11-23 07:21:31 +11:00
Provide VK_KHR_xlib_surface extension mapping
This commit is contained in:
parent
6a796a7ba1
commit
7c8152f7fb
|
@ -572,6 +572,7 @@ pub unsafe extern "C" fn gfxGetInstanceProcAddr(
|
||||||
vkGetPhysicalDeviceSurfacePresentModesKHR, PFN_vkGetPhysicalDeviceSurfacePresentModesKHR => gfxGetPhysicalDeviceSurfacePresentModesKHR,
|
vkGetPhysicalDeviceSurfacePresentModesKHR, PFN_vkGetPhysicalDeviceSurfacePresentModesKHR => gfxGetPhysicalDeviceSurfacePresentModesKHR,
|
||||||
vkGetPhysicalDeviceWin32PresentationSupportKHR, PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR => gfxGetPhysicalDeviceWin32PresentationSupportKHR,
|
vkGetPhysicalDeviceWin32PresentationSupportKHR, PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR => gfxGetPhysicalDeviceWin32PresentationSupportKHR,
|
||||||
|
|
||||||
|
vkCreateXlibSurfaceKHR, PFN_vkCreateXlibSurfaceKHR => gfxCreateXlibSurfaceKHR,
|
||||||
vkCreateXcbSurfaceKHR, PFN_vkCreateXcbSurfaceKHR => gfxCreateXcbSurfaceKHR,
|
vkCreateXcbSurfaceKHR, PFN_vkCreateXcbSurfaceKHR => gfxCreateXcbSurfaceKHR,
|
||||||
vkCreateWin32SurfaceKHR, PFN_vkCreateWin32SurfaceKHR => gfxCreateWin32SurfaceKHR,
|
vkCreateWin32SurfaceKHR, PFN_vkCreateWin32SurfaceKHR => gfxCreateWin32SurfaceKHR,
|
||||||
vkCreateMetalSurfaceEXT, PFN_vkCreateMetalSurfaceEXT => gfxCreateMetalSurfaceEXT,
|
vkCreateMetalSurfaceEXT, PFN_vkCreateMetalSurfaceEXT => gfxCreateMetalSurfaceEXT,
|
||||||
|
@ -984,6 +985,8 @@ lazy_static! {
|
||||||
vec![
|
vec![
|
||||||
VK_KHR_SURFACE_EXTENSION_NAME,
|
VK_KHR_SURFACE_EXTENSION_NAME,
|
||||||
#[cfg(target_os="linux")]
|
#[cfg(target_os="linux")]
|
||||||
|
VK_KHR_XLIB_SURFACE_EXTENSION_NAME,
|
||||||
|
#[cfg(target_os="linux")]
|
||||||
VK_KHR_XCB_SURFACE_EXTENSION_NAME,
|
VK_KHR_XCB_SURFACE_EXTENSION_NAME,
|
||||||
#[cfg(target_os="windows")]
|
#[cfg(target_os="windows")]
|
||||||
VK_KHR_WIN32_SURFACE_EXTENSION_NAME,
|
VK_KHR_WIN32_SURFACE_EXTENSION_NAME,
|
||||||
|
@ -1003,6 +1006,11 @@ lazy_static! {
|
||||||
specVersion: VK_KHR_SURFACE_SPEC_VERSION,
|
specVersion: VK_KHR_SURFACE_SPEC_VERSION,
|
||||||
},
|
},
|
||||||
#[cfg(target_os="linux")]
|
#[cfg(target_os="linux")]
|
||||||
|
VkExtensionProperties {
|
||||||
|
extensionName: [0; 256], // VK_KHR_XLIB_SURFACE_EXTENSION_NAME
|
||||||
|
specVersion: VK_KHR_XLIB_SURFACE_SPEC_VERSION,
|
||||||
|
},
|
||||||
|
#[cfg(target_os="linux")]
|
||||||
VkExtensionProperties {
|
VkExtensionProperties {
|
||||||
extensionName: [0; 256], // VK_KHR_XCB_SURFACE_EXTENSION_NAME
|
extensionName: [0; 256], // VK_KHR_XCB_SURFACE_EXTENSION_NAME
|
||||||
specVersion: VK_KHR_XCB_SURFACE_SPEC_VERSION,
|
specVersion: VK_KHR_XCB_SURFACE_SPEC_VERSION,
|
||||||
|
@ -4708,6 +4716,46 @@ pub unsafe extern "C" fn gfxCreateWin32SurfaceKHR(
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pub unsafe extern "C" fn gfxCreateXlibSurfaceKHR(
|
||||||
|
instance: VkInstance,
|
||||||
|
pCreateInfo: *const VkXlibSurfaceCreateInfoKHR,
|
||||||
|
pAllocator: *const VkAllocationCallbacks,
|
||||||
|
pSurface: *mut VkSurfaceKHR,
|
||||||
|
) -> VkResult {
|
||||||
|
assert!(pAllocator.is_null());
|
||||||
|
let info = &*pCreateInfo;
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
{
|
||||||
|
assert_eq!(info.flags, 0);
|
||||||
|
use raw_window_handle::{unix::XlibHandle, HasRawWindowHandle, RawWindowHandle};
|
||||||
|
|
||||||
|
struct HandleWrapper(XlibHandle);
|
||||||
|
unsafe impl HasRawWindowHandle for HandleWrapper {
|
||||||
|
fn raw_window_handle(&self) -> RawWindowHandle {
|
||||||
|
RawWindowHandle::Xlib(self.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let xlib_handle = XlibHandle {
|
||||||
|
window: info.window as _,
|
||||||
|
display: info.dpy,
|
||||||
|
..XlibHandle::empty()
|
||||||
|
};
|
||||||
|
*pSurface = Handle::new(
|
||||||
|
instance
|
||||||
|
.backend
|
||||||
|
.create_surface(&HandleWrapper(xlib_handle))
|
||||||
|
.unwrap(),
|
||||||
|
);
|
||||||
|
VkResult::VK_SUCCESS
|
||||||
|
}
|
||||||
|
#[cfg(not(target_os = "linux"))]
|
||||||
|
{
|
||||||
|
let _ = (instance, info, pSurface);
|
||||||
|
unreachable!()
|
||||||
|
}
|
||||||
|
}
|
||||||
pub unsafe extern "C" fn gfxCreateXcbSurfaceKHR(
|
pub unsafe extern "C" fn gfxCreateXcbSurfaceKHR(
|
||||||
instance: VkInstance,
|
instance: VkInstance,
|
||||||
pCreateInfo: *const VkXcbSurfaceCreateInfoKHR,
|
pCreateInfo: *const VkXcbSurfaceCreateInfoKHR,
|
||||||
|
|
|
@ -357,9 +357,11 @@ pub const VK_MAX_DESCRIPTION_SIZE: ::std::os::raw::c_uint = 256;
|
||||||
pub const VK_KHR_surface: ::std::os::raw::c_uint = 1;
|
pub const VK_KHR_surface: ::std::os::raw::c_uint = 1;
|
||||||
pub const VK_KHR_SURFACE_SPEC_VERSION: ::std::os::raw::c_uint = 25;
|
pub const VK_KHR_SURFACE_SPEC_VERSION: ::std::os::raw::c_uint = 25;
|
||||||
pub const VK_KHR_SURFACE_EXTENSION_NAME: &'static [u8; 15usize] = b"VK_KHR_surface\x00";
|
pub const VK_KHR_SURFACE_EXTENSION_NAME: &'static [u8; 15usize] = b"VK_KHR_surface\x00";
|
||||||
|
pub const VK_KHR_XLIB_SURFACE_SPEC_VERSION: ::std::os::raw::c_uint = 6;
|
||||||
pub const VK_KHR_XCB_SURFACE_SPEC_VERSION: ::std::os::raw::c_uint = 6;
|
pub const VK_KHR_XCB_SURFACE_SPEC_VERSION: ::std::os::raw::c_uint = 6;
|
||||||
pub const VK_KHR_WIN32_SURFACE_SPEC_VERSION: ::std::os::raw::c_uint = 6;
|
pub const VK_KHR_WIN32_SURFACE_SPEC_VERSION: ::std::os::raw::c_uint = 6;
|
||||||
pub const VK_MVK_MACOS_SURFACE_SPEC_VERSION: ::std::os::raw::c_uint = 2;
|
pub const VK_MVK_MACOS_SURFACE_SPEC_VERSION: ::std::os::raw::c_uint = 2;
|
||||||
|
pub const VK_KHR_XLIB_SURFACE_EXTENSION_NAME: &'static [u8; 20usize] = b"VK_KHR_xlib_surface\x00";
|
||||||
pub const VK_KHR_XCB_SURFACE_EXTENSION_NAME: &'static [u8; 19usize] = b"VK_KHR_xcb_surface\x00";
|
pub const VK_KHR_XCB_SURFACE_EXTENSION_NAME: &'static [u8; 19usize] = b"VK_KHR_xcb_surface\x00";
|
||||||
pub const VK_KHR_WIN32_SURFACE_EXTENSION_NAME: &'static [u8; 21usize] = b"VK_KHR_win32_surface\x00";
|
pub const VK_KHR_WIN32_SURFACE_EXTENSION_NAME: &'static [u8; 21usize] = b"VK_KHR_win32_surface\x00";
|
||||||
pub const VK_MVK_MACOS_SURFACE_EXTENSION_NAME: &'static [u8; 21usize] = b"VK_MVK_macos_surface\x00";
|
pub const VK_MVK_MACOS_SURFACE_EXTENSION_NAME: &'static [u8; 21usize] = b"VK_MVK_macos_surface\x00";
|
||||||
|
@ -5173,6 +5175,21 @@ impl Clone for VkWin32SurfaceCreateInfoKHR {
|
||||||
*self
|
*self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pub type VkXlibSurfaceCreateFlagsKHR = VkFlags;
|
||||||
|
#[repr(C)]
|
||||||
|
#[derive(Debug, Copy)]
|
||||||
|
pub struct VkXlibSurfaceCreateInfoKHR {
|
||||||
|
pub sType: VkStructureType,
|
||||||
|
pub pNext: *mut ::std::os::raw::c_void,
|
||||||
|
pub flags: VkXlibSurfaceCreateFlagsKHR,
|
||||||
|
pub dpy: *mut ::std::os::raw::c_void,
|
||||||
|
pub window: u32,
|
||||||
|
}
|
||||||
|
impl Clone for VkXlibSurfaceCreateInfoKHR {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
*self
|
||||||
|
}
|
||||||
|
}
|
||||||
pub type VkXcbSurfaceCreateFlagsKHR = VkFlags;
|
pub type VkXcbSurfaceCreateFlagsKHR = VkFlags;
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Copy)]
|
#[derive(Debug, Copy)]
|
||||||
|
@ -7147,6 +7164,15 @@ pub type PFN_vkDestroyInstance = ::std::option::Option<
|
||||||
unsafe extern "C" fn(instance: VkInstance, pAllocator: *const VkAllocationCallbacks),
|
unsafe extern "C" fn(instance: VkInstance, pAllocator: *const VkAllocationCallbacks),
|
||||||
>;
|
>;
|
||||||
|
|
||||||
|
pub type PFN_vkCreateXlibSurfaceKHR = ::std::option::Option<
|
||||||
|
unsafe extern "C" fn(
|
||||||
|
instance: VkInstance,
|
||||||
|
pCreateInfo: *const VkXlibSurfaceCreateInfoKHR,
|
||||||
|
pAllocator: *const VkAllocationCallbacks,
|
||||||
|
pSurface: *mut VkSurfaceKHR,
|
||||||
|
) -> VkResult,
|
||||||
|
>;
|
||||||
|
|
||||||
pub type PFN_vkCreateXcbSurfaceKHR = ::std::option::Option<
|
pub type PFN_vkCreateXcbSurfaceKHR = ::std::option::Option<
|
||||||
unsafe extern "C" fn(
|
unsafe extern "C" fn(
|
||||||
instance: VkInstance,
|
instance: VkInstance,
|
||||||
|
|
Loading…
Reference in a new issue