Add functions for DeviceV1_1

This commit is contained in:
Tim 2018-08-03 12:22:51 +02:00
parent eeb17a07a1
commit 623c26c9bc

View file

@ -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,170 @@ 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)
}
}
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 {
unsafe {
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
}
}