mirror of
https://github.com/italicsjenga/portability.git
synced 2024-11-26 08:51:31 +11:00
Expose CreateWin32SurfaceKHR and device extensions
This commit is contained in:
parent
d446cc15ca
commit
1d299a4949
|
@ -343,6 +343,8 @@ pub extern "C" fn gfxGetInstanceProcAddr(
|
||||||
vkGetPhysicalDeviceSurfaceCapabilitiesKHR, PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR => gfxGetPhysicalDeviceSurfaceCapabilitiesKHR,
|
vkGetPhysicalDeviceSurfaceCapabilitiesKHR, PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR => gfxGetPhysicalDeviceSurfaceCapabilitiesKHR,
|
||||||
vkGetPhysicalDeviceSurfaceFormatsKHR, PFN_vkGetPhysicalDeviceSurfaceFormatsKHR => gfxGetPhysicalDeviceSurfaceFormatsKHR,
|
vkGetPhysicalDeviceSurfaceFormatsKHR, PFN_vkGetPhysicalDeviceSurfaceFormatsKHR => gfxGetPhysicalDeviceSurfaceFormatsKHR,
|
||||||
vkGetPhysicalDeviceSurfacePresentModesKHR, PFN_vkGetPhysicalDeviceSurfacePresentModesKHR => gfxGetPhysicalDeviceSurfacePresentModesKHR,
|
vkGetPhysicalDeviceSurfacePresentModesKHR, PFN_vkGetPhysicalDeviceSurfacePresentModesKHR => gfxGetPhysicalDeviceSurfacePresentModesKHR,
|
||||||
|
|
||||||
|
vkCreateWin32SurfaceKHR, PFN_vkCreateWin32SurfaceKHR => gfxCreateWin32SurfaceKHR,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -566,6 +568,7 @@ pub extern "C" fn gfxDestroyDevice(gpu: VkDevice, _pAllocator: *const VkAllocati
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
|
// TODO: Request from backend
|
||||||
static ref INSTANCE_EXTENSIONS: Vec<VkExtensionProperties> = {
|
static ref INSTANCE_EXTENSIONS: Vec<VkExtensionProperties> = {
|
||||||
let mut extensions = [
|
let mut extensions = [
|
||||||
VkExtensionProperties {
|
VkExtensionProperties {
|
||||||
|
@ -593,6 +596,23 @@ lazy_static! {
|
||||||
|
|
||||||
extensions.to_vec()
|
extensions.to_vec()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static ref DEVICE_EXTENSIONS: Vec<VkExtensionProperties> = {
|
||||||
|
let mut extensions = [
|
||||||
|
VkExtensionProperties {
|
||||||
|
extensionName: [0; 256], // VK_KHR_SWAPCHAIN_EXTENSION_NAME
|
||||||
|
specVersion: VK_KHR_SWAPCHAIN_SPEC_VERSION,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
extensions[0]
|
||||||
|
.extensionName[..VK_KHR_SWAPCHAIN_EXTENSION_NAME.len()]
|
||||||
|
.copy_from_slice(unsafe {
|
||||||
|
mem::transmute(VK_KHR_SWAPCHAIN_EXTENSION_NAME as &[u8])
|
||||||
|
});
|
||||||
|
|
||||||
|
extensions.to_vec()
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -629,10 +649,27 @@ pub extern "C" fn gfxEnumerateDeviceExtensionProperties(
|
||||||
_physicalDevice: VkPhysicalDevice,
|
_physicalDevice: VkPhysicalDevice,
|
||||||
_pLayerName: *const ::std::os::raw::c_char,
|
_pLayerName: *const ::std::os::raw::c_char,
|
||||||
pPropertyCount: *mut u32,
|
pPropertyCount: *mut u32,
|
||||||
_pProperties: *mut VkExtensionProperties,
|
pProperties: *mut VkExtensionProperties,
|
||||||
) -> VkResult {
|
) -> VkResult {
|
||||||
// TODO: dummy implementation
|
let property_count = unsafe { &mut *pPropertyCount };
|
||||||
unsafe { *pPropertyCount = 0; }
|
let num_extensions = DEVICE_EXTENSIONS.len() as u32;
|
||||||
|
|
||||||
|
if pProperties.is_null() {
|
||||||
|
*property_count = num_extensions;
|
||||||
|
} else {
|
||||||
|
if *property_count > num_extensions {
|
||||||
|
*property_count = num_extensions;
|
||||||
|
}
|
||||||
|
let properties =
|
||||||
|
unsafe { slice::from_raw_parts_mut(pProperties, *property_count as usize) };
|
||||||
|
for i in 0..*property_count as usize {
|
||||||
|
properties[i] = DEVICE_EXTENSIONS[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
if *property_count < num_extensions {
|
||||||
|
return VkResult::VK_INCOMPLETE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VkResult::VK_SUCCESS
|
VkResult::VK_SUCCESS
|
||||||
}
|
}
|
||||||
|
|
|
@ -6828,3 +6828,10 @@ pub type PFN_vkDestroyInstance = ::std::option::Option<unsafe extern "C" fn(
|
||||||
instance: VkInstance,
|
instance: VkInstance,
|
||||||
pAllocator: *const VkAllocationCallbacks,
|
pAllocator: *const VkAllocationCallbacks,
|
||||||
)>;
|
)>;
|
||||||
|
|
||||||
|
pub type PFN_vkCreateWin32SurfaceKHR = ::std::option::Option<unsafe extern "C" fn(
|
||||||
|
instance: VkInstance,
|
||||||
|
pCreateInfo: *const VkWin32SurfaceCreateInfoKHR,
|
||||||
|
pAllocator: *const VkAllocationCallbacks,
|
||||||
|
pSurface: *mut VkSurfaceKHR,
|
||||||
|
) -> VkResult>;
|
||||||
|
|
Loading…
Reference in a new issue