Add functions for Instance
This commit is contained in:
parent
c0e98cdf78
commit
e230d6ae81
|
@ -87,14 +87,188 @@ 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> {
|
unsafe fn enumerate_instance_version(&self) -> VkResult<vk::uint32_t> {
|
||||||
let mut api_version = 0;
|
let mut api_version = mem::uninitialized();
|
||||||
let err_code = self.fp_v1_1()
|
let err_code = self.fp_v1_1()
|
||||||
.enumerate_instance_version(&mut api_version as *mut _);
|
.enumerate_instance_version(&mut api_version);
|
||||||
match err_code {
|
match err_code {
|
||||||
vk::Result::SUCCESS => Ok(api_version),
|
vk::Result::SUCCESS => Ok(api_version),
|
||||||
_ => Err(err_code)
|
_ => Err(err_code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn enumerate_physical_device_groups(&self) -> VkResult<Vec<vk::PhysicalDeviceGroupProperties>> {
|
||||||
|
unsafe {
|
||||||
|
let mut group_count = mem::uninitialized();
|
||||||
|
self.fp_v1_1()
|
||||||
|
.enumerate_physical_device_groups(self.handle(), &mut group_count, ptr::null_mut());
|
||||||
|
let mut physical_device_groups = Vec::with_capacity(group_count as usize);
|
||||||
|
let err_code = self.fp_v1_1().enumerate_physical_device_groups(
|
||||||
|
self.handle(),
|
||||||
|
&mut group_count,
|
||||||
|
physical_device_groups.as_mut_ptr(),
|
||||||
|
);
|
||||||
|
physical_device_groups.set_len(group_count as usize);
|
||||||
|
match err_code {
|
||||||
|
vk::Result::SUCCESS => Ok(physical_device_groups),
|
||||||
|
_ => Err(err_code),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_physical_device_properties2(
|
||||||
|
&self,
|
||||||
|
physical_device: vk::PhysicalDevice,
|
||||||
|
) -> vk::PhysicalDeviceProperties2 {
|
||||||
|
unsafe {
|
||||||
|
let mut prop = mem::uninitialized();
|
||||||
|
self.fp_v1_1()
|
||||||
|
.get_physical_device_properties2(physical_device, &mut prop);
|
||||||
|
prop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_physical_device_format_properties2(
|
||||||
|
&self,
|
||||||
|
physical_device: vk::PhysicalDevice,
|
||||||
|
format: vk::Format,
|
||||||
|
) -> vk::FormatProperties2 {
|
||||||
|
unsafe {
|
||||||
|
let mut format_prop = mem::uninitialized();
|
||||||
|
self.fp_v1_1().get_physical_device_format_properties2(
|
||||||
|
physical_device,
|
||||||
|
format,
|
||||||
|
&mut format_prop,
|
||||||
|
);
|
||||||
|
format_prop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_physical_device_image_format_properties2(
|
||||||
|
&self,
|
||||||
|
physical_device: vk::PhysicalDevice,
|
||||||
|
format_info: &vk::PhysicalDeviceImageFormatInfo2,
|
||||||
|
) -> VkResult<vk::ImageFormatProperties2> {
|
||||||
|
unsafe {
|
||||||
|
let mut image_format_prop = mem::uninitialized();
|
||||||
|
let err_code = self.fp_v1_1().get_physical_device_image_format_properties2(
|
||||||
|
physical_device,
|
||||||
|
format_info,
|
||||||
|
&mut image_format_prop,
|
||||||
|
);
|
||||||
|
if err_code == vk::Result::SUCCESS {
|
||||||
|
Ok(image_format_prop)
|
||||||
|
} else {
|
||||||
|
Err(err_code)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_physical_device_queue_family_properties2(
|
||||||
|
&self,
|
||||||
|
physical_device: vk::PhysicalDevice,
|
||||||
|
) -> Vec<vk::QueueFamilyProperties2> {
|
||||||
|
unsafe {
|
||||||
|
let mut queue_count = 0;
|
||||||
|
self.fp_v1_1().get_physical_device_queue_family_properties2(
|
||||||
|
physical_device,
|
||||||
|
&mut queue_count,
|
||||||
|
ptr::null_mut(),
|
||||||
|
);
|
||||||
|
let mut queue_families_vec = Vec::with_capacity(queue_count as usize);
|
||||||
|
self.fp_v1_1().get_physical_device_queue_family_properties2(
|
||||||
|
physical_device,
|
||||||
|
&mut queue_count,
|
||||||
|
queue_families_vec.as_mut_ptr(),
|
||||||
|
);
|
||||||
|
queue_families_vec.set_len(queue_count as usize);
|
||||||
|
queue_families_vec
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_physical_device_memory_properties2(
|
||||||
|
&self,
|
||||||
|
physical_device: vk::PhysicalDevice,
|
||||||
|
) -> vk::PhysicalDeviceMemoryProperties2 {
|
||||||
|
unsafe {
|
||||||
|
let mut memory_prop = mem::uninitialized();
|
||||||
|
self.fp_v1_1()
|
||||||
|
.get_physical_device_memory_properties2(physical_device, &mut memory_prop);
|
||||||
|
memory_prop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_physical_device_sparse_image_format_properties2(
|
||||||
|
&self,
|
||||||
|
physical_device: vk::PhysicalDevice,
|
||||||
|
format_info: &vk::PhysicalDeviceSparseImageFormatInfo2,
|
||||||
|
) -> Vec<vk::SparseImageFormatProperties2> {
|
||||||
|
unsafe {
|
||||||
|
let mut format_count = 0;
|
||||||
|
self.fp_v1_1().get_physical_device_sparse_image_format_properties2(
|
||||||
|
physical_device,
|
||||||
|
format_info,
|
||||||
|
&mut format_count,
|
||||||
|
ptr::null_mut(),
|
||||||
|
);
|
||||||
|
let mut format_prop = Vec::with_capacity(format_count as usize);
|
||||||
|
self.fp_v1_1().get_physical_device_sparse_image_format_properties2(
|
||||||
|
physical_device,
|
||||||
|
format_info,
|
||||||
|
&mut format_count,
|
||||||
|
format_prop.as_mut_ptr(),
|
||||||
|
);
|
||||||
|
format_prop.set_len(format_count as usize);
|
||||||
|
format_prop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_physical_device_external_buffer_properties(
|
||||||
|
&self,
|
||||||
|
physical_device: vk::PhysicalDevice,
|
||||||
|
external_buffer_info: &vk::PhysicalDeviceExternalBufferInfo,
|
||||||
|
) -> vk::ExternalBufferProperties {
|
||||||
|
unsafe {
|
||||||
|
let mut image_format_prop = mem::uninitialized();
|
||||||
|
self.fp_v1_1().get_physical_device_external_buffer_properties(
|
||||||
|
physical_device,
|
||||||
|
external_buffer_info,
|
||||||
|
&mut image_format_prop,
|
||||||
|
);
|
||||||
|
image_format_prop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_physical_device_external_fence_properties(
|
||||||
|
&self,
|
||||||
|
physical_device: vk::PhysicalDevice,
|
||||||
|
external_fence_info: &vk::PhysicalDeviceExternalFenceInfo,
|
||||||
|
) -> vk::ExternalFenceProperties {
|
||||||
|
unsafe {
|
||||||
|
let mut fence_prop = mem::uninitialized();
|
||||||
|
self.fp_v1_1().get_physical_device_external_fence_properties(
|
||||||
|
physical_device,
|
||||||
|
external_fence_info,
|
||||||
|
&mut fence_prop,
|
||||||
|
);
|
||||||
|
fence_prop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_physical_device_external_semaphore_properties(
|
||||||
|
&self,
|
||||||
|
physical_device: vk::PhysicalDevice,
|
||||||
|
external_semaphore_info: &vk::PhysicalDeviceExternalSemaphoreInfo,
|
||||||
|
) -> vk::ExternalSemaphoreProperties {
|
||||||
|
unsafe {
|
||||||
|
let mut semaphore_prop = mem::uninitialized();
|
||||||
|
self.fp_v1_1().get_physical_device_external_semaphore_properties(
|
||||||
|
physical_device,
|
||||||
|
external_semaphore_info,
|
||||||
|
&mut semaphore_prop,
|
||||||
|
);
|
||||||
|
semaphore_prop
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
|
|
Loading…
Reference in a new issue