2017-12-09 05:18:18 +11:00
|
|
|
#![allow(non_snake_case)]
|
|
|
|
|
2017-12-08 23:11:54 +11:00
|
|
|
extern crate portability_gfx;
|
|
|
|
|
|
|
|
use portability_gfx::*;
|
2017-12-09 05:18:18 +11:00
|
|
|
|
|
|
|
use std::ffi::CStr;
|
|
|
|
use std::mem;
|
2018-04-19 05:30:07 +10:00
|
|
|
|
2017-12-09 05:18:18 +11:00
|
|
|
|
|
|
|
const ICD_VERSION: u32 = 5;
|
|
|
|
|
|
|
|
#[no_mangle]
|
2018-01-05 04:27:43 +11:00
|
|
|
pub extern "C" fn vk_icdGetInstanceProcAddr(
|
|
|
|
instance: VkInstance,
|
|
|
|
pName: *const ::std::os::raw::c_char,
|
2017-12-09 05:18:18 +11:00
|
|
|
) -> PFN_vkVoidFunction {
|
2018-01-20 02:02:28 +11:00
|
|
|
gfxGetInstanceProcAddr(instance, pName)
|
2017-12-09 05:18:18 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
#[no_mangle]
|
2018-01-05 04:27:43 +11:00
|
|
|
pub extern "C" fn vk_icdNegotiateLoaderICDInterfaceVersion(
|
2017-12-09 05:18:18 +11:00
|
|
|
pSupportedVersion: *mut ::std::os::raw::c_uint,
|
|
|
|
) -> VkResult {
|
|
|
|
let supported_version = unsafe { &mut *pSupportedVersion };
|
|
|
|
if *supported_version > ICD_VERSION {
|
|
|
|
*supported_version = ICD_VERSION;
|
|
|
|
}
|
|
|
|
|
|
|
|
VkResult::VK_SUCCESS
|
|
|
|
}
|
|
|
|
|
|
|
|
#[no_mangle]
|
2018-01-05 04:27:43 +11:00
|
|
|
pub extern "C" fn vk_icdGetPhysicalDeviceProcAddr(
|
2018-04-19 05:30:07 +10:00
|
|
|
_instance: VkInstance,
|
2018-01-05 04:27:43 +11:00
|
|
|
pName: *const ::std::os::raw::c_char,
|
2017-12-09 05:18:18 +11:00
|
|
|
) -> PFN_vkVoidFunction {
|
2018-03-02 00:55:31 +11:00
|
|
|
let name = unsafe { CStr::from_ptr(pName) };
|
|
|
|
let name = match name.to_str() {
|
|
|
|
Ok(name) => name,
|
|
|
|
Err(_) => return None,
|
|
|
|
};
|
|
|
|
|
|
|
|
proc_addr!{ name,
|
|
|
|
vkGetPhysicalDeviceFeatures, PFN_vkGetPhysicalDeviceFeatures => gfxGetPhysicalDeviceFeatures,
|
2019-02-08 07:41:38 +11:00
|
|
|
vkGetPhysicalDeviceFeatures2KHR, PFN_vkGetPhysicalDeviceFeatures2KHR => gfxGetPhysicalDeviceFeatures2KHR,
|
2018-03-02 00:55:31 +11:00
|
|
|
vkGetPhysicalDeviceProperties, PFN_vkGetPhysicalDeviceProperties => gfxGetPhysicalDeviceProperties,
|
|
|
|
vkGetPhysicalDeviceFormatProperties, PFN_vkGetPhysicalDeviceFormatProperties => gfxGetPhysicalDeviceFormatProperties,
|
|
|
|
vkGetPhysicalDeviceImageFormatProperties, PFN_vkGetPhysicalDeviceImageFormatProperties => gfxGetPhysicalDeviceImageFormatProperties,
|
|
|
|
vkGetPhysicalDeviceMemoryProperties, PFN_vkGetPhysicalDeviceMemoryProperties => gfxGetPhysicalDeviceMemoryProperties,
|
|
|
|
vkGetPhysicalDeviceQueueFamilyProperties, PFN_vkGetPhysicalDeviceQueueFamilyProperties => gfxGetPhysicalDeviceQueueFamilyProperties,
|
|
|
|
vkGetPhysicalDeviceSparseImageFormatProperties, PFN_vkGetPhysicalDeviceSparseImageFormatProperties => gfxGetPhysicalDeviceSparseImageFormatProperties,
|
|
|
|
|
|
|
|
vkGetPhysicalDeviceSurfaceSupportKHR, PFN_vkGetPhysicalDeviceSurfaceSupportKHR => gfxGetPhysicalDeviceSurfaceSupportKHR,
|
|
|
|
vkGetPhysicalDeviceSurfaceCapabilitiesKHR, PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR => gfxGetPhysicalDeviceSurfaceCapabilitiesKHR,
|
|
|
|
vkGetPhysicalDeviceSurfaceFormatsKHR, PFN_vkGetPhysicalDeviceSurfaceFormatsKHR => gfxGetPhysicalDeviceSurfaceFormatsKHR,
|
|
|
|
vkGetPhysicalDeviceSurfacePresentModesKHR, PFN_vkGetPhysicalDeviceSurfacePresentModesKHR => gfxGetPhysicalDeviceSurfacePresentModesKHR,
|
|
|
|
}
|
2017-12-09 05:18:18 +11:00
|
|
|
}
|