reformat
This commit is contained in:
parent
a73b52012b
commit
b61f5df599
|
@ -8,7 +8,7 @@ use std::path::Path;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use RawPtr;
|
use RawPtr;
|
||||||
use version::{FunctionPointers, V1_0, InstanceLoader, EntryLoader};
|
use version::{EntryLoader, FunctionPointers, InstanceLoader, V1_0};
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn get_path() -> &'static Path {
|
fn get_path() -> &'static Path {
|
||||||
|
@ -98,16 +98,12 @@ pub trait EntryV1_0 {
|
||||||
fn enumerate_instance_layer_properties(&self) -> VkResult<Vec<vk::LayerProperties>> {
|
fn enumerate_instance_layer_properties(&self) -> VkResult<Vec<vk::LayerProperties>> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut num = 0;
|
let mut num = 0;
|
||||||
self.fp_v1_0().enumerate_instance_layer_properties(
|
self.fp_v1_0()
|
||||||
&mut num,
|
.enumerate_instance_layer_properties(&mut num, ptr::null_mut());
|
||||||
ptr::null_mut(),
|
|
||||||
);
|
|
||||||
|
|
||||||
let mut v = Vec::with_capacity(num as usize);
|
let mut v = Vec::with_capacity(num as usize);
|
||||||
let err_code = self.fp_v1_0().enumerate_instance_layer_properties(
|
let err_code = self.fp_v1_0()
|
||||||
&mut num,
|
.enumerate_instance_layer_properties(&mut num, v.as_mut_ptr());
|
||||||
v.as_mut_ptr(),
|
|
||||||
);
|
|
||||||
v.set_len(num as usize);
|
v.set_len(num as usize);
|
||||||
match err_code {
|
match err_code {
|
||||||
vk::Result::Success => Ok(v),
|
vk::Result::Success => Ok(v),
|
||||||
|
@ -161,22 +157,21 @@ impl<V: FunctionPointers> Entry<V> {
|
||||||
pub fn new() -> Result<Entry<V>, LoadingError> {
|
pub fn new() -> Result<Entry<V>, LoadingError> {
|
||||||
let static_fn = match *VK_LIB {
|
let static_fn = match *VK_LIB {
|
||||||
Ok(ref lib) => {
|
Ok(ref lib) => {
|
||||||
let static_fn = vk::StaticFn::load(|name| unsafe {
|
let static_fn =
|
||||||
let name = name.to_str().unwrap();
|
vk::StaticFn::load(|name| unsafe {
|
||||||
let f = match lib.symbol(name) {
|
let name = name.to_str().unwrap();
|
||||||
Ok(s) => s,
|
let f = match lib.symbol(name) {
|
||||||
Err(_) => ptr::null(),
|
Ok(s) => s,
|
||||||
};
|
Err(_) => ptr::null(),
|
||||||
f
|
};
|
||||||
}).map_err(|err| LoadingError::StaticLoadError(err))?;
|
f
|
||||||
|
}).map_err(|err| LoadingError::StaticLoadError(err))?;
|
||||||
Ok(static_fn)
|
Ok(static_fn)
|
||||||
}
|
}
|
||||||
Err(ref err) => Err(LoadingError::LibraryLoadError(err.clone())),
|
Err(ref err) => Err(LoadingError::LibraryLoadError(err.clone())),
|
||||||
}?;
|
}?;
|
||||||
let entry_fn = unsafe {
|
let entry_fn = unsafe {
|
||||||
V::EntryFp::load(&static_fn).map_err(|err| {
|
V::EntryFp::load(&static_fn).map_err(|err| LoadingError::EntryLoadError(err))?
|
||||||
LoadingError::EntryLoadError(err)
|
|
||||||
})?
|
|
||||||
};
|
};
|
||||||
Ok(Entry {
|
Ok(Entry {
|
||||||
static_fn: static_fn,
|
static_fn: static_fn,
|
||||||
|
|
Loading…
Reference in a new issue