From 15839ddc4e2be1acf425742fcfcb606cb4aa7f5f Mon Sep 17 00:00:00 2001 From: Gabriel Majeri Date: Wed, 22 Aug 2018 10:24:50 +0300 Subject: [PATCH] Move enumerate_instance_version to Entry Also adds `EntryV1_1` trait # Conflicts: # ash/src/version.rs --- ash/src/entry.rs | 14 ++++++++++++++ ash/src/instance.rs | 9 --------- ash/src/version.rs | 2 +- generator/src/lib.rs | 3 ++- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/ash/src/entry.rs b/ash/src/entry.rs index b4d0590..3513755 100644 --- a/ash/src/entry.rs +++ b/ash/src/entry.rs @@ -170,3 +170,17 @@ impl Entry { }) } } + +#[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 { + 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), + } + } +} diff --git a/ash/src/instance.rs b/ash/src/instance.rs index 151b6c5..50c459a 100644 --- a/ash/src/instance.rs +++ b/ash/src/instance.rs @@ -86,15 +86,6 @@ impl Instance { pub trait InstanceV1_1: InstanceV1_0 { fn fp_v1_1(&self) -> &vk::InstanceFnV1_1; - unsafe fn enumerate_instance_version(&self) -> VkResult { - 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> { unsafe { let mut group_count = mem::uninitialized(); diff --git a/ash/src/version.rs b/ash/src/version.rs index 3aa6833..a4033e3 100644 --- a/ash/src/version.rs +++ b/ash/src/version.rs @@ -1,5 +1,5 @@ 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}; use std::mem; use vk; diff --git a/generator/src/lib.rs b/generator/src/lib.rs index 47ea4ad..80fb916 100644 --- a/generator/src/lib.rs +++ b/generator/src/lib.rs @@ -540,7 +540,8 @@ impl CommandExt for vkxml::Command { "vkGetInstanceProcAddr" => FunctionType::Static, "vkCreateInstance" | "vkEnumerateInstanceLayerProperties" - | "vkEnumerateInstanceExtensionProperties" => FunctionType::Entry, + | "vkEnumerateInstanceExtensionProperties" + | "vkEnumerateInstanceVersion" => FunctionType::Entry, // This is actually not a device level function "vkGetDeviceProcAddr" => FunctionType::Instance, _ => {