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,7 +157,8 @@ 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 =
|
||||||
|
vk::StaticFn::load(|name| unsafe {
|
||||||
let name = name.to_str().unwrap();
|
let name = name.to_str().unwrap();
|
||||||
let f = match lib.symbol(name) {
|
let f = match lib.symbol(name) {
|
||||||
Ok(s) => s,
|
Ok(s) => s,
|
||||||
|
@ -174,9 +171,7 @@ impl<V: FunctionPointers> Entry<V> {
|
||||||
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