use crate::sys::*;
use crate::core::*;
use crate::ffi::*;
#[no_mangle]
pub unsafe extern "C" fn vkCreateFence(
device: VkDevice,
pCreateInfo: *const VkFenceCreateInfo,
pAllocator: *const VkAllocationCallbacks,
pFence: *mut VkFence,
) -> VkResult {
if device.is_null() || pCreateInfo.is_null() || pFence.is_null() {
return VkResult::ErrorInitializationFailed;
}
if let Some(icd) = super::forward::get_icd_if_enabled() {
if let Some(create_fence) = icd.create_fence {
return create_fence(device, pCreateInfo, pAllocator, pFence);
}
}
VkResult::ErrorInitializationFailed
}
#[no_mangle]
pub unsafe extern "C" fn vkDestroyFence(
device: VkDevice,
fence: VkFence,
pAllocator: *const VkAllocationCallbacks,
) {
if device.is_null() || fence.is_null() {
return;
}
if let Some(icd) = super::forward::get_icd_if_enabled() {
if let Some(destroy_fence) = icd.destroy_fence {
destroy_fence(device, fence, pAllocator);
}
}
}
#[no_mangle]
pub unsafe extern "C" fn vkResetFences(
device: VkDevice,
fenceCount: u32,
pFences: *const VkFence,
) -> VkResult {
if device.is_null() || fenceCount == 0 || pFences.is_null() {
return VkResult::ErrorInitializationFailed;
}
if let Some(icd) = super::forward::get_icd_if_enabled() {
if let Some(reset_fences) = icd.reset_fences {
return reset_fences(device, fenceCount, pFences);
}
}
VkResult::ErrorInitializationFailed
}
#[no_mangle]
pub unsafe extern "C" fn vkGetFenceStatus(
device: VkDevice,
fence: VkFence,
) -> VkResult {
if device.is_null() || fence.is_null() {
return VkResult::ErrorDeviceLost;
}
if let Some(icd) = super::forward::get_icd_if_enabled() {
if let Some(get_fence_status) = icd.get_fence_status {
return get_fence_status(device, fence);
}
}
VkResult::ErrorInitializationFailed
}
#[no_mangle]
pub unsafe extern "C" fn vkWaitForFences(
device: VkDevice,
fenceCount: u32,
pFences: *const VkFence,
waitAll: VkBool32,
timeout: u64,
) -> VkResult {
if device.is_null() || fenceCount == 0 || pFences.is_null() {
return VkResult::ErrorInitializationFailed;
}
if let Some(icd) = super::forward::get_icd_if_enabled() {
if let Some(wait_for_fences) = icd.wait_for_fences {
return wait_for_fences(device, fenceCount, pFences, waitAll, timeout);
}
}
VkResult::ErrorInitializationFailed
}
#[no_mangle]
pub unsafe extern "C" fn vkCreateSemaphore(
device: VkDevice,
pCreateInfo: *const VkSemaphoreCreateInfo,
pAllocator: *const VkAllocationCallbacks,
pSemaphore: *mut VkSemaphore,
) -> VkResult {
if device.is_null() || pCreateInfo.is_null() || pSemaphore.is_null() {
return VkResult::ErrorInitializationFailed;
}
if let Some(icd) = super::forward::get_icd_if_enabled() {
if let Some(create_semaphore) = icd.create_semaphore {
return create_semaphore(device, pCreateInfo, pAllocator, pSemaphore);
}
}
VkResult::ErrorInitializationFailed
}
#[no_mangle]
pub unsafe extern "C" fn vkDestroySemaphore(
device: VkDevice,
semaphore: VkSemaphore,
pAllocator: *const VkAllocationCallbacks,
) {
if device.is_null() || semaphore.is_null() {
return;
}
if let Some(icd) = super::forward::get_icd_if_enabled() {
if let Some(destroy_semaphore) = icd.destroy_semaphore {
destroy_semaphore(device, semaphore, pAllocator);
}
}
}
#[no_mangle]
pub unsafe extern "C" fn vkCreateEvent(
device: VkDevice,
pCreateInfo: *const VkEventCreateInfo,
pAllocator: *const VkAllocationCallbacks,
pEvent: *mut VkEvent,
) -> VkResult {
if device.is_null() || pCreateInfo.is_null() || pEvent.is_null() {
return VkResult::ErrorInitializationFailed;
}
if let Some(icd) = super::forward::get_icd_if_enabled() {
if let Some(create_event) = icd.create_event {
return create_event(device, pCreateInfo, pAllocator, pEvent);
}
}
VkResult::ErrorInitializationFailed
}
#[no_mangle]
pub unsafe extern "C" fn vkDestroyEvent(
device: VkDevice,
event: VkEvent,
pAllocator: *const VkAllocationCallbacks,
) {
if device.is_null() || event.is_null() {
return;
}
if let Some(icd) = super::forward::get_icd_if_enabled() {
if let Some(destroy_event) = icd.destroy_event {
destroy_event(device, event, pAllocator);
}
}
}
#[no_mangle]
pub unsafe extern "C" fn vkGetEventStatus(
device: VkDevice,
event: VkEvent,
) -> VkResult {
if device.is_null() || event.is_null() {
return VkResult::ErrorDeviceLost;
}
if let Some(icd) = super::forward::get_icd_if_enabled() {
if let Some(get_event_status) = icd.get_event_status {
return get_event_status(device, event);
}
}
VkResult::ErrorInitializationFailed
}
#[no_mangle]
pub unsafe extern "C" fn vkSetEvent(
device: VkDevice,
event: VkEvent,
) -> VkResult {
if device.is_null() || event.is_null() {
return VkResult::ErrorDeviceLost;
}
if let Some(icd) = super::forward::get_icd_if_enabled() {
if let Some(set_event) = icd.set_event {
return set_event(device, event);
}
}
VkResult::ErrorInitializationFailed
}
#[no_mangle]
pub unsafe extern "C" fn vkResetEvent(
device: VkDevice,
event: VkEvent,
) -> VkResult {
if device.is_null() || event.is_null() {
return VkResult::ErrorDeviceLost;
}
if let Some(icd) = super::forward::get_icd_if_enabled() {
if let Some(reset_event) = icd.reset_event {
return reset_event(device, event);
}
}
VkResult::ErrorInitializationFailed
}