mirror of
https://github.com/italicsjenga/portability.git
synced 2025-02-18 15:17:43 +11:00
XCB support
This commit is contained in:
parent
c049bac241
commit
05e8abbde0
3 changed files with 50 additions and 5 deletions
|
@ -2856,17 +2856,18 @@ pub extern "C" fn gfxCmdSetDiscardRectangleEXT(
|
||||||
#[inline]
|
#[inline]
|
||||||
pub extern "C" fn gfxCreateWin32SurfaceKHR(
|
pub extern "C" fn gfxCreateWin32SurfaceKHR(
|
||||||
instance: VkInstance,
|
instance: VkInstance,
|
||||||
pCreateInfos: *const VkWin32SurfaceCreateInfoKHR,
|
pCreateInfo: *const VkWin32SurfaceCreateInfoKHR,
|
||||||
pAllocator: *const VkAllocationCallbacks,
|
pAllocator: *const VkAllocationCallbacks,
|
||||||
pSurface: *mut VkSurfaceKHR,
|
pSurface: *mut VkSurfaceKHR,
|
||||||
) -> VkResult {
|
) -> VkResult {
|
||||||
|
let info = unsafe { &*pCreateInfo };
|
||||||
#[cfg(all(feature = "vulkan", target_os = "windows"))]
|
#[cfg(all(feature = "vulkan", target_os = "windows"))]
|
||||||
{
|
{
|
||||||
unsafe {
|
unsafe {
|
||||||
assert_eq!((*pCreateInfos).flags, 0);
|
assert_eq!(info.flags, 0);
|
||||||
assert!(pAllocator.is_null());
|
assert!(pAllocator.is_null());
|
||||||
*pSurface = Handle::new(
|
*pSurface = Handle::new(
|
||||||
instance.create_surface_from_hwnd((*pCreateInfos).hinstance, (*pCreateInfos).hwnd),
|
instance.create_surface_from_hwnd(info.hinstance, info.hwnd),
|
||||||
);
|
);
|
||||||
VkResult::VK_SUCCESS
|
VkResult::VK_SUCCESS
|
||||||
}
|
}
|
||||||
|
@ -2874,15 +2875,36 @@ pub extern "C" fn gfxCreateWin32SurfaceKHR(
|
||||||
#[cfg(feature = "dx12")]
|
#[cfg(feature = "dx12")]
|
||||||
{
|
{
|
||||||
unsafe {
|
unsafe {
|
||||||
assert_eq!((*pCreateInfos).flags, 0);
|
assert_eq!(info.flags, 0);
|
||||||
assert!(pAllocator.is_null());
|
assert!(pAllocator.is_null());
|
||||||
*pSurface = Handle::new(instance.create_surface_from_hwnd((*pCreateInfos).hwnd));
|
*pSurface = Handle::new(instance.create_surface_from_hwnd(info.hwnd));
|
||||||
VkResult::VK_SUCCESS
|
VkResult::VK_SUCCESS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
|
pub extern "C" fn gfxCreateXcbSurfaceKHR(
|
||||||
|
instance: VkInstance,
|
||||||
|
pCreateInfo: *const VkXcbSurfaceCreateInfoKHR,
|
||||||
|
pAllocator: *const VkAllocationCallbacks,
|
||||||
|
pSurface: *mut VkSurfaceKHR,
|
||||||
|
) -> VkResult {
|
||||||
|
let info = unsafe { &*pCreateInfo };
|
||||||
|
#[cfg(feature = "vulkan")]
|
||||||
|
{
|
||||||
|
unsafe {
|
||||||
|
assert_eq!(info.flags, 0);
|
||||||
|
assert!(pAllocator.is_null());
|
||||||
|
*pSurface = Handle::new(
|
||||||
|
instance.create_surface_from_xcb(info.connection as _, info.window),
|
||||||
|
);
|
||||||
|
VkResult::VK_SUCCESS
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(not(feature = "vulkan"))]
|
||||||
|
unreachable!()
|
||||||
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
pub extern "C" fn gfxAcquireNextImageKHR(
|
pub extern "C" fn gfxAcquireNextImageKHR(
|
||||||
_device: VkDevice,
|
_device: VkDevice,
|
||||||
|
|
|
@ -4753,6 +4753,19 @@ pub struct VkWin32SurfaceCreateInfoKHR {
|
||||||
impl Clone for VkWin32SurfaceCreateInfoKHR {
|
impl Clone for VkWin32SurfaceCreateInfoKHR {
|
||||||
fn clone(&self) -> Self { *self }
|
fn clone(&self) -> Self { *self }
|
||||||
}
|
}
|
||||||
|
pub type VkXcbSurfaceCreateFlagsKHR = VkFlags;
|
||||||
|
#[repr(C)]
|
||||||
|
#[derive(Debug, Copy)]
|
||||||
|
pub struct VkXcbSurfaceCreateInfoKHR {
|
||||||
|
pub sType: VkStructureType,
|
||||||
|
pub pNext: *mut ::std::os::raw::c_void,
|
||||||
|
pub flags: VkXcbSurfaceCreateFlagsKHR,
|
||||||
|
pub connection: *mut ::std::os::raw::c_void,
|
||||||
|
pub window: u32,
|
||||||
|
}
|
||||||
|
impl Clone for VkXcbSurfaceCreateInfoKHR {
|
||||||
|
fn clone(&self) -> Self { *self }
|
||||||
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Copy)]
|
#[derive(Debug, Copy)]
|
||||||
pub struct VkPhysicalDeviceFeatures2KHR {
|
pub struct VkPhysicalDeviceFeatures2KHR {
|
||||||
|
|
|
@ -276,6 +276,16 @@ pub extern "C" fn vkCreateWin32SurfaceKHR(
|
||||||
gfxCreateWin32SurfaceKHR(instance, pCreateInfos, pAllocator, pSurface)
|
gfxCreateWin32SurfaceKHR(instance, pCreateInfos, pAllocator, pSurface)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn vkCreateXcbSurfaceKHR(
|
||||||
|
instance: VkInstance,
|
||||||
|
pCreateInfos: *const VkXcbSurfaceCreateInfoKHR,
|
||||||
|
pAllocator: *const VkAllocationCallbacks,
|
||||||
|
pSurface: *mut VkSurfaceKHR,
|
||||||
|
) -> VkResult {
|
||||||
|
gfxCreateXcbSurfaceKHR(instance, pCreateInfos, pAllocator, pSurface)
|
||||||
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn vkMapMemory(
|
pub extern "C" fn vkMapMemory(
|
||||||
device: VkDevice,
|
device: VkDevice,
|
||||||
|
|
Loading…
Add table
Reference in a new issue