commit
016cc1056b
|
@ -1,6 +1,7 @@
|
|||
#![allow(dead_code)]
|
||||
use prelude::*;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use version::{FunctionPointers, V1_0, V1_1};
|
||||
use vk;
|
||||
use RawPtr;
|
||||
|
@ -8,12 +9,220 @@ use RawPtr;
|
|||
#[allow(non_camel_case_types)]
|
||||
pub trait DeviceV1_1: DeviceV1_0 {
|
||||
fn fp_v1_1(&self) -> &vk::DeviceFnV1_1;
|
||||
unsafe fn bind_buffer_memory2(&self, bind_infos: &[vk::BindBufferMemoryInfo]) -> vk::Result {
|
||||
self.fp_v1_1().bind_buffer_memory2(
|
||||
|
||||
unsafe fn bind_buffer_memory2(&self, bind_infos: &[vk::BindBufferMemoryInfo]) -> VkResult<()> {
|
||||
let err_code = self.fp_v1_1().bind_buffer_memory2(
|
||||
self.handle(),
|
||||
bind_infos.len() as _,
|
||||
bind_infos.as_ptr(),
|
||||
)
|
||||
);
|
||||
match err_code {
|
||||
vk::Result::SUCCESS => Ok(()),
|
||||
_ => Err(err_code),
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn bind_image_memory2(&self, bind_infos: &[vk::BindImageMemoryInfo]) -> VkResult<()> {
|
||||
let err_code = self.fp_v1_1().bind_image_memory2(
|
||||
self.handle(),
|
||||
bind_infos.len() as _,
|
||||
bind_infos.as_ptr(),
|
||||
);
|
||||
match err_code {
|
||||
vk::Result::SUCCESS => Ok(()),
|
||||
_ => Err(err_code),
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn get_device_group_peer_memory_features(
|
||||
&self,
|
||||
heap_index: vk::uint32_t,
|
||||
local_device_index: vk::uint32_t,
|
||||
remote_device_index: vk::uint32_t,
|
||||
) -> vk::PeerMemoryFeatureFlags {
|
||||
let mut peer_memory_features = mem::uninitialized();
|
||||
self.fp_v1_1().get_device_group_peer_memory_features(
|
||||
self.handle(),
|
||||
heap_index,
|
||||
local_device_index,
|
||||
remote_device_index,
|
||||
&mut peer_memory_features,
|
||||
);
|
||||
peer_memory_features
|
||||
}
|
||||
|
||||
unsafe fn cmd_set_device_mask(
|
||||
&self,
|
||||
command_buffer: vk::CommandBuffer,
|
||||
device_mask: vk::uint32_t,
|
||||
) {
|
||||
self.fp_v1_1()
|
||||
.cmd_set_device_mask(command_buffer, device_mask);
|
||||
}
|
||||
|
||||
unsafe fn cmd_dispatch_base(
|
||||
&self,
|
||||
command_buffer: vk::CommandBuffer,
|
||||
base_group_x: vk::uint32_t,
|
||||
base_group_y: vk::uint32_t,
|
||||
base_group_z: vk::uint32_t,
|
||||
group_count_x: vk::uint32_t,
|
||||
group_count_y: vk::uint32_t,
|
||||
group_count_z: vk::uint32_t,
|
||||
) {
|
||||
self.fp_v1_1().cmd_dispatch_base(
|
||||
command_buffer,
|
||||
base_group_x,
|
||||
base_group_y,
|
||||
base_group_z,
|
||||
group_count_x,
|
||||
group_count_y,
|
||||
group_count_z,
|
||||
);
|
||||
}
|
||||
|
||||
unsafe fn get_image_memory_requirements2(
|
||||
&self,
|
||||
info: &vk::ImageMemoryRequirementsInfo2,
|
||||
) -> vk::MemoryRequirements2 {
|
||||
let mut image_memory_requirements = mem::uninitialized();
|
||||
self.fp_v1_1().get_image_memory_requirements2(
|
||||
self.handle(),
|
||||
info,
|
||||
&mut image_memory_requirements,
|
||||
);
|
||||
image_memory_requirements
|
||||
}
|
||||
|
||||
unsafe fn get_buffer_memory_requirements2(
|
||||
&self,
|
||||
info: &vk::BufferMemoryRequirementsInfo2,
|
||||
) -> vk::MemoryRequirements2 {
|
||||
let mut image_memory_requirements = mem::uninitialized();
|
||||
self.fp_v1_1().get_buffer_memory_requirements2(
|
||||
self.handle(),
|
||||
info,
|
||||
&mut image_memory_requirements,
|
||||
);
|
||||
image_memory_requirements
|
||||
}
|
||||
|
||||
unsafe fn get_image_sparse_memory_requirements2(
|
||||
&self,
|
||||
info: &vk::ImageSparseMemoryRequirementsInfo2,
|
||||
) -> Vec<vk::SparseImageMemoryRequirements2> {
|
||||
let mut count = mem::uninitialized();
|
||||
self.fp_v1_1().get_image_sparse_memory_requirements2(
|
||||
self.handle(),
|
||||
info,
|
||||
&mut count,
|
||||
ptr::null_mut(),
|
||||
);
|
||||
let mut requirements = Vec::with_capacity(count as usize);
|
||||
self.fp_v1_1().get_image_sparse_memory_requirements2(
|
||||
self.handle(),
|
||||
info,
|
||||
&mut count,
|
||||
requirements.as_mut_ptr(),
|
||||
);
|
||||
requirements.set_len(count as usize);
|
||||
requirements
|
||||
}
|
||||
|
||||
unsafe fn trim_command_pool(
|
||||
&self,
|
||||
command_pool: vk::CommandPool,
|
||||
flags: vk::CommandPoolTrimFlags,
|
||||
) {
|
||||
self.fp_v1_1()
|
||||
.trim_command_pool(self.handle(), command_pool, flags);
|
||||
}
|
||||
|
||||
unsafe fn create_sampler_ycbcr_conversion(
|
||||
&self,
|
||||
create_info: &vk::SamplerYcbcrConversionCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>,
|
||||
) -> VkResult<vk::SamplerYcbcrConversion> {
|
||||
let mut ycbcr_conversion = mem::uninitialized();
|
||||
let err_code = self.fp_v1_1().create_sampler_ycbcr_conversion(
|
||||
self.handle(),
|
||||
create_info,
|
||||
allocation_callbacks.as_raw_ptr(),
|
||||
&mut ycbcr_conversion,
|
||||
);
|
||||
match err_code {
|
||||
vk::Result::SUCCESS => Ok(ycbcr_conversion),
|
||||
_ => Err(err_code),
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn destroy_sampler_ycbcr_conversion(
|
||||
&self,
|
||||
ycbcr_conversion: vk::SamplerYcbcrConversion,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>,
|
||||
) {
|
||||
self.fp_v1_1().destroy_sampler_ycbcr_conversion(
|
||||
self.handle(),
|
||||
ycbcr_conversion,
|
||||
allocation_callbacks.as_raw_ptr(),
|
||||
);
|
||||
}
|
||||
|
||||
unsafe fn create_descriptor_update_template(
|
||||
&self,
|
||||
create_info: &vk::DescriptorUpdateTemplateCreateInfo,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>,
|
||||
) -> VkResult<vk::DescriptorUpdateTemplate> {
|
||||
let mut descriptor_update_template = mem::uninitialized();
|
||||
let err_code = self.fp_v1_1().create_descriptor_update_template(
|
||||
self.handle(),
|
||||
create_info,
|
||||
allocation_callbacks.as_raw_ptr(),
|
||||
&mut descriptor_update_template,
|
||||
);
|
||||
match err_code {
|
||||
vk::Result::SUCCESS => Ok(descriptor_update_template),
|
||||
_ => Err(err_code),
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn destroy_descriptor_update_template(
|
||||
&self,
|
||||
descriptor_update_template: vk::DescriptorUpdateTemplate,
|
||||
allocation_callbacks: Option<&vk::AllocationCallbacks>,
|
||||
) {
|
||||
self.fp_v1_1().destroy_descriptor_update_template(
|
||||
self.handle(),
|
||||
descriptor_update_template,
|
||||
allocation_callbacks.as_raw_ptr(),
|
||||
);
|
||||
}
|
||||
|
||||
unsafe fn update_descriptor_set_with_template(
|
||||
&self,
|
||||
descriptor_set: vk::DescriptorSet,
|
||||
descriptor_update_template: vk::DescriptorUpdateTemplate,
|
||||
data: *const vk::c_void,
|
||||
) {
|
||||
self.fp_v1_1().update_descriptor_set_with_template(
|
||||
self.handle(),
|
||||
descriptor_set,
|
||||
descriptor_update_template,
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
unsafe fn get_descriptor_set_layout_support(
|
||||
&self,
|
||||
create_info: &vk::DescriptorSetLayoutCreateInfo,
|
||||
) -> vk::DescriptorSetLayoutSupport {
|
||||
let mut descriptor_set_layout_support = mem::uninitialized();
|
||||
self.fp_v1_1().get_descriptor_set_layout_support(
|
||||
self.handle(),
|
||||
create_info,
|
||||
&mut descriptor_set_layout_support,
|
||||
);
|
||||
descriptor_set_layout_support
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,14 +87,185 @@ pub trait InstanceV1_1: InstanceV1_0 {
|
|||
fn fp_v1_1(&self) -> &vk::InstanceFnV1_1;
|
||||
|
||||
unsafe fn enumerate_instance_version(&self) -> VkResult<vk::uint32_t> {
|
||||
let mut api_version = 0;
|
||||
let err_code = self.fp_v1_1()
|
||||
.enumerate_instance_version(&mut api_version as *mut _);
|
||||
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)
|
||||
_ => 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
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn get_physical_device_image_format_properties2(
|
||||
&self,
|
||||
physical_device: vk::PhysicalDevice,
|
||||
format_info: &vk::PhysicalDeviceImageFormatInfo2,
|
||||
) -> VkResult<vk::ImageFormatProperties2> {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn get_physical_device_sparse_image_format_properties2(
|
||||
&self,
|
||||
physical_device: vk::PhysicalDevice,
|
||||
format_info: &vk::PhysicalDeviceSparseImageFormatInfo2,
|
||||
) -> Vec<vk::SparseImageFormatProperties2> {
|
||||
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
|
||||
}
|
||||
|
||||
unsafe fn get_physical_device_external_buffer_properties(
|
||||
&self,
|
||||
physical_device: vk::PhysicalDevice,
|
||||
external_buffer_info: &vk::PhysicalDeviceExternalBufferInfo,
|
||||
) -> vk::ExternalBufferProperties {
|
||||
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
|
||||
}
|
||||
|
||||
unsafe fn get_physical_device_external_fence_properties(
|
||||
&self,
|
||||
physical_device: vk::PhysicalDevice,
|
||||
external_fence_info: &vk::PhysicalDeviceExternalFenceInfo,
|
||||
) -> vk::ExternalFenceProperties {
|
||||
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
|
||||
}
|
||||
|
||||
unsafe fn get_physical_device_external_semaphore_properties(
|
||||
&self,
|
||||
physical_device: vk::PhysicalDevice,
|
||||
external_semaphore_info: &vk::PhysicalDeviceExternalSemaphoreInfo,
|
||||
) -> vk::ExternalSemaphoreProperties {
|
||||
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)]
|
||||
|
|
Loading…
Reference in a new issue