use crate::sys::*;
use crate::core::*;
use crate::ffi::*;
#[no_mangle]
pub unsafe extern "C" fn vkCreateBuffer(
device: VkDevice,
pCreateInfo: *const VkBufferCreateInfo,
pAllocator: *const VkAllocationCallbacks,
pBuffer: *mut VkBuffer,
) -> VkResult {
if device.is_null() || pCreateInfo.is_null() || pBuffer.is_null() {
return VkResult::ErrorInitializationFailed;
}
if let Some(icd) = super::forward::get_icd_if_enabled() {
if let Some(create_buffer) = icd.create_buffer {
return create_buffer(device, pCreateInfo, pAllocator, pBuffer);
}
}
VkResult::ErrorInitializationFailed
}
#[no_mangle]
pub unsafe extern "C" fn vkDestroyBuffer(
device: VkDevice,
buffer: VkBuffer,
pAllocator: *const VkAllocationCallbacks,
) {
if device.is_null() || buffer.is_null() {
return;
}
if let Some(icd) = super::forward::get_icd_if_enabled() {
if let Some(destroy_buffer) = icd.destroy_buffer {
destroy_buffer(device, buffer, pAllocator);
}
}
}
#[no_mangle]
pub unsafe extern "C" fn vkGetBufferMemoryRequirements(
device: VkDevice,
buffer: VkBuffer,
pMemoryRequirements: *mut VkMemoryRequirements,
) {
if device.is_null() || buffer.is_null() || pMemoryRequirements.is_null() {
return;
}
if let Some(icd) = super::forward::get_icd_if_enabled() {
if let Some(get_buffer_memory_requirements) = icd.get_buffer_memory_requirements {
get_buffer_memory_requirements(device, buffer, pMemoryRequirements);
}
}
}
#[no_mangle]
pub unsafe extern "C" fn vkBindBufferMemory(
device: VkDevice,
buffer: VkBuffer,
memory: VkDeviceMemory,
memoryOffset: VkDeviceSize,
) -> VkResult {
if device.is_null() || buffer.is_null() || memory.is_null() {
return VkResult::ErrorInitializationFailed;
}
if let Some(icd) = super::forward::get_icd_if_enabled() {
if let Some(bind_buffer_memory) = icd.bind_buffer_memory {
return bind_buffer_memory(device, buffer, memory, memoryOffset);
}
}
VkResult::ErrorInitializationFailed
}