From 2fdec50947d619ba53e60493cecd7460634838db Mon Sep 17 00:00:00 2001 From: maik klein Date: Sun, 1 Jan 2017 08:50:52 +0100 Subject: [PATCH] Remove EntryExt --- examples/src/lib.rs | 1 - src/entry.rs | 29 +---------------------------- src/lib.rs | 2 +- src/version.rs | 1 - 4 files changed, 2 insertions(+), 31 deletions(-) diff --git a/examples/src/lib.rs b/examples/src/lib.rs index 6d37596..7383d27 100644 --- a/examples/src/lib.rs +++ b/examples/src/lib.rs @@ -17,7 +17,6 @@ use ash::extensions::{Swapchain, XlibSurface, Surface, DebugReport, Win32Surface use std::ptr; use std::ffi::{CStr, CString}; use std::ops::Drop; -use ash::entry::EntryExt; // Simple offset_of macro akin to C++ offsetof #[macro_export] diff --git a/src/entry.rs b/src/entry.rs index e07ecd3..a03b52c 100644 --- a/src/entry.rs +++ b/src/entry.rs @@ -47,34 +47,7 @@ pub enum InstanceError { LoadError(Vec<&'static str>), VkError(vk::Result), } -pub trait EntryExt { - fn load_vulkan() -> Result, LoadingError> { - let static_fn = match *VK_LIB { - Ok(ref lib) => { - let static_fn = vk::StaticFn::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))?; - Ok(static_fn) - } - Err(ref err) => Err(LoadingError::LibraryLoadError(err.clone())), - }?; - let entry_fn = vk::EntryFn::load(|name| unsafe { - mem::transmute(static_fn.get_instance_proc_addr(vk::Instance::null(), name.as_ptr())) - }).map_err(|err| LoadingError::EntryLoadError(err))?; - Ok(Entry { - static_fn: static_fn, - entry_fn: entry_fn, - _v: PhantomData, - }) - } -} -impl EntryExt for Entry {} -impl Entry {} + impl Entry { pub fn create_instance(&self, create_info: &vk::InstanceCreateInfo, diff --git a/src/lib.rs b/src/lib.rs index 43e295f..4c7362b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,7 +7,7 @@ pub use entry::Entry; mod instance; mod device; -pub mod entry; +mod entry; pub mod prelude; pub mod vk; pub mod allocator; diff --git a/src/version.rs b/src/version.rs index fe15d8d..ed8d9f3 100644 --- a/src/version.rs +++ b/src/version.rs @@ -1,7 +1,6 @@ use vk; pub use instance::InstanceV1_0; pub use device::DeviceV1_0; -use entry::EntryExt; use std::mem; pub trait FunctionPointers { type InstanceFp: InstanceLoader;