mirror of
https://github.com/italicsjenga/portability.git
synced 2024-11-26 00:41:33 +11:00
Merge #92
92: macOS surface changes and more r=kvark a=grovesNL Co-authored-by: Joshua Groves <josh@joshgroves.com>
This commit is contained in:
commit
0012de8dfe
5
Makefile
5
Makefile
|
@ -43,7 +43,7 @@ FULL_LIBRARY_PATH=$(CURDIR)/target/debug
|
|||
LIBRARY=target/debug/libportability.$(LIB_EXTENSION)
|
||||
LIBRARY_FAST=target/release/libportability.$(LIB_EXTENSION)
|
||||
|
||||
.PHONY: all rebuild debug release binding run cts cts-pick cts-debug clean cherry
|
||||
.PHONY: all rebuild debug debug-version release binding run cts cts-pick cts-debug clean cherry
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
|
@ -53,6 +53,9 @@ rebuild:
|
|||
debug:
|
||||
cargo build --manifest-path libportability/Cargo.toml --features "$(BACKEND) debug"
|
||||
|
||||
debug-version:
|
||||
cargo rustc --manifest-path libportability/Cargo.toml --features "$(BACKEND) debug" -- -Clink-arg="-current_version 1.0.0" -Clink-arg="-compatibility_version 1.0.0"
|
||||
|
||||
release: $(LIBRARY_FAST)
|
||||
|
||||
binding: $(BINDING)
|
||||
|
|
|
@ -275,7 +275,7 @@ pub extern "C" fn gfxGetPhysicalDeviceProperties(
|
|||
driverVersion: DRIVER_VERSION,
|
||||
vendorID: adapter_info.vendor as _,
|
||||
deviceID: adapter_info.device as _,
|
||||
deviceType: VkPhysicalDeviceType::VK_PHYSICAL_DEVICE_TYPE_OTHER, // TODO
|
||||
deviceType: VkPhysicalDeviceType::VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, // TODO
|
||||
deviceName: device_name,
|
||||
pipelineCacheUUID: [0; 16usize],
|
||||
limits,
|
||||
|
@ -352,6 +352,9 @@ pub extern "C" fn gfxGetInstanceProcAddr(
|
|||
vkGetPhysicalDeviceSurfacePresentModesKHR, PFN_vkGetPhysicalDeviceSurfacePresentModesKHR => gfxGetPhysicalDeviceSurfacePresentModesKHR,
|
||||
|
||||
vkCreateWin32SurfaceKHR, PFN_vkCreateWin32SurfaceKHR => gfxCreateWin32SurfaceKHR,
|
||||
vkCreateMacOSSurfaceMVK, PFN_vkCreateMacOSSurfaceMVK => gfxCreateMacOSSurfaceMVK,
|
||||
|
||||
vkDestroySurfaceKHR, PFN_vkDestroySurfaceKHR => gfxDestroySurfaceKHR,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -622,7 +625,12 @@ lazy_static! {
|
|||
VkExtensionProperties {
|
||||
extensionName: [0; 256], // VK_KHR_WIN32_SURFACE_EXTENSION_NAME
|
||||
specVersion: VK_KHR_WIN32_SURFACE_SPEC_VERSION,
|
||||
}
|
||||
},
|
||||
#[cfg(target_os="macos")]
|
||||
VkExtensionProperties {
|
||||
extensionName: [0; 256], // VK_MVK_MACOS_SURFACE_EXTENSION_NAME
|
||||
specVersion: VK_MVK_MACOS_SURFACE_SPEC_VERSION,
|
||||
},
|
||||
];
|
||||
|
||||
extensions[0]
|
||||
|
@ -636,6 +644,12 @@ lazy_static! {
|
|||
.copy_from_slice(unsafe {
|
||||
mem::transmute(VK_KHR_WIN32_SURFACE_EXTENSION_NAME as &[u8])
|
||||
});
|
||||
#[cfg(target_os = "macos")]
|
||||
extensions[1]
|
||||
.extensionName[..VK_MVK_MACOS_SURFACE_EXTENSION_NAME.len()]
|
||||
.copy_from_slice(unsafe {
|
||||
mem::transmute(VK_MVK_MACOS_SURFACE_EXTENSION_NAME as &[u8])
|
||||
});
|
||||
|
||||
extensions.to_vec()
|
||||
};
|
||||
|
@ -3901,3 +3915,27 @@ pub extern "C" fn gfxQueuePresentKHR(
|
|||
|
||||
VkResult::VK_SUCCESS
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub extern "C" fn gfxCreateMacOSSurfaceMVK(
|
||||
instance: VkInstance,
|
||||
pCreateInfo: *const VkMacOSSurfaceCreateInfoMVK,
|
||||
pAllocator: *const VkAllocationCallbacks,
|
||||
pSurface: *mut VkSurfaceKHR,
|
||||
) -> VkResult {
|
||||
assert!(pAllocator.is_null());
|
||||
let info = unsafe { &*pCreateInfo };
|
||||
#[cfg(target_os="macos")]
|
||||
unsafe {
|
||||
assert_eq!(info.flags, 0);
|
||||
*pSurface = Handle::new(
|
||||
instance.backend.create_surface_from_nsview(info.pView),
|
||||
);
|
||||
VkResult::VK_SUCCESS
|
||||
}
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
{
|
||||
let _ = (instance, info, pSurface);
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -288,8 +288,11 @@ 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_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_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_KHR_swapchain: ::std::os::raw::c_uint = 1;
|
||||
pub const VK_KHR_SWAPCHAIN_SPEC_VERSION: ::std::os::raw::c_uint = 68;
|
||||
pub const VK_KHR_SWAPCHAIN_EXTENSION_NAME: &'static [u8; 17usize] =
|
||||
|
@ -4866,6 +4869,18 @@ pub struct VkXcbSurfaceCreateInfoKHR {
|
|||
impl Clone for VkXcbSurfaceCreateInfoKHR {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
pub type VkMacOSSurfaceCreateFlagsMVK = VkFlags;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct VkMacOSSurfaceCreateInfoMVK {
|
||||
pub sType: VkStructureType,
|
||||
pub pNext: *mut ::std::os::raw::c_void,
|
||||
pub flags: VkMacOSSurfaceCreateFlagsMVK,
|
||||
pub pView: *mut ::std::os::raw::c_void,
|
||||
}
|
||||
impl Clone for VkMacOSSurfaceCreateInfoMVK {
|
||||
fn clone(&self) -> Self { *self }
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy)]
|
||||
pub struct VkPhysicalDeviceFeatures2KHR {
|
||||
|
@ -6919,3 +6934,10 @@ pub type PFN_vkCreateWin32SurfaceKHR = ::std::option::Option<unsafe extern "C" f
|
|||
pAllocator: *const VkAllocationCallbacks,
|
||||
pSurface: *mut VkSurfaceKHR,
|
||||
) -> VkResult>;
|
||||
|
||||
pub type PFN_vkCreateMacOSSurfaceMVK = ::std::option::Option<unsafe extern "C" fn(
|
||||
instance: VkInstance,
|
||||
pCreateInfo: *const VkMacOSSurfaceCreateInfoMVK,
|
||||
pAllocator: *const VkAllocationCallbacks,
|
||||
pSurface: *mut VkSurfaceKHR,
|
||||
) -> VkResult>;
|
||||
|
|
|
@ -276,6 +276,16 @@ pub extern "C" fn vkCreateWin32SurfaceKHR(
|
|||
gfxCreateWin32SurfaceKHR(instance, pCreateInfos, pAllocator, pSurface)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn vkCreateMacOSSurfaceMVK(
|
||||
instance: VkInstance,
|
||||
pCreateInfos: *const VkMacOSSurfaceCreateInfoMVK,
|
||||
pAllocator: *const VkAllocationCallbacks,
|
||||
pSurface: *mut VkSurfaceKHR,
|
||||
) -> VkResult {
|
||||
gfxCreateMacOSSurfaceMVK(instance, pCreateInfos, pAllocator, pSurface)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn vkCreateXcbSurfaceKHR(
|
||||
instance: VkInstance,
|
||||
|
|
Loading…
Reference in a new issue