Rename the extension functionm pointers

This commit is contained in:
Maik Klein 2018-07-07 12:13:23 +02:00
parent 21e934d5b1
commit ad24467c95
14 changed files with 94 additions and 91 deletions

View file

@ -1,15 +1,15 @@
#![allow(dead_code)] #![allow(dead_code)]
use prelude::*; use prelude::*;
use std::mem;
use vk;
use std::ffi::CStr; use std::ffi::CStr;
use RawPtr; use std::mem;
use version::{EntryV1_0, InstanceV1_0}; use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)] #[derive(Clone)]
pub struct AndroidSurface { pub struct AndroidSurface {
handle: vk::Instance, handle: vk::Instance,
android_surface_fn: vk::AndroidSurfaceFn, android_surface_fn: vk::KhrAndroidSurfaceFn,
} }
impl AndroidSurface { impl AndroidSurface {
@ -17,7 +17,7 @@ impl AndroidSurface {
entry: &E, entry: &E,
instance: &I, instance: &I,
) -> Result<AndroidSurface, Vec<&'static str>> { ) -> Result<AndroidSurface, Vec<&'static str>> {
let surface_fn = vk::AndroidSurfaceFn::load(|name| unsafe { let surface_fn = vk::KhrAndroidSurfaceFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
})?; })?;
Ok(AndroidSurface { Ok(AndroidSurface {

View file

@ -1,13 +1,13 @@
#![allow(dead_code)] #![allow(dead_code)]
use prelude::*; use prelude::*;
use std::mem;
use vk;
use std::ffi::CStr; use std::ffi::CStr;
use std::mem;
use version::{DeviceV1_0, InstanceV1_0}; use version::{DeviceV1_0, InstanceV1_0};
use vk;
#[derive(Clone)] #[derive(Clone)]
pub struct DebugMarker { pub struct DebugMarker {
debug_marker_fn: vk::DebugMarkerFn, debug_marker_fn: vk::ExtDebugMarkerFn,
} }
impl DebugMarker { impl DebugMarker {
@ -15,7 +15,7 @@ impl DebugMarker {
instance: &I, instance: &I,
device: &D, device: &D,
) -> Result<DebugMarker, Vec<&'static str>> { ) -> Result<DebugMarker, Vec<&'static str>> {
let debug_marker_fn = vk::DebugMarkerFn::load(|name| unsafe { let debug_marker_fn = vk::ExtDebugMarkerFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
})?; })?;
Ok(DebugMarker { Ok(DebugMarker {
@ -32,7 +32,8 @@ impl DebugMarker {
device: vk::Device, device: vk::Device,
name_info: &vk::DebugMarkerObjectNameInfoEXT, name_info: &vk::DebugMarkerObjectNameInfoEXT,
) -> VkResult<()> { ) -> VkResult<()> {
let err_code = self.debug_marker_fn let err_code = self
.debug_marker_fn
.debug_marker_set_object_name_ext(device, name_info); .debug_marker_set_object_name_ext(device, name_info);
match err_code { match err_code {
vk::Result::Success => Ok(()), vk::Result::Success => Ok(()),

View file

@ -1,15 +1,15 @@
#![allow(dead_code)] #![allow(dead_code)]
use prelude::*; use prelude::*;
use std::mem;
use vk;
use std::ffi::CStr; use std::ffi::CStr;
use RawPtr; use std::mem;
use version::{EntryV1_0, InstanceV1_0}; use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)] #[derive(Clone)]
pub struct DebugReport { pub struct DebugReport {
handle: vk::Instance, handle: vk::Instance,
debug_report_fn: vk::DebugReportFn, debug_report_fn: vk::ExtDebugReportFn,
} }
impl DebugReport { impl DebugReport {
@ -17,7 +17,7 @@ impl DebugReport {
entry: &E, entry: &E,
instance: &I, instance: &I,
) -> Result<DebugReport, Vec<&'static str>> { ) -> Result<DebugReport, Vec<&'static str>> {
let debug_report_fn = vk::DebugReportFn::load(|name| unsafe { let debug_report_fn = vk::ExtDebugReportFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
})?; })?;
Ok(DebugReport { Ok(DebugReport {

View file

@ -1,15 +1,15 @@
#![allow(dead_code)] #![allow(dead_code)]
use prelude::*; use prelude::*;
use std::mem;
use vk;
use std::ffi::CStr; use std::ffi::CStr;
use RawPtr; use std::mem;
use version::{DeviceV1_0, InstanceV1_0}; use version::{DeviceV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)] #[derive(Clone)]
pub struct DisplaySwapchain { pub struct DisplaySwapchain {
handle: vk::Device, handle: vk::Device,
swapchain_fn: vk::DisplaySwapchainFn, swapchain_fn: vk::KhrDisplaySwapchainFn,
} }
impl DisplaySwapchain { impl DisplaySwapchain {
@ -17,7 +17,7 @@ impl DisplaySwapchain {
instance: &I, instance: &I,
device: &D, device: &D,
) -> Result<DisplaySwapchain, Vec<&'static str>> { ) -> Result<DisplaySwapchain, Vec<&'static str>> {
let swapchain_fn = vk::DisplaySwapchainFn::load(|name| unsafe { let swapchain_fn = vk::KhrDisplaySwapchainFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
})?; })?;
Ok(DisplaySwapchain { Ok(DisplaySwapchain {

View file

@ -1,15 +1,15 @@
#![allow(dead_code)] #![allow(dead_code)]
use prelude::*; use prelude::*;
use std::mem;
use vk;
use std::ffi::CStr; use std::ffi::CStr;
use RawPtr; use std::mem;
use version::{EntryV1_0, InstanceV1_0}; use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)] #[derive(Clone)]
pub struct IOSSurface { pub struct IOSSurface {
handle: vk::Instance, handle: vk::Instance,
ios_surface_fn: vk::IOSSurfaceFn, ios_surface_fn: vk::MvkIosSurfaceFn,
} }
impl IOSSurface { impl IOSSurface {
@ -17,7 +17,7 @@ impl IOSSurface {
entry: &E, entry: &E,
instance: &I, instance: &I,
) -> Result<IOSSurface, Vec<&'static str>> { ) -> Result<IOSSurface, Vec<&'static str>> {
let surface_fn = vk::IOSSurfaceFn::load(|name| unsafe { let surface_fn = vk::MvkIosSurfaceFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
})?; })?;
Ok(IOSSurface { Ok(IOSSurface {

View file

@ -1,15 +1,15 @@
#![allow(dead_code)] #![allow(dead_code)]
use prelude::*; use prelude::*;
use std::mem;
use vk;
use std::ffi::CStr; use std::ffi::CStr;
use RawPtr; use std::mem;
use version::{EntryV1_0, InstanceV1_0}; use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)] #[derive(Clone)]
pub struct MacOSSurface { pub struct MacOSSurface {
handle: vk::Instance, handle: vk::Instance,
macos_surface_fn: vk::MacOSSurfaceFn, macos_surface_fn: vk::MvkMacosSurfaceFn,
} }
impl MacOSSurface { impl MacOSSurface {
@ -17,7 +17,7 @@ impl MacOSSurface {
entry: &E, entry: &E,
instance: &I, instance: &I,
) -> Result<MacOSSurface, Vec<&'static str>> { ) -> Result<MacOSSurface, Vec<&'static str>> {
let surface_fn = vk::MacOSSurfaceFn::load(|name| unsafe { let surface_fn = vk::MvkMacosSurfaceFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
})?; })?;
Ok(MacOSSurface { Ok(MacOSSurface {
@ -30,13 +30,13 @@ impl MacOSSurface {
CStr::from_bytes_with_nul(b"VK_MVK_macos_surface\0").expect("Wrong extension string") CStr::from_bytes_with_nul(b"VK_MVK_macos_surface\0").expect("Wrong extension string")
} }
pub unsafe fn create_macos_surface_mvk( pub unsafe fn create_mac_os_surface_mvk(
&self, &self,
create_info: &vk::MacOSSurfaceCreateInfoMVK, create_info: &vk::MacOSSurfaceCreateInfoMVK,
allocation_callbacks: Option<&vk::AllocationCallbacks>, allocation_callbacks: Option<&vk::AllocationCallbacks>,
) -> VkResult<vk::SurfaceKHR> { ) -> VkResult<vk::SurfaceKHR> {
let mut surface = mem::uninitialized(); let mut surface = mem::uninitialized();
let err_code = self.macos_surface_fn.create_macos_surface_mvk( let err_code = self.macos_surface_fn.create_mac_os_surface_mvk(
self.handle, self.handle,
create_info, create_info,
allocation_callbacks.as_raw_ptr(), allocation_callbacks.as_raw_ptr(),

View file

@ -1,15 +1,15 @@
#![allow(dead_code)] #![allow(dead_code)]
use prelude::*; use prelude::*;
use std::mem;
use vk;
use std::ffi::CStr; use std::ffi::CStr;
use RawPtr; use std::mem;
use version::{EntryV1_0, InstanceV1_0}; use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)] #[derive(Clone)]
pub struct MirSurface { pub struct MirSurface {
handle: vk::Instance, handle: vk::Instance,
mir_surface_fn: vk::MirSurfaceFn, mir_surface_fn: vk::KhrMirSurfaceFn,
} }
impl MirSurface { impl MirSurface {
@ -17,7 +17,7 @@ impl MirSurface {
entry: &E, entry: &E,
instance: &I, instance: &I,
) -> Result<MirSurface, Vec<&'static str>> { ) -> Result<MirSurface, Vec<&'static str>> {
let surface_fn = vk::MirSurfaceFn::load(|name| unsafe { let surface_fn = vk::KhrMirSurfaceFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
})?; })?;
Ok(MirSurface { Ok(MirSurface {

View file

@ -1,27 +1,27 @@
pub use self::swapchain::Swapchain; pub use self::android_surface::AndroidSurface;
pub use self::display_swapchain::DisplaySwapchain;
pub use self::surface::Surface;
pub use self::xlib_surface::XlibSurface;
pub use self::debug_marker::DebugMarker; pub use self::debug_marker::DebugMarker;
pub use self::debug_report::DebugReport; pub use self::debug_report::DebugReport;
pub use self::win32_surface::Win32Surface; pub use self::display_swapchain::DisplaySwapchain;
pub use self::mir_surface::MirSurface;
pub use self::xcb_surface::XcbSurface;
pub use self::wayland_surface::WaylandSurface;
pub use self::android_surface::AndroidSurface;
pub use self::macos_surface::MacOSSurface;
pub use self::ios_surface::IOSSurface; pub use self::ios_surface::IOSSurface;
pub use self::macos_surface::MacOSSurface;
pub use self::mir_surface::MirSurface;
pub use self::surface::Surface;
pub use self::swapchain::Swapchain;
pub use self::wayland_surface::WaylandSurface;
pub use self::win32_surface::Win32Surface;
pub use self::xcb_surface::XcbSurface;
pub use self::xlib_surface::XlibSurface;
mod swapchain; mod android_surface;
mod display_swapchain;
mod surface;
mod xlib_surface;
mod win32_surface;
mod debug_marker; mod debug_marker;
mod debug_report; mod debug_report;
mod mir_surface; mod display_swapchain;
mod android_surface;
mod wayland_surface;
mod xcb_surface;
mod macos_surface;
mod ios_surface; mod ios_surface;
mod macos_surface;
mod mir_surface;
mod surface;
mod swapchain;
mod wayland_surface;
mod win32_surface;
mod xcb_surface;
mod xlib_surface;

View file

@ -1,16 +1,16 @@
#![allow(dead_code)] #![allow(dead_code)]
use prelude::*; use prelude::*;
use std::ptr;
use std::mem;
use vk;
use std::ffi::CStr; use std::ffi::CStr;
use RawPtr; use std::mem;
use std::ptr;
use version::{EntryV1_0, InstanceV1_0}; use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)] #[derive(Clone)]
pub struct Surface { pub struct Surface {
handle: vk::Instance, handle: vk::Instance,
surface_fn: vk::SurfaceFn, surface_fn: vk::KhrSurfaceFn,
} }
impl Surface { impl Surface {
@ -18,7 +18,7 @@ impl Surface {
entry: &E, entry: &E,
instance: &I, instance: &I,
) -> Result<Surface, Vec<&'static str>> { ) -> Result<Surface, Vec<&'static str>> {
let surface_fn = vk::SurfaceFn::load(|name| unsafe { let surface_fn = vk::KhrSurfaceFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
})?; })?;
Ok(Surface { Ok(Surface {
@ -63,7 +63,8 @@ impl Surface {
ptr::null_mut(), ptr::null_mut(),
); );
let mut v = Vec::with_capacity(count as usize); let mut v = Vec::with_capacity(count as usize);
let err_code = self.surface_fn let err_code = self
.surface_fn
.get_physical_device_surface_present_modes_khr( .get_physical_device_surface_present_modes_khr(
physical_device, physical_device,
surface, surface,
@ -85,7 +86,8 @@ impl Surface {
) -> VkResult<vk::SurfaceCapabilitiesKHR> { ) -> VkResult<vk::SurfaceCapabilitiesKHR> {
unsafe { unsafe {
let mut surface_capabilities = mem::uninitialized(); let mut surface_capabilities = mem::uninitialized();
let err_code = self.surface_fn let err_code = self
.surface_fn
.get_physical_device_surface_capabilities_khr( .get_physical_device_surface_capabilities_khr(
physical_device, physical_device,
surface, surface,

View file

@ -1,16 +1,16 @@
#![allow(dead_code)] #![allow(dead_code)]
use prelude::*; use prelude::*;
use std::ptr;
use std::mem;
use vk;
use std::ffi::CStr; use std::ffi::CStr;
use RawPtr; use std::mem;
use std::ptr;
use version::{DeviceV1_0, InstanceV1_0}; use version::{DeviceV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)] #[derive(Clone)]
pub struct Swapchain { pub struct Swapchain {
handle: vk::Device, handle: vk::Device,
swapchain_fn: vk::SwapchainFn, swapchain_fn: vk::KhrSwapchainFn,
} }
impl Swapchain { impl Swapchain {
@ -18,7 +18,7 @@ impl Swapchain {
instance: &I, instance: &I,
device: &D, device: &D,
) -> Result<Swapchain, Vec<&'static str>> { ) -> Result<Swapchain, Vec<&'static str>> {
let swapchain_fn = vk::SwapchainFn::load(|name| unsafe { let swapchain_fn = vk::KhrSwapchainFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
})?; })?;
Ok(Swapchain { Ok(Swapchain {

View file

@ -1,15 +1,15 @@
#![allow(dead_code)] #![allow(dead_code)]
use prelude::*; use prelude::*;
use std::mem;
use vk;
use std::ffi::CStr; use std::ffi::CStr;
use RawPtr; use std::mem;
use version::{EntryV1_0, InstanceV1_0}; use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)] #[derive(Clone)]
pub struct WaylandSurface { pub struct WaylandSurface {
handle: vk::Instance, handle: vk::Instance,
wayland_surface_fn: vk::WaylandSurfaceFn, wayland_surface_fn: vk::KhrWaylandSurfaceFn,
} }
impl WaylandSurface { impl WaylandSurface {
@ -17,7 +17,7 @@ impl WaylandSurface {
entry: &E, entry: &E,
instance: &I, instance: &I,
) -> Result<WaylandSurface, Vec<&'static str>> { ) -> Result<WaylandSurface, Vec<&'static str>> {
let surface_fn = vk::WaylandSurfaceFn::load(|name| unsafe { let surface_fn = vk::KhrWaylandSurfaceFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
})?; })?;
Ok(WaylandSurface { Ok(WaylandSurface {

View file

@ -1,15 +1,15 @@
#![allow(dead_code)] #![allow(dead_code)]
use prelude::*; use prelude::*;
use std::mem;
use vk;
use std::ffi::CStr; use std::ffi::CStr;
use RawPtr; use std::mem;
use version::{EntryV1_0, InstanceV1_0}; use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)] #[derive(Clone)]
pub struct Win32Surface { pub struct Win32Surface {
handle: vk::Instance, handle: vk::Instance,
win32_surface_fn: vk::Win32SurfaceFn, win32_surface_fn: vk::KhrWin32SurfaceFn,
} }
impl Win32Surface { impl Win32Surface {
@ -17,7 +17,7 @@ impl Win32Surface {
entry: &E, entry: &E,
instance: &I, instance: &I,
) -> Result<Win32Surface, Vec<&'static str>> { ) -> Result<Win32Surface, Vec<&'static str>> {
let surface_fn = vk::Win32SurfaceFn::load(|name| unsafe { let surface_fn = vk::KhrWin32SurfaceFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
})?; })?;
Ok(Win32Surface { Ok(Win32Surface {

View file

@ -1,15 +1,15 @@
#![allow(dead_code)] #![allow(dead_code)]
use prelude::*; use prelude::*;
use std::mem;
use vk;
use std::ffi::CStr; use std::ffi::CStr;
use RawPtr; use std::mem;
use version::{EntryV1_0, InstanceV1_0}; use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)] #[derive(Clone)]
pub struct XcbSurface { pub struct XcbSurface {
handle: vk::Instance, handle: vk::Instance,
xcb_surface_fn: vk::XcbSurfaceFn, xcb_surface_fn: vk::KhrXcbSurfaceFn,
} }
impl XcbSurface { impl XcbSurface {
@ -17,7 +17,7 @@ impl XcbSurface {
entry: &E, entry: &E,
instance: &I, instance: &I,
) -> Result<XcbSurface, Vec<&'static str>> { ) -> Result<XcbSurface, Vec<&'static str>> {
let surface_fn = vk::XcbSurfaceFn::load(|name| unsafe { let surface_fn = vk::KhrXcbSurfaceFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
})?; })?;
Ok(XcbSurface { Ok(XcbSurface {

View file

@ -1,15 +1,15 @@
#![allow(dead_code)] #![allow(dead_code)]
use prelude::*; use prelude::*;
use std::mem;
use vk;
use std::ffi::CStr; use std::ffi::CStr;
use RawPtr; use std::mem;
use version::{EntryV1_0, InstanceV1_0}; use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)] #[derive(Clone)]
pub struct XlibSurface { pub struct XlibSurface {
handle: vk::Instance, handle: vk::Instance,
xlib_surface_fn: vk::XlibSurfaceFn, xlib_surface_fn: vk::KhrXlibSurfaceFn,
} }
impl XlibSurface { impl XlibSurface {
@ -17,7 +17,7 @@ impl XlibSurface {
entry: &E, entry: &E,
instance: &I, instance: &I,
) -> Result<XlibSurface, Vec<&'static str>> { ) -> Result<XlibSurface, Vec<&'static str>> {
let surface_fn = vk::XlibSurfaceFn::load(|name| unsafe { let surface_fn = vk::KhrXlibSurfaceFn::load(|name| unsafe {
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
})?; })?;
Ok(XlibSurface { Ok(XlibSurface {