50 lines
1.7 KiB
Rust
50 lines
1.7 KiB
Rust
#![allow(non_camel_case_types)]
|
|
|
|
use std::{mem, ptr};
|
|
use vulkan_rs::prelude::*;
|
|
|
|
pub use VkLayerFunction::*;
|
|
pub use VkNegotiateLayerStructType::*;
|
|
|
|
#[derive(Clone)]
|
|
pub enum VkNegotiateLayerStructType {
|
|
LAYER_NEGOTIATE_INTERFACE_STRUCT = 1,
|
|
}
|
|
|
|
#[derive(Clone, Copy, Eq, PartialEq)]
|
|
pub enum VkLayerFunction {
|
|
VK_LAYER_LINK_INFO = 0,
|
|
VK_LOADER_DATA_CALLBACK = 1,
|
|
VK_LOADER_LAYER_CREATE_DEVICE_CALLBACK = 2,
|
|
VK_LOADER_FEATURES = 3,
|
|
}
|
|
|
|
pub enum Functions {
|
|
Null,
|
|
CreateInstance(PFN_vkCreateInstance),
|
|
DestroyInstance(PFN_vkDestroyInstance),
|
|
CreateDevice(PFN_vkCreateDevice),
|
|
DestroyDevice(PFN_vkDestroyDevice),
|
|
CreateSwapchain(PFN_vkCreateSwapchainKHR),
|
|
QueueSubmit(PFN_vkQueueSubmit),
|
|
GetDeviceQueue(PFN_vkGetDeviceQueue),
|
|
AcquireNextImageKHR(PFN_vkAcquireNextImageKHR),
|
|
}
|
|
|
|
impl Functions {
|
|
pub fn convert(self) -> PFN_vkVoidFunction {
|
|
match self {
|
|
Functions::Null => unsafe {
|
|
mem::transmute::<*const (), PFN_vkVoidFunction>(ptr::null())
|
|
},
|
|
Functions::CreateInstance(func) => unsafe { mem::transmute(func) },
|
|
Functions::DestroyInstance(func) => unsafe { mem::transmute(func) },
|
|
Functions::CreateDevice(func) => unsafe { mem::transmute(func) },
|
|
Functions::DestroyDevice(func) => unsafe { mem::transmute(func) },
|
|
Functions::CreateSwapchain(func) => unsafe { mem::transmute(func) },
|
|
Functions::QueueSubmit(func) => unsafe { mem::transmute(func) },
|
|
Functions::GetDeviceQueue(func) => unsafe { mem::transmute(func) },
|
|
Functions::AcquireNextImageKHR(func) => unsafe { mem::transmute(func) },
|
|
}
|
|
}
|
|
}
|