Added VK_EXT_tooling_info
extension support (#310)
* Added `VK_EXT_tooling_info` extension support. * Formatting applied. * cargo-clippy suggestions satisfied. * cargo-clippy suggestions satisfied.
This commit is contained in:
parent
8d7dfee763
commit
ac4d046d4b
|
@ -2,8 +2,10 @@ pub use self::debug_marker::DebugMarker;
|
||||||
pub use self::debug_report::DebugReport;
|
pub use self::debug_report::DebugReport;
|
||||||
pub use self::debug_utils::DebugUtils;
|
pub use self::debug_utils::DebugUtils;
|
||||||
pub use self::metal_surface::MetalSurface;
|
pub use self::metal_surface::MetalSurface;
|
||||||
|
pub use self::tooling_info::ToolingInfo;
|
||||||
|
|
||||||
mod debug_marker;
|
mod debug_marker;
|
||||||
mod debug_report;
|
mod debug_report;
|
||||||
mod debug_utils;
|
mod debug_utils;
|
||||||
mod metal_surface;
|
mod metal_surface;
|
||||||
|
mod tooling_info;
|
||||||
|
|
56
ash/src/extensions/ext/tooling_info.rs
Normal file
56
ash/src/extensions/ext/tooling_info.rs
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
#![allow(dead_code)]
|
||||||
|
use crate::prelude::*;
|
||||||
|
use crate::version::{EntryV1_0, InstanceV1_0};
|
||||||
|
use crate::vk;
|
||||||
|
use std::ffi::CStr;
|
||||||
|
use std::mem;
|
||||||
|
use std::ptr;
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct ToolingInfo {
|
||||||
|
handle: vk::Instance,
|
||||||
|
tooling_info_fn: vk::ExtToolingInfoFn,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ToolingInfo {
|
||||||
|
pub fn new<E: EntryV1_0, I: InstanceV1_0>(entry: &E, instance: &I) -> ToolingInfo {
|
||||||
|
let tooling_info_fn = vk::ExtToolingInfoFn::load(|name| unsafe {
|
||||||
|
mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
|
||||||
|
});
|
||||||
|
ToolingInfo {
|
||||||
|
handle: instance.handle(),
|
||||||
|
tooling_info_fn,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn name() -> &'static CStr {
|
||||||
|
vk::ExtToolingInfoFn::name()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc = "https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkGetPhysicalDeviceToolPropertiesEXT.html"]
|
||||||
|
pub unsafe fn get_physical_device_tool_properties(
|
||||||
|
&self,
|
||||||
|
physical_device: vk::PhysicalDevice,
|
||||||
|
) -> VkResult<Vec<vk::PhysicalDeviceToolPropertiesEXT>> {
|
||||||
|
let mut count = 0;
|
||||||
|
self.tooling_info_fn
|
||||||
|
.get_physical_device_tool_properties_ext(physical_device, &mut count, ptr::null_mut());
|
||||||
|
let mut v = Vec::with_capacity(count as usize);
|
||||||
|
let err_code = self
|
||||||
|
.tooling_info_fn
|
||||||
|
.get_physical_device_tool_properties_ext(physical_device, &mut count, v.as_mut_ptr());
|
||||||
|
v.set_len(count as usize);
|
||||||
|
match err_code {
|
||||||
|
vk::Result::SUCCESS => Ok(v),
|
||||||
|
_ => Err(err_code),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn fp(&self) -> &vk::ExtToolingInfoFn {
|
||||||
|
&self.tooling_info_fn
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn instance(&self) -> vk::Instance {
|
||||||
|
self.handle
|
||||||
|
}
|
||||||
|
}
|
|
@ -158,6 +158,7 @@ unsafe fn create_surface<E: EntryV1_0, I: InstanceV1_0>(
|
||||||
instance: &I,
|
instance: &I,
|
||||||
window: &winit::Window,
|
window: &winit::Window,
|
||||||
) -> Result<vk::SurfaceKHR, vk::Result> {
|
) -> Result<vk::SurfaceKHR, vk::Result> {
|
||||||
|
use std::ffi::c_void;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use winapi::shared::windef::HWND;
|
use winapi::shared::windef::HWND;
|
||||||
use winapi::um::libloaderapi::GetModuleHandleW;
|
use winapi::um::libloaderapi::GetModuleHandleW;
|
||||||
|
|
|
@ -1753,7 +1753,7 @@ pub fn derive_setters(
|
||||||
.map(|extends| name_to_tokens(&format!("Extends{}", name_to_tokens(&extends))))
|
.map(|extends| name_to_tokens(&format!("Extends{}", name_to_tokens(&extends))))
|
||||||
.collect()
|
.collect()
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|| vec![]);
|
.unwrap_or_else(Vec::new);
|
||||||
|
|
||||||
// We only implement a next methods for root structs with a `pnext` field.
|
// We only implement a next methods for root structs with a `pnext` field.
|
||||||
let next_function = if has_next && root_structs.is_empty() {
|
let next_function = if has_next && root_structs.is_empty() {
|
||||||
|
|
Loading…
Reference in a new issue