Move enumerate_instance_version to Entry

Also adds `EntryV1_1` trait

# Conflicts:
#	ash/src/version.rs
This commit is contained in:
Gabriel Majeri 2018-08-22 10:24:50 +03:00
parent 3e812896ff
commit 15839ddc4e
4 changed files with 17 additions and 11 deletions

View file

@ -170,3 +170,17 @@ impl<V: FunctionPointers> Entry<V> {
}) })
} }
} }
#[allow(non_camel_case_types)]
pub trait EntryV1_1: EntryV1_0 {
fn fp_v1_1(&self) -> &vk::EntryFnV1_1;
unsafe fn enumerate_instance_version(&self) -> VkResult<vk::uint32_t> {
let mut api_version = mem::uninitialized();
let err_code = self.fp_v1_1().enumerate_instance_version(&mut api_version);
match err_code {
vk::Result::SUCCESS => Ok(api_version),
_ => Err(err_code),
}
}
}

View file

@ -86,15 +86,6 @@ impl<V: FunctionPointers> Instance<V> {
pub trait InstanceV1_1: InstanceV1_0 { pub trait InstanceV1_1: InstanceV1_0 {
fn fp_v1_1(&self) -> &vk::InstanceFnV1_1; fn fp_v1_1(&self) -> &vk::InstanceFnV1_1;
unsafe fn enumerate_instance_version(&self) -> VkResult<vk::uint32_t> {
let mut api_version = mem::uninitialized();
let err_code = self.fp_v1_1().enumerate_instance_version(&mut api_version);
match err_code {
vk::Result::SUCCESS => Ok(api_version),
_ => Err(err_code),
}
}
fn enumerate_physical_device_groups(&self) -> VkResult<Vec<vk::PhysicalDeviceGroupProperties>> { fn enumerate_physical_device_groups(&self) -> VkResult<Vec<vk::PhysicalDeviceGroupProperties>> {
unsafe { unsafe {
let mut group_count = mem::uninitialized(); let mut group_count = mem::uninitialized();

View file

@ -1,5 +1,5 @@
pub use device::{DeviceV1_0, DeviceV1_1}; pub use device::{DeviceV1_0, DeviceV1_1};
pub use entry::EntryV1_0; pub use entry::{EntryV1_0, EntryV1_1};
pub use instance::{InstanceV1_0, InstanceV1_1}; pub use instance::{InstanceV1_0, InstanceV1_1};
use std::mem; use std::mem;
use vk; use vk;

View file

@ -540,7 +540,8 @@ impl CommandExt for vkxml::Command {
"vkGetInstanceProcAddr" => FunctionType::Static, "vkGetInstanceProcAddr" => FunctionType::Static,
"vkCreateInstance" "vkCreateInstance"
| "vkEnumerateInstanceLayerProperties" | "vkEnumerateInstanceLayerProperties"
| "vkEnumerateInstanceExtensionProperties" => FunctionType::Entry, | "vkEnumerateInstanceExtensionProperties"
| "vkEnumerateInstanceVersion" => FunctionType::Entry,
// This is actually not a device level function // This is actually not a device level function
"vkGetDeviceProcAddr" => FunctionType::Instance, "vkGetDeviceProcAddr" => FunctionType::Instance,
_ => { _ => {