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)]
use prelude::*;
use std::mem;
use vk;
use std::ffi::CStr;
use RawPtr;
use std::mem;
use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)]
pub struct AndroidSurface {
handle: vk::Instance,
android_surface_fn: vk::AndroidSurfaceFn,
android_surface_fn: vk::KhrAndroidSurfaceFn,
}
impl AndroidSurface {
@ -17,7 +17,7 @@ impl AndroidSurface {
entry: &E,
instance: &I,
) -> 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()))
})?;
Ok(AndroidSurface {

View file

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

View file

@ -1,15 +1,15 @@
#![allow(dead_code)]
use prelude::*;
use std::mem;
use vk;
use std::ffi::CStr;
use RawPtr;
use std::mem;
use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)]
pub struct DebugReport {
handle: vk::Instance,
debug_report_fn: vk::DebugReportFn,
debug_report_fn: vk::ExtDebugReportFn,
}
impl DebugReport {
@ -17,7 +17,7 @@ impl DebugReport {
entry: &E,
instance: &I,
) -> 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()))
})?;
Ok(DebugReport {

View file

@ -1,15 +1,15 @@
#![allow(dead_code)]
use prelude::*;
use std::mem;
use vk;
use std::ffi::CStr;
use RawPtr;
use std::mem;
use version::{DeviceV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)]
pub struct DisplaySwapchain {
handle: vk::Device,
swapchain_fn: vk::DisplaySwapchainFn,
swapchain_fn: vk::KhrDisplaySwapchainFn,
}
impl DisplaySwapchain {
@ -17,7 +17,7 @@ impl DisplaySwapchain {
instance: &I,
device: &D,
) -> 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()))
})?;
Ok(DisplaySwapchain {

View file

@ -1,15 +1,15 @@
#![allow(dead_code)]
use prelude::*;
use std::mem;
use vk;
use std::ffi::CStr;
use RawPtr;
use std::mem;
use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)]
pub struct IOSSurface {
handle: vk::Instance,
ios_surface_fn: vk::IOSSurfaceFn,
ios_surface_fn: vk::MvkIosSurfaceFn,
}
impl IOSSurface {
@ -17,7 +17,7 @@ impl IOSSurface {
entry: &E,
instance: &I,
) -> 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()))
})?;
Ok(IOSSurface {

View file

@ -1,15 +1,15 @@
#![allow(dead_code)]
use prelude::*;
use std::mem;
use vk;
use std::ffi::CStr;
use RawPtr;
use std::mem;
use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)]
pub struct MacOSSurface {
handle: vk::Instance,
macos_surface_fn: vk::MacOSSurfaceFn,
macos_surface_fn: vk::MvkMacosSurfaceFn,
}
impl MacOSSurface {
@ -17,7 +17,7 @@ impl MacOSSurface {
entry: &E,
instance: &I,
) -> 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()))
})?;
Ok(MacOSSurface {
@ -30,13 +30,13 @@ impl MacOSSurface {
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,
create_info: &vk::MacOSSurfaceCreateInfoMVK,
allocation_callbacks: Option<&vk::AllocationCallbacks>,
) -> VkResult<vk::SurfaceKHR> {
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,
create_info,
allocation_callbacks.as_raw_ptr(),

View file

@ -1,15 +1,15 @@
#![allow(dead_code)]
use prelude::*;
use std::mem;
use vk;
use std::ffi::CStr;
use RawPtr;
use std::mem;
use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)]
pub struct MirSurface {
handle: vk::Instance,
mir_surface_fn: vk::MirSurfaceFn,
mir_surface_fn: vk::KhrMirSurfaceFn,
}
impl MirSurface {
@ -17,7 +17,7 @@ impl MirSurface {
entry: &E,
instance: &I,
) -> 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()))
})?;
Ok(MirSurface {

View file

@ -1,27 +1,27 @@
pub use self::swapchain::Swapchain;
pub use self::display_swapchain::DisplaySwapchain;
pub use self::surface::Surface;
pub use self::xlib_surface::XlibSurface;
pub use self::android_surface::AndroidSurface;
pub use self::debug_marker::DebugMarker;
pub use self::debug_report::DebugReport;
pub use self::win32_surface::Win32Surface;
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::display_swapchain::DisplaySwapchain;
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 display_swapchain;
mod surface;
mod xlib_surface;
mod win32_surface;
mod android_surface;
mod debug_marker;
mod debug_report;
mod mir_surface;
mod android_surface;
mod wayland_surface;
mod xcb_surface;
mod macos_surface;
mod display_swapchain;
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)]
use prelude::*;
use std::ptr;
use std::mem;
use vk;
use std::ffi::CStr;
use RawPtr;
use std::mem;
use std::ptr;
use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)]
pub struct Surface {
handle: vk::Instance,
surface_fn: vk::SurfaceFn,
surface_fn: vk::KhrSurfaceFn,
}
impl Surface {
@ -18,7 +18,7 @@ impl Surface {
entry: &E,
instance: &I,
) -> 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()))
})?;
Ok(Surface {
@ -63,7 +63,8 @@ impl Surface {
ptr::null_mut(),
);
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(
physical_device,
surface,
@ -85,7 +86,8 @@ impl Surface {
) -> VkResult<vk::SurfaceCapabilitiesKHR> {
unsafe {
let mut surface_capabilities = mem::uninitialized();
let err_code = self.surface_fn
let err_code = self
.surface_fn
.get_physical_device_surface_capabilities_khr(
physical_device,
surface,

View file

@ -1,16 +1,16 @@
#![allow(dead_code)]
use prelude::*;
use std::ptr;
use std::mem;
use vk;
use std::ffi::CStr;
use RawPtr;
use std::mem;
use std::ptr;
use version::{DeviceV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)]
pub struct Swapchain {
handle: vk::Device,
swapchain_fn: vk::SwapchainFn,
swapchain_fn: vk::KhrSwapchainFn,
}
impl Swapchain {
@ -18,7 +18,7 @@ impl Swapchain {
instance: &I,
device: &D,
) -> 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()))
})?;
Ok(Swapchain {

View file

@ -1,15 +1,15 @@
#![allow(dead_code)]
use prelude::*;
use std::mem;
use vk;
use std::ffi::CStr;
use RawPtr;
use std::mem;
use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)]
pub struct WaylandSurface {
handle: vk::Instance,
wayland_surface_fn: vk::WaylandSurfaceFn,
wayland_surface_fn: vk::KhrWaylandSurfaceFn,
}
impl WaylandSurface {
@ -17,7 +17,7 @@ impl WaylandSurface {
entry: &E,
instance: &I,
) -> 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()))
})?;
Ok(WaylandSurface {

View file

@ -1,15 +1,15 @@
#![allow(dead_code)]
use prelude::*;
use std::mem;
use vk;
use std::ffi::CStr;
use RawPtr;
use std::mem;
use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)]
pub struct Win32Surface {
handle: vk::Instance,
win32_surface_fn: vk::Win32SurfaceFn,
win32_surface_fn: vk::KhrWin32SurfaceFn,
}
impl Win32Surface {
@ -17,7 +17,7 @@ impl Win32Surface {
entry: &E,
instance: &I,
) -> 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()))
})?;
Ok(Win32Surface {

View file

@ -1,15 +1,15 @@
#![allow(dead_code)]
use prelude::*;
use std::mem;
use vk;
use std::ffi::CStr;
use RawPtr;
use std::mem;
use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)]
pub struct XcbSurface {
handle: vk::Instance,
xcb_surface_fn: vk::XcbSurfaceFn,
xcb_surface_fn: vk::KhrXcbSurfaceFn,
}
impl XcbSurface {
@ -17,7 +17,7 @@ impl XcbSurface {
entry: &E,
instance: &I,
) -> 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()))
})?;
Ok(XcbSurface {

View file

@ -1,15 +1,15 @@
#![allow(dead_code)]
use prelude::*;
use std::mem;
use vk;
use std::ffi::CStr;
use RawPtr;
use std::mem;
use version::{EntryV1_0, InstanceV1_0};
use vk;
use RawPtr;
#[derive(Clone)]
pub struct XlibSurface {
handle: vk::Instance,
xlib_surface_fn: vk::XlibSurfaceFn,
xlib_surface_fn: vk::KhrXlibSurfaceFn,
}
impl XlibSurface {
@ -17,7 +17,7 @@ impl XlibSurface {
entry: &E,
instance: &I,
) -> 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()))
})?;
Ok(XlibSurface {