commit
a9dd6df8fe
|
@ -93,10 +93,10 @@ pub trait EntryV1_0 {
|
||||||
return Err(InstanceError::VkError(err_code));
|
return Err(InstanceError::VkError(err_code));
|
||||||
}
|
}
|
||||||
let instance_fp =
|
let instance_fp =
|
||||||
<<Self as EntryV1_0>::Fp as FunctionPointers>::InstanceFp::load(
|
<Self::Fp as FunctionPointers>::InstanceFp::load(
|
||||||
&self.static_fn(),
|
&self.static_fn(),
|
||||||
instance,
|
instance,
|
||||||
).map_err(|err| InstanceError::LoadError(err))?;
|
).map_err(InstanceError::LoadError)?;
|
||||||
Ok(Instance::from_raw(instance, instance_fp))
|
Ok(Instance::from_raw(instance, instance_fp))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,28 +159,23 @@ impl EntryV1_0 for Entry<V1_0> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<V: FunctionPointers> Entry<V> {
|
impl<V: FunctionPointers> Entry<V> {
|
||||||
pub fn new() -> Result<Entry<V>, LoadingError> {
|
pub fn new() -> Result<Self, LoadingError> {
|
||||||
let static_fn = match *VK_LIB {
|
let lib = VK_LIB
|
||||||
Ok(ref lib) => {
|
.as_ref()
|
||||||
let static_fn =
|
.map_err(|err| LoadingError::LibraryLoadError(err.clone()))?;
|
||||||
vk::StaticFn::load(|name| unsafe {
|
|
||||||
let name = name.to_str().unwrap();
|
let static_fn = vk::StaticFn::load(|name| unsafe {
|
||||||
let f = match lib.symbol(name) {
|
lib.symbol(name.to_str().unwrap())
|
||||||
Ok(s) => s,
|
.unwrap_or(ptr::null_mut())
|
||||||
Err(_) => ptr::null(),
|
}).map_err(LoadingError::StaticLoadError)?;
|
||||||
};
|
|
||||||
f
|
|
||||||
}).map_err(|err| LoadingError::StaticLoadError(err))?;
|
|
||||||
Ok(static_fn)
|
|
||||||
}
|
|
||||||
Err(ref err) => Err(LoadingError::LibraryLoadError(err.clone())),
|
|
||||||
}?;
|
|
||||||
let entry_fn = unsafe {
|
let entry_fn = unsafe {
|
||||||
V::EntryFp::load(&static_fn).map_err(|err| LoadingError::EntryLoadError(err))?
|
V::EntryFp::load(&static_fn)
|
||||||
};
|
}.map_err(LoadingError::EntryLoadError)?;
|
||||||
|
|
||||||
Ok(Entry {
|
Ok(Entry {
|
||||||
static_fn: static_fn,
|
static_fn,
|
||||||
entry_fn: entry_fn,
|
entry_fn,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue