extended loader + lib
This commit is contained in:
parent
170aa92a03
commit
395c744601
3 changed files with 825 additions and 112 deletions
|
@ -8,80 +8,258 @@ use std::mem;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::os::raw::*;
|
use std::os::raw::*;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
use std::path::Path;
|
||||||
use vk_loader2 as vk;
|
use vk_loader2 as vk;
|
||||||
// use feature;
|
// use feature;
|
||||||
use load;
|
use load;
|
||||||
|
use shared_library::dynamic_library::DynamicLibrary;
|
||||||
|
type VkResult<T> = Result<T, vk::Result>;
|
||||||
// use fence;
|
// use fence;
|
||||||
// use extensions::*;
|
// use extensions::*;
|
||||||
// use surface;
|
// use surface;
|
||||||
// use device::*;
|
// use device::*;
|
||||||
|
|
||||||
#[derive(Debug)]
|
// macro_rules! vk_error(
|
||||||
pub struct Instance {
|
// ($err_name: ident, $($raw_name: ident => $name: ident,)*) => {
|
||||||
handle: vk::Instance,
|
// #[derive(Debug)]
|
||||||
instance_fn: vk::InstanceFn,
|
// pub enum $err_name {
|
||||||
|
// $(
|
||||||
|
// $name,
|
||||||
|
// )*
|
||||||
|
// }
|
||||||
|
// impl From<vk::Result> for $err_name {
|
||||||
|
// fn from(r: vk::Result) -> $err_name {
|
||||||
|
// match r {
|
||||||
|
// $(
|
||||||
|
// vk::Result::$raw_name => $err_name::$name,
|
||||||
|
// )*
|
||||||
|
// _ => panic!("Missing error case for '{}', please open an issue.", stringify!($err_name)),
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
fn get_path() -> &'static Path {
|
||||||
|
Path::new("vulkan-1.dll")
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! vk_error(
|
#[cfg(all(unix, not(target_os = "android")))]
|
||||||
($err_name: ident, $($raw_name: ident => $name: ident,)*) => {
|
fn get_path() -> &'static Path {
|
||||||
#[derive(Debug)]
|
Path::new("libvulkan.so.1")
|
||||||
pub enum $err_name {
|
}
|
||||||
$(
|
|
||||||
$name,
|
#[cfg(target_os = "android")]
|
||||||
)*
|
fn get_path() -> &'static Path {
|
||||||
}
|
Path::new("libvulkan.so")
|
||||||
impl From<vk::Result> for $err_name {
|
}
|
||||||
fn from(r: vk::Result) -> $err_name {
|
|
||||||
match r {
|
#[derive(Debug)]
|
||||||
$(
|
pub struct Instance<'r> {
|
||||||
vk::Result::$raw_name => $err_name::$name,
|
handle: vk::Instance,
|
||||||
)*
|
instance_fn: vk::InstanceFn,
|
||||||
_ => panic!("Missing error case for '{}', please open an issue.", stringify!($err_name)),
|
_lifetime: ::std::marker::PhantomData<&'r i32>,
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
pub struct Entry {
|
||||||
|
lib: DynamicLibrary,
|
||||||
|
static_fn: vk::Static,
|
||||||
|
entry_fn: vk::EntryFn,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum LoadingError {
|
||||||
|
LibraryLoadFailure(String),
|
||||||
|
StaticLoadError(String),
|
||||||
|
EntryLoadError(String),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Entry {
|
||||||
|
pub fn load_vulkan_path(path: &Path) -> Result<Entry, LoadingError> {
|
||||||
|
let lib = try!(DynamicLibrary::open(Some(path))
|
||||||
|
.map_err(|err| LoadingError::LibraryLoadFailure(err)));
|
||||||
|
let static_fn = try!(vk::Static::load(|name| unsafe {
|
||||||
|
let name = name.to_str().unwrap();
|
||||||
|
let f = match lib.symbol(name) {
|
||||||
|
Ok(s) => s,
|
||||||
|
Err(_) => ptr::null(),
|
||||||
|
};
|
||||||
|
f
|
||||||
|
})
|
||||||
|
.map_err(|err| LoadingError::StaticLoadError(err)));
|
||||||
|
let entry_fn = try!(vk::EntryFn::load(|name| unsafe {
|
||||||
|
mem::transmute(static_fn.get_instance_proc_addr(ptr::null_mut(), name.as_ptr()))
|
||||||
|
})
|
||||||
|
.map_err(|err| LoadingError::EntryLoadError(err)));
|
||||||
|
Ok(Entry {
|
||||||
|
lib: lib,
|
||||||
|
static_fn: static_fn,
|
||||||
|
entry_fn: entry_fn,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
pub fn load_vulkan() -> Result<Entry, LoadingError> {
|
||||||
|
Entry::load_vulkan_path(get_path())
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
|
||||||
vk_error!(
|
|
||||||
InstanceError,
|
|
||||||
ErrorOutOfHostMemory => OutOfHostMemory,
|
|
||||||
ErrorOutOfDeviceMemory => OutOfDeviceMemory,
|
|
||||||
ErrorInitializationFailed => InitializationFailed,
|
|
||||||
ErrorIncompatibleDriver => IncompatibleDriver,
|
|
||||||
);
|
|
||||||
|
|
||||||
vk_error!(
|
pub fn create_instance<I: Into<vk::InstanceCreateInfo>>(&self,
|
||||||
EnumerateDeviceError,
|
i: I)
|
||||||
ErrorOutOfHostMemory => OutOfHostMemory,
|
-> Result<Instance, vk::Result> {
|
||||||
ErrorOutOfDeviceMemory => OutOfDeviceMemory,
|
|
||||||
ErrorInitializationFailed => InitializationFailed,
|
|
||||||
);
|
|
||||||
|
|
||||||
impl Instance {
|
|
||||||
// FIX: Add loading error
|
|
||||||
pub fn create_instance<I: Into<vk::InstanceCreateInfo>>(i: I) -> Result<Instance, vk::Result> {
|
|
||||||
let create_info = i.into();
|
let create_info = i.into();
|
||||||
let static_fn = load::static_fn().unwrap();
|
|
||||||
let entry = load::entry_fn(&static_fn);
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut instance: vk::Instance = mem::uninitialized();
|
let mut instance: vk::Instance = mem::uninitialized();
|
||||||
let err_code = entry.create_instance(&create_info, ptr::null(), &mut instance);
|
let err_code = self.entry_fn.create_instance(&create_info, ptr::null(), &mut instance);
|
||||||
if err_code != vk::Result::Success {
|
if err_code != vk::Result::Success {
|
||||||
return Err(err_code);
|
return Err(err_code);
|
||||||
}
|
}
|
||||||
let instance_fn = vk::InstanceFn::load(|name| unsafe {
|
let instance_fn = vk::InstanceFn::load(|name| unsafe {
|
||||||
mem::transmute(static_fn.get_instance_proc_addr(instance, name.as_ptr()))
|
mem::transmute(self.static_fn.get_instance_proc_addr(instance, name.as_ptr()))
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
Ok(Instance {
|
Ok(Instance {
|
||||||
handle: instance,
|
handle: instance,
|
||||||
instance_fn: instance_fn,
|
instance_fn: instance_fn,
|
||||||
|
_lifetime: ::std::marker::PhantomData,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn enumerate_physical_devices(&self) -> Result<Vec<vk::PhysicalDevice>, vk::Result> {
|
pub fn enumerate_instance_layer_properties(&self)
|
||||||
|
-> Result<Vec<vk::LayerProperties>, vk::Result> {
|
||||||
|
unsafe {
|
||||||
|
let mut num = 0;
|
||||||
|
self.entry_fn.enumerate_instance_layer_properties(&mut num, ptr::null_mut());
|
||||||
|
|
||||||
|
let mut v = Vec::with_capacity(num as usize);
|
||||||
|
let err_code = self.entry_fn
|
||||||
|
.enumerate_instance_layer_properties(&mut num, v.as_mut_ptr());
|
||||||
|
v.set_len(num as usize);
|
||||||
|
match err_code {
|
||||||
|
vk::Result::Success => Ok(v),
|
||||||
|
_ => Err(err_code),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn enumerate_instance_extension_properties
|
||||||
|
(&self)
|
||||||
|
-> Result<Vec<vk::ExtensionProperties>, vk::Result> {
|
||||||
|
unsafe {
|
||||||
|
let mut num = 0;
|
||||||
|
self.entry_fn
|
||||||
|
.enumerate_instance_extension_properties(ptr::null(), &mut num, ptr::null_mut());
|
||||||
|
let mut data = Vec::with_capacity(num as usize);
|
||||||
|
let err_code = self.entry_fn
|
||||||
|
.enumerate_instance_extension_properties(ptr::null(), &mut num, data.as_mut_ptr());
|
||||||
|
data.set_len(num as usize);
|
||||||
|
match err_code {
|
||||||
|
vk::Result::Success => Ok(data),
|
||||||
|
_ => Err(err_code),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Device {
|
||||||
|
handle: vk::Device,
|
||||||
|
device_fn: vk::DeviceFn,
|
||||||
|
}
|
||||||
|
impl Device {
|
||||||
|
pub fn destroy_device(&self) {
|
||||||
|
unsafe {
|
||||||
|
self.device_fn.destroy_device(self.handle, ptr::null());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'r> Instance<'r> {
|
||||||
|
pub fn destroy_instance(&self) {
|
||||||
|
unsafe {
|
||||||
|
self.instance_fn.destroy_instance(self.handle, ptr::null());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn destroy_surface_khr(&self, surface: vk::SurfaceKHR) {
|
||||||
|
unsafe {
|
||||||
|
self.instance_fn.destroy_surface_khr(self.handle, surface, ptr::null());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pub fn create_xlib_surface_khr<I: Into<vk::XlibSurfaceCreateInfoKHR>>
|
||||||
|
(&self,
|
||||||
|
i: I)
|
||||||
|
-> VkResult<vk::SurfaceKHR> {
|
||||||
|
let create_info = i.into();
|
||||||
|
unsafe {
|
||||||
|
let mut surface = mem::uninitialized();
|
||||||
|
let err_code = self.instance_fn
|
||||||
|
.create_xlib_surface_khr(self.handle, &create_info, ptr::null(), &mut surface);
|
||||||
|
match err_code {
|
||||||
|
vk::Result::Success => Ok(surface),
|
||||||
|
_ => Err(err_code),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
pub fn get_physical_device_surface_support_khr(&self,
|
||||||
|
physical_device: vk::PhysicalDevice,
|
||||||
|
queue_index: u32,
|
||||||
|
surface: vk::SurfaceKHR)
|
||||||
|
-> bool {
|
||||||
|
unsafe {
|
||||||
|
let mut b = mem::uninitialized();
|
||||||
|
self.instance_fn
|
||||||
|
.get_physical_device_surface_support_khr(physical_device,
|
||||||
|
queue_index,
|
||||||
|
surface,
|
||||||
|
&mut b);
|
||||||
|
b > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
pub fn get_physical_device_queue_family_properties(&self,
|
||||||
|
physical_device: vk::PhysicalDevice)
|
||||||
|
-> Vec<vk::QueueFamilyProperties> {
|
||||||
|
unsafe {
|
||||||
|
let mut queue_count = 0;
|
||||||
|
self.instance_fn
|
||||||
|
.get_physical_device_queue_family_properties(physical_device,
|
||||||
|
&mut queue_count,
|
||||||
|
ptr::null_mut());
|
||||||
|
let mut queue_families_vec = Vec::with_capacity(queue_count as usize);
|
||||||
|
let err_code = self.instance_fn
|
||||||
|
.get_physical_device_queue_family_properties(physical_device,
|
||||||
|
&mut queue_count,
|
||||||
|
queue_families_vec.as_mut_ptr());
|
||||||
|
queue_families_vec.set_len(queue_count as usize);
|
||||||
|
queue_families_vec
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn create_device<I: Into<vk::DeviceCreateInfo>>(&self,
|
||||||
|
physical_device: vk::PhysicalDevice,
|
||||||
|
i: I)
|
||||||
|
-> VkResult<Device> {
|
||||||
|
let create_info = i.into();
|
||||||
|
unsafe {
|
||||||
|
let mut device = mem::uninitialized();
|
||||||
|
let err_code = self.instance_fn
|
||||||
|
.create_device(physical_device, &create_info, ptr::null(), &mut device);
|
||||||
|
if err_code != vk::Result::Success {
|
||||||
|
return Err(err_code);
|
||||||
|
}
|
||||||
|
let device_fn = vk::DeviceFn::load(|name| unsafe {
|
||||||
|
mem::transmute(self.instance_fn.get_device_proc_addr(device, name.as_ptr()))
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
Ok(Device {
|
||||||
|
handle: device,
|
||||||
|
device_fn: device_fn,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn enumerate_physical_devices(&self) -> VkResult<Vec<vk::PhysicalDevice>> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut num = mem::uninitialized();
|
let mut num = mem::uninitialized();
|
||||||
self.instance_fn
|
self.instance_fn
|
||||||
|
@ -96,19 +274,6 @@ impl Instance {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn enumerate_instance_layer_properties() -> Vec<vk::LayerProperties> {
|
|
||||||
let static_fn = load::static_fn().unwrap();
|
|
||||||
let entry = load::entry_fn(&static_fn);
|
|
||||||
unsafe {
|
|
||||||
let mut num = 0;
|
|
||||||
entry.enumerate_instance_layer_properties(&mut num, ptr::null_mut());
|
|
||||||
|
|
||||||
let mut v = Vec::with_capacity(num as usize);
|
|
||||||
entry.enumerate_instance_layer_properties(&mut num, v.as_mut_ptr());
|
|
||||||
v.set_len(num as usize);
|
|
||||||
v
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn enumerate_device_extension_properties
|
pub fn enumerate_device_extension_properties
|
||||||
(&self,
|
(&self,
|
||||||
|
|
|
@ -5,16 +5,45 @@ extern crate ash;
|
||||||
extern crate vk_loader2 as vk;
|
extern crate vk_loader2 as vk;
|
||||||
extern crate glfw;
|
extern crate glfw;
|
||||||
|
|
||||||
use ash::instance::Instance;
|
use glfw::*;
|
||||||
|
use ash::instance::{Entry, Instance};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::ffi::{CStr, CString};
|
use std::ffi::{CStr, CString};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
use std::path::Path;
|
||||||
|
use std::os::raw::c_void;
|
||||||
|
|
||||||
|
fn handle_window_event(window: &mut glfw::Window, event: glfw::WindowEvent) {
|
||||||
|
match event {
|
||||||
|
glfw::WindowEvent::Key(Key::Escape, _, Action::Press, _) => window.set_should_close(true),
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
fn main() {
|
fn main() {
|
||||||
|
let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap();
|
||||||
|
|
||||||
|
let (mut window, events) = glfw.create_window(1920,
|
||||||
|
1080,
|
||||||
|
"Hello this is window",
|
||||||
|
glfw::WindowMode::Windowed)
|
||||||
|
.expect("Failed to create GLFW window.");
|
||||||
|
|
||||||
|
window.set_key_polling(true);
|
||||||
|
window.make_current();
|
||||||
|
let entry = Entry::load_vulkan().unwrap();
|
||||||
|
let instance_ext_props = entry.enumerate_instance_extension_properties().unwrap();
|
||||||
|
println!("{:?}", instance_ext_props);
|
||||||
let app_name = CString::new("TEST").unwrap();
|
let app_name = CString::new("TEST").unwrap();
|
||||||
let raw_name = app_name.as_ptr();
|
let raw_name = app_name.as_ptr();
|
||||||
let lunarg_layer = CString::new("VK_LAYER_LUNARG_standard_validation").unwrap();
|
let lunarg_layer = CString::new("VK_LAYER_LUNARG_standard_validation").unwrap();
|
||||||
let layers = [lunarg_layer.as_ptr()];
|
let layers = [lunarg_layer.as_ptr()];
|
||||||
|
let swapchain_ext_name = CString::new("VK_KHR_swapchain").unwrap();
|
||||||
|
let surface_ext_name = CString::new("VK_KHR_surface").unwrap();
|
||||||
|
let surface_xlib_ext_name = CString::new("VK_KHR_xlib_surface").unwrap();
|
||||||
|
let extensions = [// swapchain_ext_name.as_ptr(),
|
||||||
|
surface_ext_name.as_ptr(),
|
||||||
|
surface_xlib_ext_name.as_ptr()];
|
||||||
|
let tt = [vk::VK_KHR_SURFACE_EXTENSION_NAME];
|
||||||
let appinfo = vk::ApplicationInfo {
|
let appinfo = vk::ApplicationInfo {
|
||||||
p_application_name: raw_name,
|
p_application_name: raw_name,
|
||||||
s_type: vk::StructureType::ApplicationInfo,
|
s_type: vk::StructureType::ApplicationInfo,
|
||||||
|
@ -30,17 +59,56 @@ fn main() {
|
||||||
p_next: ptr::null(),
|
p_next: ptr::null(),
|
||||||
pp_enabled_layer_names: layers.as_ptr(),
|
pp_enabled_layer_names: layers.as_ptr(),
|
||||||
enabled_layer_count: layers.len() as u32,
|
enabled_layer_count: layers.len() as u32,
|
||||||
pp_enabled_extension_names: ptr::null(),
|
pp_enabled_extension_names: extensions.as_ptr(),
|
||||||
enabled_extension_count: 0,
|
enabled_extension_count: extensions.len() as u32,
|
||||||
flags: 0,
|
flags: 0,
|
||||||
};
|
};
|
||||||
let instance = Instance::create_instance(create_info).expect("Instance creation error");
|
let instance = entry.create_instance(create_info).expect("Instance creation error");
|
||||||
println!("{:?}", instance);
|
let x11_display = window.glfw.get_x11_display();
|
||||||
|
let x11_window = window.get_x11_window();
|
||||||
|
let x11_create_info = vk::XlibSurfaceCreateInfoKHR {
|
||||||
|
s_type: vk::StructureType::XlibSurfaceCreateInfoKhr,
|
||||||
|
p_next: ptr::null(),
|
||||||
|
flags: 0,
|
||||||
|
window: x11_window as vk::Window,
|
||||||
|
dpy: x11_display as *mut vk::Display,
|
||||||
|
};
|
||||||
|
let surface = instance.create_xlib_surface_khr(x11_create_info).unwrap();
|
||||||
let pdevices = instance.enumerate_physical_devices().expect("Physical device error");
|
let pdevices = instance.enumerate_physical_devices().expect("Physical device error");
|
||||||
println!("{:?}", pdevices);
|
let pdevice = pdevices[0];
|
||||||
let ext_props = instance.enumerate_device_extension_properties(pdevices[0])
|
let pdevice_info = instance.get_physical_device_queue_family_properties(pdevice);
|
||||||
.expect("Enumerate device error");
|
let (queue_family_index, _) = pdevice_info.iter()
|
||||||
println!("{:?}", ext_props);
|
.enumerate()
|
||||||
|
.filter(|&(index, ref info)| info.queue_flags.subset(vk::QUEUE_GRAPHICS_BIT))
|
||||||
|
.nth(0)
|
||||||
|
.expect("Could not find any suitable queue");
|
||||||
|
println!("{:?}", pdevice_info);
|
||||||
|
let priorities = [1.0];
|
||||||
|
let queue_info = vk::DeviceQueueCreateInfo {
|
||||||
|
s_type: vk::StructureType::DeviceQueueCreateInfo,
|
||||||
|
p_next: ptr::null(),
|
||||||
|
flags: 0,
|
||||||
|
queue_family_index: queue_family_index as u32,
|
||||||
|
p_queue_priorities: priorities.as_ptr(),
|
||||||
|
queue_count: priorities.len() as u32,
|
||||||
|
};
|
||||||
|
let device_create_info = vk::DeviceCreateInfo {
|
||||||
|
s_type: vk::StructureType::DeviceCreateInfo,
|
||||||
|
p_next: ptr::null(),
|
||||||
|
flags: 0,
|
||||||
|
queue_create_info_count: 1,
|
||||||
|
p_queue_create_infos: &queue_info,
|
||||||
|
enabled_layer_count: 0,
|
||||||
|
pp_enabled_layer_names: ptr::null(),
|
||||||
|
enabled_extension_count: 0,
|
||||||
|
pp_enabled_extension_names: ptr::null(),
|
||||||
|
p_enabled_features: ptr::null(),
|
||||||
|
};
|
||||||
|
let device = instance.create_device(pdevices[0], device_create_info).unwrap();
|
||||||
|
|
||||||
|
device.destroy_device();
|
||||||
|
instance.destroy_surface_khr(surface);
|
||||||
|
instance.destroy_instance();
|
||||||
}
|
}
|
||||||
// use ash::instance::*;
|
// use ash::instance::*;
|
||||||
// use vk_loader as vk;
|
// use vk_loader as vk;
|
||||||
|
|
|
@ -203,6 +203,19 @@ pub type uint64_t = u64;
|
||||||
pub type uint8_t = u8;
|
pub type uint8_t = u8;
|
||||||
pub type c_float = f32;
|
pub type c_float = f32;
|
||||||
pub type int32_t = i32;
|
pub type int32_t = i32;
|
||||||
|
pub type Display = *const ();
|
||||||
|
pub type Window = *const ();
|
||||||
|
pub type VisualID = *const ();
|
||||||
|
pub type xcb_connection_t = *const ();
|
||||||
|
pub type xcb_window_t = *const ();
|
||||||
|
pub type xcb_visualid_t = *const ();
|
||||||
|
pub type MirConnection = *const ();
|
||||||
|
pub type MirSurface = *const ();
|
||||||
|
pub type HINSTANCE = *const ();
|
||||||
|
pub type HWND = *const ();
|
||||||
|
pub type ANativeWindow = *const ();
|
||||||
|
pub type wl_display = *const ();
|
||||||
|
pub type wl_surface = *const ();
|
||||||
|
|
||||||
pub type InstanceCreateFlags = Flags;
|
pub type InstanceCreateFlags = Flags;
|
||||||
pub type Flags = uint32_t;
|
pub type Flags = uint32_t;
|
||||||
|
@ -236,6 +249,15 @@ pub type DescriptorPoolResetFlags = Flags;
|
||||||
pub type FramebufferCreateFlags = Flags;
|
pub type FramebufferCreateFlags = Flags;
|
||||||
pub type RenderPassCreateFlags = Flags;
|
pub type RenderPassCreateFlags = Flags;
|
||||||
pub type SubpassDescriptionFlags = Flags;
|
pub type SubpassDescriptionFlags = Flags;
|
||||||
|
pub type XlibSurfaceCreateFlagsKHR = Flags;
|
||||||
|
pub type XcbSurfaceCreateFlagsKHR = Flags;
|
||||||
|
pub type MirSurfaceCreateFlagsKHR = Flags;
|
||||||
|
pub type Win32SurfaceCreateFlagsKHR = Flags;
|
||||||
|
pub type AndroidSurfaceCreateFlagsKHR = Flags;
|
||||||
|
pub type WaylandSurfaceCreateFlagsKHR = Flags;
|
||||||
|
pub type SwapchainCreateFlagsKHR = Flags;
|
||||||
|
pub type DisplayModeCreateFlagsKHR = Flags;
|
||||||
|
pub type DisplaySurfaceCreateFlagsKHR = Flags;
|
||||||
|
|
||||||
pub const VK_MAX_PHYSICAL_DEVICE_NAME_SIZE: size_t = 256;
|
pub const VK_MAX_PHYSICAL_DEVICE_NAME_SIZE: size_t = 256;
|
||||||
pub const VK_UUID_SIZE: size_t = 16;
|
pub const VK_UUID_SIZE: size_t = 16;
|
||||||
|
@ -254,6 +276,26 @@ pub const VK_QUEUE_FAMILY_IGNORED: uint32_t = !0;
|
||||||
pub const VK_SUBPASS_EXTERNAL: uint32_t = !0;
|
pub const VK_SUBPASS_EXTERNAL: uint32_t = !0;
|
||||||
pub const VK_KHR_SURFACE_SPEC_VERSION: uint32_t = 25;
|
pub const VK_KHR_SURFACE_SPEC_VERSION: uint32_t = 25;
|
||||||
pub const VK_KHR_SURFACE_EXTENSION_NAME: &'static str = "VK_KHR_surface";
|
pub const VK_KHR_SURFACE_EXTENSION_NAME: &'static str = "VK_KHR_surface";
|
||||||
|
pub const VK_KHR_XLIB_SURFACE_SPEC_VERSION: uint32_t = 6;
|
||||||
|
pub const VK_KHR_XLIB_SURFACE_EXTENSION_NAME: &'static str = "VK_KHR_xlib_surface";
|
||||||
|
pub const VK_KHR_XCB_SURFACE_SPEC_VERSION: uint32_t = 6;
|
||||||
|
pub const VK_KHR_XCB_SURFACE_EXTENSION_NAME: &'static str = "VK_KHR_xcb_surface";
|
||||||
|
pub const VK_KHR_MIR_SURFACE_SPEC_VERSION: uint32_t = 4;
|
||||||
|
pub const VK_KHR_MIR_SURFACE_EXTENSION_NAME: &'static str = "VK_KHR_mir_surface";
|
||||||
|
pub const VK_KHR_WIN32_SURFACE_SPEC_VERSION: uint32_t = 5;
|
||||||
|
pub const VK_KHR_WIN32_SURFACE_EXTENSION_NAME: &'static str = "VK_KHR_win32_surface";
|
||||||
|
pub const VK_KHR_ANDROID_SURFACE_SPEC_VERSION: uint32_t = 6;
|
||||||
|
pub const VK_KHR_ANDROID_SURFACE_EXTENSION_NAME: &'static str = "VK_KHR_android_surface";
|
||||||
|
pub const VK_KHR_WAYLAND_SURFACE_SPEC_VERSION: uint32_t = 5;
|
||||||
|
pub const VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME: &'static str = "VK_KHR_wayland_surface";
|
||||||
|
pub const VK_KHR_SWAPCHAIN_SPEC_VERSION: uint32_t = 68;
|
||||||
|
pub const VK_KHR_SWAPCHAIN_EXTENSION_NAME: &'static str = "VK_KHR_swapchain";
|
||||||
|
pub const VK_KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION: uint32_t = 9;
|
||||||
|
pub const VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME: &'static str = "VK_KHR_display_swapchain";
|
||||||
|
pub const VK_KHR_DISPLAY_SPEC_VERSION: uint32_t = 21;
|
||||||
|
pub const VK_KHR_DISPLAY_EXTENSION_NAME: &'static str = "VK_KHR_display";
|
||||||
|
pub const VK_EXT_DEBUG_REPORT_SPEC_VERSION: uint32_t = 3;
|
||||||
|
pub const VK_EXT_DEBUG_REPORT_EXTENSION_NAME: &'static str = "VK_EXT_debug_report";
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -2069,6 +2111,215 @@ pub struct SurfaceFormatKHR {
|
||||||
pub color_space: ColorSpaceKHR,
|
pub color_space: ColorSpaceKHR,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct XlibSurfaceCreateInfoKHR {
|
||||||
|
pub s_type: StructureType,
|
||||||
|
pub p_next: *const c_void,
|
||||||
|
pub flags: XlibSurfaceCreateFlagsKHR,
|
||||||
|
pub dpy: *mut Display,
|
||||||
|
pub window: Window,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct XcbSurfaceCreateInfoKHR {
|
||||||
|
pub s_type: StructureType,
|
||||||
|
pub p_next: *const c_void,
|
||||||
|
pub flags: XcbSurfaceCreateFlagsKHR,
|
||||||
|
pub connection: *mut xcb_connection_t,
|
||||||
|
pub window: xcb_window_t,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct MirSurfaceCreateInfoKHR {
|
||||||
|
pub s_type: StructureType,
|
||||||
|
pub p_next: *const c_void,
|
||||||
|
pub flags: MirSurfaceCreateFlagsKHR,
|
||||||
|
pub connection: *mut MirConnection,
|
||||||
|
pub mir_surface: *mut MirSurface,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct Win32SurfaceCreateInfoKHR {
|
||||||
|
pub s_type: StructureType,
|
||||||
|
pub p_next: *const c_void,
|
||||||
|
pub flags: Win32SurfaceCreateFlagsKHR,
|
||||||
|
pub hinstance: HINSTANCE,
|
||||||
|
pub hwnd: HWND,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct AndroidSurfaceCreateInfoKHR {
|
||||||
|
pub s_type: StructureType,
|
||||||
|
pub p_next: *const c_void,
|
||||||
|
pub flags: AndroidSurfaceCreateFlagsKHR,
|
||||||
|
pub window: *mut ANativeWindow,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct WaylandSurfaceCreateInfoKHR {
|
||||||
|
pub s_type: StructureType,
|
||||||
|
pub p_next: *const c_void,
|
||||||
|
pub flags: WaylandSurfaceCreateFlagsKHR,
|
||||||
|
pub display: *mut wl_display,
|
||||||
|
pub surface: *mut wl_surface,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct SwapchainCreateInfoKHR {
|
||||||
|
pub s_type: StructureType,
|
||||||
|
pub p_next: *const c_void,
|
||||||
|
pub flags: SwapchainCreateFlagsKHR,
|
||||||
|
pub surface: SurfaceKHR,
|
||||||
|
pub min_image_count: uint32_t,
|
||||||
|
pub image_format: Format,
|
||||||
|
pub image_color_space: ColorSpaceKHR,
|
||||||
|
pub image_extent: Extent2D,
|
||||||
|
pub image_array_layers: uint32_t,
|
||||||
|
pub image_usage: ImageUsageFlags,
|
||||||
|
pub image_sharing_mode: SharingMode,
|
||||||
|
pub queue_family_index_count: uint32_t,
|
||||||
|
pub p_queue_family_indices: *const uint32_t,
|
||||||
|
pub pre_transform: SurfaceTransformFlagsKHR,
|
||||||
|
pub composite_alpha: CompositeAlphaFlagsKHR,
|
||||||
|
pub present_mode: PresentModeKHR,
|
||||||
|
pub clipped: Bool32,
|
||||||
|
pub old_swapchain: SwapchainKHR,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct PresentInfoKHR {
|
||||||
|
pub s_type: StructureType,
|
||||||
|
pub p_next: *const c_void,
|
||||||
|
pub wait_semaphore_count: uint32_t,
|
||||||
|
pub p_wait_semaphores: *const Semaphore,
|
||||||
|
pub swapchain_count: uint32_t,
|
||||||
|
pub p_swapchains: *const SwapchainKHR,
|
||||||
|
pub p_image_indices: *const uint32_t,
|
||||||
|
pub p_results: *mut Result,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct DisplayPresentInfoKHR {
|
||||||
|
pub s_type: StructureType,
|
||||||
|
pub p_next: *const c_void,
|
||||||
|
pub src_rect: Rect2D,
|
||||||
|
pub dst_rect: Rect2D,
|
||||||
|
pub persistent: Bool32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct DisplayPropertiesKHR {
|
||||||
|
pub display: DisplayKHR,
|
||||||
|
pub display_name: *const c_char,
|
||||||
|
pub physical_dimensions: Extent2D,
|
||||||
|
pub physical_resolution: Extent2D,
|
||||||
|
pub supported_transforms: SurfaceTransformFlagsKHR,
|
||||||
|
pub plane_reorder_possible: Bool32,
|
||||||
|
pub persistent_content: Bool32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct DisplayModeParametersKHR {
|
||||||
|
pub visible_region: Extent2D,
|
||||||
|
pub refresh_rate: uint32_t,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct DisplayModePropertiesKHR {
|
||||||
|
pub display_mode: DisplayModeKHR,
|
||||||
|
pub parameters: DisplayModeParametersKHR,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct DisplayModeCreateInfoKHR {
|
||||||
|
pub s_type: StructureType,
|
||||||
|
pub p_next: *const c_void,
|
||||||
|
pub flags: DisplayModeCreateFlagsKHR,
|
||||||
|
pub parameters: DisplayModeParametersKHR,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct DisplayPlaneCapabilitiesKHR {
|
||||||
|
pub supported_alpha: DisplayPlaneAlphaFlagsKHR,
|
||||||
|
pub min_src_position: Offset2D,
|
||||||
|
pub max_src_position: Offset2D,
|
||||||
|
pub min_src_extent: Extent2D,
|
||||||
|
pub max_src_extent: Extent2D,
|
||||||
|
pub min_dst_position: Offset2D,
|
||||||
|
pub max_dst_position: Offset2D,
|
||||||
|
pub min_dst_extent: Extent2D,
|
||||||
|
pub max_dst_extent: Extent2D,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct DisplayPlanePropertiesKHR {
|
||||||
|
pub current_display: DisplayKHR,
|
||||||
|
pub current_stack_index: uint32_t,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct DisplaySurfaceCreateInfoKHR {
|
||||||
|
pub s_type: StructureType,
|
||||||
|
pub p_next: *const c_void,
|
||||||
|
pub flags: DisplaySurfaceCreateFlagsKHR,
|
||||||
|
pub display_mode: DisplayModeKHR,
|
||||||
|
pub plane_index: uint32_t,
|
||||||
|
pub plane_stack_index: uint32_t,
|
||||||
|
pub transform: SurfaceTransformFlagsKHR,
|
||||||
|
pub global_alpha: c_float,
|
||||||
|
pub alpha_mode: DisplayPlaneAlphaFlagsKHR,
|
||||||
|
pub image_extent: Extent2D,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct DebugReportCallbackCreateInfoEXT {
|
||||||
|
pub s_type: StructureType,
|
||||||
|
pub p_next: *const c_void,
|
||||||
|
pub flags: DebugReportFlagsEXT,
|
||||||
|
pub pfn_callback: PFN_vkDebugReportCallbackEXT,
|
||||||
|
pub p_user_data: *mut c_void,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Clone for DebugReportCallbackCreateInfoEXT {
|
||||||
|
fn clone(&self) -> DebugReportCallbackCreateInfoEXT {
|
||||||
|
DebugReportCallbackCreateInfoEXT {
|
||||||
|
s_type: self.s_type.clone(),
|
||||||
|
p_next: self.p_next.clone(),
|
||||||
|
flags: self.flags.clone(),
|
||||||
|
pfn_callback: self.pfn_callback,
|
||||||
|
p_user_data: self.p_user_data.clone(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Debug for DebugReportCallbackCreateInfoEXT {
|
||||||
|
fn fmt(&self, fmt: &mut fmt::Formatter) -> ::std::result::Result<(), fmt::Error> {
|
||||||
|
fmt.debug_struct("DebugReportCallbackCreateInfoEXT")
|
||||||
|
.field("s_type", &self.s_type)
|
||||||
|
.field("p_next", &self.p_next)
|
||||||
|
.field("flags", &self.flags)
|
||||||
|
.field("pfn_callback", &(self.pfn_callback as *const ()))
|
||||||
|
.field("p_user_data", &self.p_user_data)
|
||||||
|
.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Temporary Hard-Coded union hack; will be automatically generated when actual unions become stable
|
/// Temporary Hard-Coded union hack; will be automatically generated when actual unions become stable
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -2242,6 +2493,18 @@ pub enum StructureType {
|
||||||
MemoryBarrier = 46,
|
MemoryBarrier = 46,
|
||||||
LoaderInstanceCreateInfo = 47,
|
LoaderInstanceCreateInfo = 47,
|
||||||
LoaderDeviceCreateInfo = 48,
|
LoaderDeviceCreateInfo = 48,
|
||||||
|
XlibSurfaceCreateInfoKhr = 1000004000,
|
||||||
|
XcbSurfaceCreateInfoKhr = 1000005000,
|
||||||
|
MirSurfaceCreateInfoKhr = 1000007000,
|
||||||
|
Win32SurfaceCreateInfoKhr = 1000009000,
|
||||||
|
AndroidSurfaceCreateInfoKhr = 1000008000,
|
||||||
|
WaylandSurfaceCreateInfoKhr = 1000006000,
|
||||||
|
SwapchainCreateInfoKhr = 1000001000,
|
||||||
|
PresentInfoKhr = 1000001001,
|
||||||
|
DisplayPresentInfoKhr = 1000003000,
|
||||||
|
DisplayModeCreateInfoKhr = 1000002000,
|
||||||
|
DisplaySurfaceCreateInfoKhr = 1000002001,
|
||||||
|
DebugReportCallbackCreateInfoExt = 1000011000,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -2283,6 +2546,10 @@ pub enum Result {
|
||||||
ErrorFragmentedPool = -12,
|
ErrorFragmentedPool = -12,
|
||||||
ErrorSurfaceLostKhr = -1000000000,
|
ErrorSurfaceLostKhr = -1000000000,
|
||||||
ErrorNativeWindowInUseKhr = -1000000001,
|
ErrorNativeWindowInUseKhr = -1000000001,
|
||||||
|
SuboptimalKhr = 1000001003,
|
||||||
|
ErrorOutOfDateKhr = -1000001004,
|
||||||
|
ErrorIncompatibleDisplayKhr = -1000003001,
|
||||||
|
ErrorValidationFailedExt = -1000011001,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -2527,6 +2794,7 @@ pub enum ImageLayout {
|
||||||
TransferSrcOptimal = 6,
|
TransferSrcOptimal = 6,
|
||||||
TransferDstOptimal = 7,
|
TransferDstOptimal = 7,
|
||||||
Preinitialized = 8,
|
Preinitialized = 8,
|
||||||
|
PresentSrcKhr = 1000001002,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -2794,6 +3062,47 @@ pub enum PresentModeKHR {
|
||||||
FifoRelaxed = 3,
|
FifoRelaxed = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
|
pub enum DebugReportObjectTypeEXT {
|
||||||
|
Unknown = 0,
|
||||||
|
Instance = 1,
|
||||||
|
PhysicalDevice = 2,
|
||||||
|
Device = 3,
|
||||||
|
Queue = 4,
|
||||||
|
Semaphore = 5,
|
||||||
|
CommandBuffer = 6,
|
||||||
|
Fence = 7,
|
||||||
|
DeviceMemory = 8,
|
||||||
|
Buffer = 9,
|
||||||
|
Image = 10,
|
||||||
|
Ent = 11,
|
||||||
|
QueryPool = 12,
|
||||||
|
BufferView = 13,
|
||||||
|
ImageView = 14,
|
||||||
|
ShaderModule = 15,
|
||||||
|
PipelineCache = 16,
|
||||||
|
PipelineLayout = 17,
|
||||||
|
RenderPass = 18,
|
||||||
|
Pipeline = 19,
|
||||||
|
DescriptorSetLayout = 20,
|
||||||
|
Sampler = 21,
|
||||||
|
DescriptorPool = 22,
|
||||||
|
DescriptorSet = 23,
|
||||||
|
Framebuffer = 24,
|
||||||
|
CommandPool = 25,
|
||||||
|
SurfaceKhr = 26,
|
||||||
|
SwapchainKhr = 27,
|
||||||
|
DebugReport = 28,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
|
pub enum DebugReportErrorEXT {
|
||||||
|
None = 0,
|
||||||
|
CallbackRef = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
@ -2846,6 +3155,10 @@ handle_nondispatchable!(DescriptorSet);
|
||||||
handle_nondispatchable!(Framebuffer);
|
handle_nondispatchable!(Framebuffer);
|
||||||
handle_nondispatchable!(CommandPool);
|
handle_nondispatchable!(CommandPool);
|
||||||
handle_nondispatchable!(SurfaceKHR);
|
handle_nondispatchable!(SurfaceKHR);
|
||||||
|
handle_nondispatchable!(SwapchainKHR);
|
||||||
|
handle_nondispatchable!(DisplayKHR);
|
||||||
|
handle_nondispatchable!(DisplayModeKHR);
|
||||||
|
handle_nondispatchable!(DebugReportCallbackEXT);
|
||||||
|
|
||||||
pub const FORMAT_FEATURE_SAMPLED_IMAGE_BIT: FormatFeatureFlags = FormatFeatureFlags {flags: 0b1};
|
pub const FORMAT_FEATURE_SAMPLED_IMAGE_BIT: FormatFeatureFlags = FormatFeatureFlags {flags: 0b1};
|
||||||
pub const FORMAT_FEATURE_STORAGE_IMAGE_BIT: FormatFeatureFlags = FormatFeatureFlags {flags: 0b10};
|
pub const FORMAT_FEATURE_STORAGE_IMAGE_BIT: FormatFeatureFlags = FormatFeatureFlags {flags: 0b10};
|
||||||
|
@ -3070,6 +3383,19 @@ pub const COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR: CompositeAlphaFlagsKHR = Comp
|
||||||
pub const COMPOSITE_ALPHA_INHERIT_BIT_KHR: CompositeAlphaFlagsKHR = CompositeAlphaFlagsKHR {flags: 0b1000};
|
pub const COMPOSITE_ALPHA_INHERIT_BIT_KHR: CompositeAlphaFlagsKHR = CompositeAlphaFlagsKHR {flags: 0b1000};
|
||||||
vk_bitflags_wrapped!(CompositeAlphaFlagsKHR, 0b1111, Flags);
|
vk_bitflags_wrapped!(CompositeAlphaFlagsKHR, 0b1111, Flags);
|
||||||
|
|
||||||
|
pub const DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR: DisplayPlaneAlphaFlagsKHR = DisplayPlaneAlphaFlagsKHR {flags: 0b1};
|
||||||
|
pub const DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR: DisplayPlaneAlphaFlagsKHR = DisplayPlaneAlphaFlagsKHR {flags: 0b10};
|
||||||
|
pub const DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR: DisplayPlaneAlphaFlagsKHR = DisplayPlaneAlphaFlagsKHR {flags: 0b100};
|
||||||
|
pub const DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR: DisplayPlaneAlphaFlagsKHR = DisplayPlaneAlphaFlagsKHR {flags: 0b1000};
|
||||||
|
vk_bitflags_wrapped!(DisplayPlaneAlphaFlagsKHR, 0b1111, Flags);
|
||||||
|
|
||||||
|
pub const DEBUG_REPORT_INFORMATION_BIT_EXT: DebugReportFlagsEXT = DebugReportFlagsEXT {flags: 0b1};
|
||||||
|
pub const DEBUG_REPORT_WARNING_BIT_EXT: DebugReportFlagsEXT = DebugReportFlagsEXT {flags: 0b10};
|
||||||
|
pub const DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT: DebugReportFlagsEXT = DebugReportFlagsEXT {flags: 0b100};
|
||||||
|
pub const DEBUG_REPORT_ERROR_BIT_EXT: DebugReportFlagsEXT = DebugReportFlagsEXT {flags: 0b1000};
|
||||||
|
pub const DEBUG_REPORT_DEBUG_BIT_EXT: DebugReportFlagsEXT = DebugReportFlagsEXT {flags: 0b10000};
|
||||||
|
vk_bitflags_wrapped!(DebugReportFlagsEXT, 0b11111, Flags);
|
||||||
|
|
||||||
|
|
||||||
pub type PFN_vkAllocationFunction = unsafe extern "system" fn(
|
pub type PFN_vkAllocationFunction = unsafe extern "system" fn(
|
||||||
*mut c_void,
|
*mut c_void,
|
||||||
|
@ -3108,6 +3434,18 @@ pub type PFN_vkInternalFreeNotification = unsafe extern "system" fn(
|
||||||
pub type PFN_vkVoidFunction = unsafe extern "system" fn(
|
pub type PFN_vkVoidFunction = unsafe extern "system" fn(
|
||||||
);
|
);
|
||||||
|
|
||||||
|
pub type PFN_vkDebugReportCallbackEXT = unsafe extern "system" fn(
|
||||||
|
DebugReportFlagsEXT,
|
||||||
|
DebugReportObjectTypeEXT,
|
||||||
|
uint64_t,
|
||||||
|
size_t,
|
||||||
|
int32_t,
|
||||||
|
*const c_char,
|
||||||
|
*const c_char,
|
||||||
|
*mut c_void,
|
||||||
|
) -> Bool32;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//FIX: Need better error handling for extensions
|
//FIX: Need better error handling for extensions
|
||||||
macro_rules! vk_functions {
|
macro_rules! vk_functions {
|
||||||
|
@ -3165,51 +3503,6 @@ macro_rules! vk_functions {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//$(
|
|
||||||
// pub unsafe extern "system" fn $name (
|
|
||||||
// $($param_name: $param),*
|
|
||||||
// ) -> $ret {
|
|
||||||
// use std::mem;
|
|
||||||
|
|
||||||
// mem::transmute::<_, $name::FnType>($name::fn_ptr)($($param_name),*)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pub mod $name {
|
|
||||||
|
|
||||||
// use super::super::*;
|
|
||||||
// #[allow(unused_imports)]
|
|
||||||
// use super::super::libc_reexports::*;
|
|
||||||
// pub const RAW_NAME: &'static str = $raw_name;
|
|
||||||
// pub static mut fn_ptr: *const () = unloaded_function_panic as *const ();
|
|
||||||
// #[doc(hidden)]
|
|
||||||
// pub type FnType = unsafe extern "system" fn($($param),*) -> $ret;
|
|
||||||
|
|
||||||
// pub fn is_loaded() -> bool {
|
|
||||||
// unsafe{ fn_ptr == unloaded_function_panic as *const () }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//)+
|
|
||||||
|
|
||||||
//pub fn load_with<F: FnMut(&str) -> *const ()>(mut load_fn: F) -> ::std::result::Result<(), Vec<&'static str>> {unsafe{
|
|
||||||
// use std::ptr;
|
|
||||||
// let mut fn_buf: *const ();
|
|
||||||
// let mut unloaded_fns = Vec::new();
|
|
||||||
|
|
||||||
// $(
|
|
||||||
// fn_buf = load_fn($raw_name);
|
|
||||||
// if ptr::null() != fn_buf {
|
|
||||||
// $name::fn_ptr = fn_buf;
|
|
||||||
// } else if $name::fn_ptr != unloaded_function_panic as *const () {
|
|
||||||
// unloaded_fns.push($raw_name)
|
|
||||||
// }
|
|
||||||
// )+
|
|
||||||
|
|
||||||
// if 0 == unloaded_fns.len() {
|
|
||||||
// Ok(())
|
|
||||||
// } else {
|
|
||||||
// Err(unloaded_fns)
|
|
||||||
// }
|
|
||||||
//}}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3365,6 +3658,193 @@ vk_functions!{
|
||||||
p_present_mode_count: *mut uint32_t,
|
p_present_mode_count: *mut uint32_t,
|
||||||
p_present_modes: *mut PresentModeKHR,
|
p_present_modes: *mut PresentModeKHR,
|
||||||
) -> Result;
|
) -> Result;
|
||||||
|
|
||||||
|
"vkGetPhysicalDeviceXlibPresentationSupportKHR", get_physical_device_xlib_presentation_support_khr(
|
||||||
|
physical_device: PhysicalDevice,
|
||||||
|
queue_family_index: uint32_t,
|
||||||
|
dpy: *mut Display,
|
||||||
|
visual_id: VisualID,
|
||||||
|
) -> Bool32;
|
||||||
|
|
||||||
|
"vkCreateXlibSurfaceKHR", create_xlib_surface_khr(
|
||||||
|
instance: Instance,
|
||||||
|
p_create_info: *const XlibSurfaceCreateInfoKHR,
|
||||||
|
p_allocator: *const AllocationCallbacks,
|
||||||
|
p_surface: *mut SurfaceKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkCreateXcbSurfaceKHR", create_xcb_surface_khr(
|
||||||
|
instance: Instance,
|
||||||
|
p_create_info: *const XcbSurfaceCreateInfoKHR,
|
||||||
|
p_allocator: *const AllocationCallbacks,
|
||||||
|
p_surface: *mut SurfaceKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkGetPhysicalDeviceXcbPresentationSupportKHR", get_physical_device_xcb_presentation_support_khr(
|
||||||
|
physical_device: PhysicalDevice,
|
||||||
|
queue_family_index: uint32_t,
|
||||||
|
connection: *mut xcb_connection_t,
|
||||||
|
visual_id: xcb_visualid_t,
|
||||||
|
) -> Bool32;
|
||||||
|
|
||||||
|
"vkCreateMirSurfaceKHR", create_mir_surface_khr(
|
||||||
|
instance: Instance,
|
||||||
|
p_create_info: *const MirSurfaceCreateInfoKHR,
|
||||||
|
p_allocator: *const AllocationCallbacks,
|
||||||
|
p_surface: *mut SurfaceKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkGetPhysicalDeviceMirPresentationSupportKHR", get_physical_device_mir_presentation_support_khr(
|
||||||
|
physical_device: PhysicalDevice,
|
||||||
|
queue_family_index: uint32_t,
|
||||||
|
connection: *mut MirConnection,
|
||||||
|
) -> Bool32;
|
||||||
|
|
||||||
|
"vkCreateWin32SurfaceKHR", create_win32_surface_khr(
|
||||||
|
instance: Instance,
|
||||||
|
p_create_info: *const Win32SurfaceCreateInfoKHR,
|
||||||
|
p_allocator: *const AllocationCallbacks,
|
||||||
|
p_surface: *mut SurfaceKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkGetPhysicalDeviceWin32PresentationSupportKHR", get_physical_device_win32_presentation_support_khr(
|
||||||
|
physical_device: PhysicalDevice,
|
||||||
|
queue_family_index: uint32_t,
|
||||||
|
) -> Bool32;
|
||||||
|
|
||||||
|
"vkCreateAndroidSurfaceKHR", create_android_surface_khr(
|
||||||
|
instance: Instance,
|
||||||
|
p_create_info: *const AndroidSurfaceCreateInfoKHR,
|
||||||
|
p_allocator: *const AllocationCallbacks,
|
||||||
|
p_surface: *mut SurfaceKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkCreateWaylandSurfaceKHR", create_wayland_surface_khr(
|
||||||
|
instance: Instance,
|
||||||
|
p_create_info: *const WaylandSurfaceCreateInfoKHR,
|
||||||
|
p_allocator: *const AllocationCallbacks,
|
||||||
|
p_surface: *mut SurfaceKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkGetPhysicalDeviceWaylandPresentationSupportKHR", get_physical_device_wayland_presentation_support_khr(
|
||||||
|
physical_device: PhysicalDevice,
|
||||||
|
queue_family_index: uint32_t,
|
||||||
|
display: *mut wl_display,
|
||||||
|
) -> Bool32;
|
||||||
|
|
||||||
|
"vkCreateSwapchainKHR", create_swapchain_khr(
|
||||||
|
device: Device,
|
||||||
|
p_create_info: *const SwapchainCreateInfoKHR,
|
||||||
|
p_allocator: *const AllocationCallbacks,
|
||||||
|
p_swapchain: *mut SwapchainKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkDestroySwapchainKHR", destroy_swapchain_khr(
|
||||||
|
device: Device,
|
||||||
|
swapchain: SwapchainKHR,
|
||||||
|
p_allocator: *const AllocationCallbacks,
|
||||||
|
) -> ();
|
||||||
|
|
||||||
|
"vkGetSwapchainImagesKHR", get_swapchain_images_khr(
|
||||||
|
device: Device,
|
||||||
|
swapchain: SwapchainKHR,
|
||||||
|
p_swapchain_image_count: *mut uint32_t,
|
||||||
|
p_swapchain_images: *mut Image,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkAcquireNextImageKHR", acquire_next_image_khr(
|
||||||
|
device: Device,
|
||||||
|
swapchain: SwapchainKHR,
|
||||||
|
timeout: uint64_t,
|
||||||
|
semaphore: Semaphore,
|
||||||
|
fence: Fence,
|
||||||
|
p_image_index: *mut uint32_t,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkQueuePresentKHR", queue_present_khr(
|
||||||
|
queue: Queue,
|
||||||
|
p_present_info: *const PresentInfoKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkCreateSharedSwapchainsKHR", create_shared_swapchains_khr(
|
||||||
|
device: Device,
|
||||||
|
swapchain_count: uint32_t,
|
||||||
|
p_create_infos: *const SwapchainCreateInfoKHR,
|
||||||
|
p_allocator: *const AllocationCallbacks,
|
||||||
|
p_swapchains: *mut SwapchainKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkGetPhysicalDeviceDisplayPropertiesKHR", get_physical_device_display_properties_khr(
|
||||||
|
physical_device: PhysicalDevice,
|
||||||
|
p_property_count: *mut uint32_t,
|
||||||
|
p_properties: *mut DisplayPropertiesKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkGetPhysicalDeviceDisplayPlanePropertiesKHR", get_physical_device_display_plane_properties_khr(
|
||||||
|
physical_device: PhysicalDevice,
|
||||||
|
p_property_count: *mut uint32_t,
|
||||||
|
p_properties: *mut DisplayPlanePropertiesKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkGetDisplayPlaneSupportedDisplaysKHR", get_display_plane_supported_displays_khr(
|
||||||
|
physical_device: PhysicalDevice,
|
||||||
|
plane_index: uint32_t,
|
||||||
|
p_display_count: *mut uint32_t,
|
||||||
|
p_displays: *mut DisplayKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkGetDisplayModePropertiesKHR", get_display_mode_properties_khr(
|
||||||
|
physical_device: PhysicalDevice,
|
||||||
|
display: DisplayKHR,
|
||||||
|
p_property_count: *mut uint32_t,
|
||||||
|
p_properties: *mut DisplayModePropertiesKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkCreateDisplayModeKHR", create_display_mode_khr(
|
||||||
|
physical_device: PhysicalDevice,
|
||||||
|
display: DisplayKHR,
|
||||||
|
p_create_info: *const DisplayModeCreateInfoKHR,
|
||||||
|
p_allocator: *const AllocationCallbacks,
|
||||||
|
p_mode: *mut DisplayModeKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkGetDisplayPlaneCapabilitiesKHR", get_display_plane_capabilities_khr(
|
||||||
|
physical_device: PhysicalDevice,
|
||||||
|
mode: DisplayModeKHR,
|
||||||
|
plane_index: uint32_t,
|
||||||
|
p_capabilities: *mut DisplayPlaneCapabilitiesKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkCreateDisplayPlaneSurfaceKHR", create_display_plane_surface_khr(
|
||||||
|
instance: Instance,
|
||||||
|
p_create_info: *const DisplaySurfaceCreateInfoKHR,
|
||||||
|
p_allocator: *const AllocationCallbacks,
|
||||||
|
p_surface: *mut SurfaceKHR,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkCreateDebugReportCallbackEXT", create_debug_report_callback_ext(
|
||||||
|
instance: Instance,
|
||||||
|
p_create_info: *const DebugReportCallbackCreateInfoEXT,
|
||||||
|
p_allocator: *const AllocationCallbacks,
|
||||||
|
p_callback: *mut DebugReportCallbackEXT,
|
||||||
|
) -> Result;
|
||||||
|
|
||||||
|
"vkDestroyDebugReportCallbackEXT", destroy_debug_report_callback_ext(
|
||||||
|
instance: Instance,
|
||||||
|
callback: DebugReportCallbackEXT,
|
||||||
|
p_allocator: *const AllocationCallbacks,
|
||||||
|
) -> ();
|
||||||
|
|
||||||
|
"vkDebugReportMessageEXT", debug_report_message_ext(
|
||||||
|
instance: Instance,
|
||||||
|
flags: DebugReportFlagsEXT,
|
||||||
|
object_type: DebugReportObjectTypeEXT,
|
||||||
|
object: uint64_t,
|
||||||
|
location: size_t,
|
||||||
|
message_code: int32_t,
|
||||||
|
p_layer_prefix: *const c_char,
|
||||||
|
p_message: *const c_char,
|
||||||
|
) -> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
vk_functions!{
|
vk_functions!{
|
||||||
|
|
Loading…
Add table
Reference in a new issue