Remove EntryExt
This commit is contained in:
parent
1fb4e2ae42
commit
2fdec50947
|
@ -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]
|
||||
|
|
29
src/entry.rs
29
src/entry.rs
|
@ -47,34 +47,7 @@ pub enum InstanceError {
|
|||
LoadError(Vec<&'static str>),
|
||||
VkError(vk::Result),
|
||||
}
|
||||
pub trait EntryExt {
|
||||
fn load_vulkan<V: FunctionPointers>() -> Result<Entry<V>, 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<V: FunctionPointers> EntryExt for Entry<V> {}
|
||||
impl Entry<V1_0> {}
|
||||
|
||||
impl<V: FunctionPointers> Entry<V> {
|
||||
pub fn create_instance(&self,
|
||||
create_info: &vk::InstanceCreateInfo,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue