Convert mem::zeroed()
/ 0
to MaybeUninit::uninit()
(#798)
* Convert `mem::zeroed()` / `0` to `MaybeUninit::uninit()` As noted in #792 changes like this might help us more strictly identify and validate that the argument in question is only relevant as an output argument (i.e. structs with `sType` are read by the function call, even if the caller strictly expects return values there, so that it can fill in multiple structures in a `pNext` chain, and must hence be `Default`- initialized). * Use uninit `Vec`s with late `set_len()` call instead of zero-initialization * Use `uninit()` instead of `-1` for file descriptors * Introduce `set_vec_len_on_success()` helper for `Vec::with_capacity()`
This commit is contained in:
parent
02c7a83592
commit
4e99de1cbb
|
@ -768,7 +768,6 @@ fn main() {
|
||||||
device.cmd_end_render_pass(draw_command_buffer);
|
device.cmd_end_render_pass(draw_command_buffer);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
//let mut present_info_err = mem::zeroed();
|
|
||||||
let present_info = vk::PresentInfoKHR {
|
let present_info = vk::PresentInfoKHR {
|
||||||
wait_semaphore_count: 1,
|
wait_semaphore_count: 1,
|
||||||
p_wait_semaphores: &base.rendering_complete_semaphore,
|
p_wait_semaphores: &base.rendering_complete_semaphore,
|
||||||
|
|
|
@ -423,7 +423,6 @@ fn main() {
|
||||||
device.cmd_end_render_pass(draw_command_buffer);
|
device.cmd_end_render_pass(draw_command_buffer);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
//let mut present_info_err = mem::zeroed();
|
|
||||||
let wait_semaphors = [base.rendering_complete_semaphore];
|
let wait_semaphors = [base.rendering_complete_semaphore];
|
||||||
let swapchains = [base.swapchain];
|
let swapchains = [base.swapchain];
|
||||||
let image_indices = [present_index];
|
let image_indices = [present_index];
|
||||||
|
|
|
@ -70,14 +70,14 @@ impl Device {
|
||||||
create_info: &vk::PrivateDataSlotCreateInfo<'_>,
|
create_info: &vk::PrivateDataSlotCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::PrivateDataSlot> {
|
) -> VkResult<vk::PrivateDataSlot> {
|
||||||
let mut private_data_slot = mem::zeroed();
|
let mut private_data_slot = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_3.create_private_data_slot)(
|
(self.device_fn_1_3.create_private_data_slot)(
|
||||||
self.handle,
|
self.handle,
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut private_data_slot,
|
private_data_slot.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(private_data_slot)
|
.assume_init_on_success(private_data_slot)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyPrivateDataSlot.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyPrivateDataSlot.html>
|
||||||
|
@ -119,15 +119,15 @@ impl Device {
|
||||||
object: T,
|
object: T,
|
||||||
private_data_slot: vk::PrivateDataSlot,
|
private_data_slot: vk::PrivateDataSlot,
|
||||||
) -> u64 {
|
) -> u64 {
|
||||||
let mut data = mem::zeroed();
|
let mut data = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_3.get_private_data)(
|
(self.device_fn_1_3.get_private_data)(
|
||||||
self.handle,
|
self.handle,
|
||||||
T::TYPE,
|
T::TYPE,
|
||||||
object.as_raw(),
|
object.as_raw(),
|
||||||
private_data_slot,
|
private_data_slot,
|
||||||
&mut data,
|
data.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
data
|
data.assume_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdPipelineBarrier2.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdPipelineBarrier2.html>
|
||||||
|
@ -511,16 +511,16 @@ impl Device {
|
||||||
&self,
|
&self,
|
||||||
memory_requirements: &vk::DeviceImageMemoryRequirements<'_>,
|
memory_requirements: &vk::DeviceImageMemoryRequirements<'_>,
|
||||||
) -> usize {
|
) -> usize {
|
||||||
let mut count = 0;
|
let mut count = mem::MaybeUninit::uninit();
|
||||||
(self
|
(self
|
||||||
.device_fn_1_3
|
.device_fn_1_3
|
||||||
.get_device_image_sparse_memory_requirements)(
|
.get_device_image_sparse_memory_requirements)(
|
||||||
self.handle,
|
self.handle,
|
||||||
memory_requirements,
|
memory_requirements,
|
||||||
&mut count,
|
count.as_mut_ptr(),
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
);
|
);
|
||||||
count as usize
|
count.assume_init() as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceImageSparseMemoryRequirements.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceImageSparseMemoryRequirements.html>
|
||||||
|
@ -606,14 +606,14 @@ impl Device {
|
||||||
create_info: &vk::RenderPassCreateInfo2<'_>,
|
create_info: &vk::RenderPassCreateInfo2<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::RenderPass> {
|
) -> VkResult<vk::RenderPass> {
|
||||||
let mut renderpass = mem::zeroed();
|
let mut renderpass = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_2.create_render_pass2)(
|
(self.device_fn_1_2.create_render_pass2)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut renderpass,
|
renderpass.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(renderpass)
|
.assume_init_on_success(renderpass)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBeginRenderPass2.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBeginRenderPass2.html>
|
||||||
|
@ -670,9 +670,13 @@ impl Device {
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetSemaphoreCounterValue.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetSemaphoreCounterValue.html>
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn get_semaphore_counter_value(&self, semaphore: vk::Semaphore) -> VkResult<u64> {
|
pub unsafe fn get_semaphore_counter_value(&self, semaphore: vk::Semaphore) -> VkResult<u64> {
|
||||||
let mut value = 0;
|
let mut value = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_2.get_semaphore_counter_value)(self.handle(), semaphore, &mut value)
|
(self.device_fn_1_2.get_semaphore_counter_value)(
|
||||||
.result_with_success(value)
|
self.handle(),
|
||||||
|
semaphore,
|
||||||
|
value.as_mut_ptr(),
|
||||||
|
)
|
||||||
|
.assume_init_on_success(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkWaitSemaphores.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkWaitSemaphores.html>
|
||||||
|
@ -765,15 +769,15 @@ impl Device {
|
||||||
local_device_index: u32,
|
local_device_index: u32,
|
||||||
remote_device_index: u32,
|
remote_device_index: u32,
|
||||||
) -> vk::PeerMemoryFeatureFlags {
|
) -> vk::PeerMemoryFeatureFlags {
|
||||||
let mut peer_memory_features = mem::zeroed();
|
let mut peer_memory_features = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_1.get_device_group_peer_memory_features)(
|
(self.device_fn_1_1.get_device_group_peer_memory_features)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
heap_index,
|
heap_index,
|
||||||
local_device_index,
|
local_device_index,
|
||||||
remote_device_index,
|
remote_device_index,
|
||||||
&mut peer_memory_features,
|
peer_memory_features.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
peer_memory_features
|
peer_memory_features.assume_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDeviceMask.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDeviceMask.html>
|
||||||
|
@ -831,14 +835,14 @@ impl Device {
|
||||||
&self,
|
&self,
|
||||||
info: &vk::ImageSparseMemoryRequirementsInfo2<'_>,
|
info: &vk::ImageSparseMemoryRequirementsInfo2<'_>,
|
||||||
) -> usize {
|
) -> usize {
|
||||||
let mut count = 0;
|
let mut count = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_1.get_image_sparse_memory_requirements2)(
|
(self.device_fn_1_1.get_image_sparse_memory_requirements2)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
info,
|
info,
|
||||||
&mut count,
|
count.as_mut_ptr(),
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
);
|
);
|
||||||
count as usize
|
count.assume_init() as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageSparseMemoryRequirements2.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageSparseMemoryRequirements2.html>
|
||||||
|
@ -874,9 +878,9 @@ impl Device {
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceQueue2.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceQueue2.html>
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn get_device_queue2(&self, queue_info: &vk::DeviceQueueInfo2<'_>) -> vk::Queue {
|
pub unsafe fn get_device_queue2(&self, queue_info: &vk::DeviceQueueInfo2<'_>) -> vk::Queue {
|
||||||
let mut queue = mem::zeroed();
|
let mut queue = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_1.get_device_queue2)(self.handle(), queue_info, &mut queue);
|
(self.device_fn_1_1.get_device_queue2)(self.handle(), queue_info, queue.as_mut_ptr());
|
||||||
queue
|
queue.assume_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateSamplerYcbcrConversion.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateSamplerYcbcrConversion.html>
|
||||||
|
@ -886,14 +890,14 @@ impl Device {
|
||||||
create_info: &vk::SamplerYcbcrConversionCreateInfo<'_>,
|
create_info: &vk::SamplerYcbcrConversionCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::SamplerYcbcrConversion> {
|
) -> VkResult<vk::SamplerYcbcrConversion> {
|
||||||
let mut ycbcr_conversion = mem::zeroed();
|
let mut ycbcr_conversion = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_1.create_sampler_ycbcr_conversion)(
|
(self.device_fn_1_1.create_sampler_ycbcr_conversion)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut ycbcr_conversion,
|
ycbcr_conversion.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(ycbcr_conversion)
|
.assume_init_on_success(ycbcr_conversion)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroySamplerYcbcrConversion.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroySamplerYcbcrConversion.html>
|
||||||
|
@ -917,14 +921,14 @@ impl Device {
|
||||||
create_info: &vk::DescriptorUpdateTemplateCreateInfo<'_>,
|
create_info: &vk::DescriptorUpdateTemplateCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::DescriptorUpdateTemplate> {
|
) -> VkResult<vk::DescriptorUpdateTemplate> {
|
||||||
let mut descriptor_update_template = mem::zeroed();
|
let mut descriptor_update_template = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_1.create_descriptor_update_template)(
|
(self.device_fn_1_1.create_descriptor_update_template)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut descriptor_update_template,
|
descriptor_update_template.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(descriptor_update_template)
|
.assume_init_on_success(descriptor_update_template)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyDescriptorUpdateTemplate.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyDescriptorUpdateTemplate.html>
|
||||||
|
@ -1030,14 +1034,14 @@ impl Device {
|
||||||
create_info: &vk::EventCreateInfo<'_>,
|
create_info: &vk::EventCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::Event> {
|
) -> VkResult<vk::Event> {
|
||||||
let mut event = mem::zeroed();
|
let mut event = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.create_event)(
|
(self.device_fn_1_0.create_event)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut event,
|
event.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(event)
|
.assume_init_on_success(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns [`true`] if the event was set, and [`false`] if the event was reset, otherwise it will
|
/// Returns [`true`] if the event was set, and [`false`] if the event was reset, otherwise it will
|
||||||
|
@ -1363,14 +1367,14 @@ impl Device {
|
||||||
create_info: &vk::SamplerCreateInfo<'_>,
|
create_info: &vk::SamplerCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::Sampler> {
|
) -> VkResult<vk::Sampler> {
|
||||||
let mut sampler = mem::zeroed();
|
let mut sampler = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.create_sampler)(
|
(self.device_fn_1_0.create_sampler)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut sampler,
|
sampler.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(sampler)
|
.assume_init_on_success(sampler)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBlitImage.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBlitImage.html>
|
||||||
|
@ -1542,10 +1546,7 @@ impl Device {
|
||||||
allocate_info,
|
allocate_info,
|
||||||
desc_set.as_mut_ptr(),
|
desc_set.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result()?;
|
.set_vec_len_on_success(desc_set, allocate_info.descriptor_set_count as usize)
|
||||||
|
|
||||||
desc_set.set_len(allocate_info.descriptor_set_count as usize);
|
|
||||||
Ok(desc_set)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateDescriptorSetLayout.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateDescriptorSetLayout.html>
|
||||||
|
@ -1555,14 +1556,14 @@ impl Device {
|
||||||
create_info: &vk::DescriptorSetLayoutCreateInfo<'_>,
|
create_info: &vk::DescriptorSetLayoutCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::DescriptorSetLayout> {
|
) -> VkResult<vk::DescriptorSetLayout> {
|
||||||
let mut layout = mem::zeroed();
|
let mut layout = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.create_descriptor_set_layout)(
|
(self.device_fn_1_0.create_descriptor_set_layout)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut layout,
|
layout.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(layout)
|
.assume_init_on_success(layout)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDeviceWaitIdle.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDeviceWaitIdle.html>
|
||||||
|
@ -1578,14 +1579,14 @@ impl Device {
|
||||||
create_info: &vk::DescriptorPoolCreateInfo<'_>,
|
create_info: &vk::DescriptorPoolCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::DescriptorPool> {
|
) -> VkResult<vk::DescriptorPool> {
|
||||||
let mut pool = mem::zeroed();
|
let mut pool = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.create_descriptor_pool)(
|
(self.device_fn_1_0.create_descriptor_pool)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut pool,
|
pool.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(pool)
|
.assume_init_on_success(pool)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkResetDescriptorPool.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkResetDescriptorPool.html>
|
||||||
|
@ -2123,14 +2124,14 @@ impl Device {
|
||||||
create_info: &vk::SemaphoreCreateInfo<'_>,
|
create_info: &vk::SemaphoreCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::Semaphore> {
|
) -> VkResult<vk::Semaphore> {
|
||||||
let mut semaphore = mem::zeroed();
|
let mut semaphore = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.create_semaphore)(
|
(self.device_fn_1_0.create_semaphore)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut semaphore,
|
semaphore.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(semaphore)
|
.assume_init_on_success(semaphore)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateGraphicsPipelines.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateGraphicsPipelines.html>
|
||||||
|
@ -2188,14 +2189,14 @@ impl Device {
|
||||||
create_info: &vk::BufferCreateInfo<'_>,
|
create_info: &vk::BufferCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::Buffer> {
|
) -> VkResult<vk::Buffer> {
|
||||||
let mut buffer = mem::zeroed();
|
let mut buffer = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.create_buffer)(
|
(self.device_fn_1_0.create_buffer)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut buffer,
|
buffer.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(buffer)
|
.assume_init_on_success(buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreatePipelineLayout.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreatePipelineLayout.html>
|
||||||
|
@ -2205,14 +2206,14 @@ impl Device {
|
||||||
create_info: &vk::PipelineLayoutCreateInfo<'_>,
|
create_info: &vk::PipelineLayoutCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::PipelineLayout> {
|
) -> VkResult<vk::PipelineLayout> {
|
||||||
let mut pipeline_layout = mem::zeroed();
|
let mut pipeline_layout = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.create_pipeline_layout)(
|
(self.device_fn_1_0.create_pipeline_layout)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut pipeline_layout,
|
pipeline_layout.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(pipeline_layout)
|
.assume_init_on_success(pipeline_layout)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreatePipelineCache.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreatePipelineCache.html>
|
||||||
|
@ -2222,14 +2223,14 @@ impl Device {
|
||||||
create_info: &vk::PipelineCacheCreateInfo<'_>,
|
create_info: &vk::PipelineCacheCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::PipelineCache> {
|
) -> VkResult<vk::PipelineCache> {
|
||||||
let mut pipeline_cache = mem::zeroed();
|
let mut pipeline_cache = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.create_pipeline_cache)(
|
(self.device_fn_1_0.create_pipeline_cache)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut pipeline_cache,
|
pipeline_cache.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(pipeline_cache)
|
.assume_init_on_success(pipeline_cache)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPipelineCacheData.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPipelineCacheData.html>
|
||||||
|
@ -2273,9 +2274,16 @@ impl Device {
|
||||||
size: vk::DeviceSize,
|
size: vk::DeviceSize,
|
||||||
flags: vk::MemoryMapFlags,
|
flags: vk::MemoryMapFlags,
|
||||||
) -> VkResult<*mut c_void> {
|
) -> VkResult<*mut c_void> {
|
||||||
let mut data: *mut c_void = ptr::null_mut();
|
let mut data = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.map_memory)(self.handle(), memory, offset, size, flags, &mut data)
|
(self.device_fn_1_0.map_memory)(
|
||||||
.result_with_success(data)
|
self.handle(),
|
||||||
|
memory,
|
||||||
|
offset,
|
||||||
|
size,
|
||||||
|
flags,
|
||||||
|
data.as_mut_ptr(),
|
||||||
|
)
|
||||||
|
.assume_init_on_success(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkUnmapMemory.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkUnmapMemory.html>
|
||||||
|
@ -2319,27 +2327,27 @@ impl Device {
|
||||||
create_info: &vk::FramebufferCreateInfo<'_>,
|
create_info: &vk::FramebufferCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::Framebuffer> {
|
) -> VkResult<vk::Framebuffer> {
|
||||||
let mut framebuffer = mem::zeroed();
|
let mut framebuffer = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.create_framebuffer)(
|
(self.device_fn_1_0.create_framebuffer)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut framebuffer,
|
framebuffer.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(framebuffer)
|
.assume_init_on_success(framebuffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceQueue.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceQueue.html>
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn get_device_queue(&self, queue_family_index: u32, queue_index: u32) -> vk::Queue {
|
pub unsafe fn get_device_queue(&self, queue_family_index: u32, queue_index: u32) -> vk::Queue {
|
||||||
let mut queue = mem::zeroed();
|
let mut queue = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.get_device_queue)(
|
(self.device_fn_1_0.get_device_queue)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
queue_family_index,
|
queue_family_index,
|
||||||
queue_index,
|
queue_index,
|
||||||
&mut queue,
|
queue.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
queue
|
queue.assume_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdPipelineBarrier.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdPipelineBarrier.html>
|
||||||
|
@ -2375,14 +2383,14 @@ impl Device {
|
||||||
create_info: &vk::RenderPassCreateInfo<'_>,
|
create_info: &vk::RenderPassCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::RenderPass> {
|
) -> VkResult<vk::RenderPass> {
|
||||||
let mut renderpass = mem::zeroed();
|
let mut renderpass = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.create_render_pass)(
|
(self.device_fn_1_0.create_render_pass)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut renderpass,
|
renderpass.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(renderpass)
|
.assume_init_on_success(renderpass)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkBeginCommandBuffer.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkBeginCommandBuffer.html>
|
||||||
|
@ -2472,14 +2480,14 @@ impl Device {
|
||||||
create_info: &vk::BufferViewCreateInfo<'_>,
|
create_info: &vk::BufferViewCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::BufferView> {
|
) -> VkResult<vk::BufferView> {
|
||||||
let mut buffer_view = mem::zeroed();
|
let mut buffer_view = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.create_buffer_view)(
|
(self.device_fn_1_0.create_buffer_view)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut buffer_view,
|
buffer_view.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(buffer_view)
|
.assume_init_on_success(buffer_view)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyBufferView.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyBufferView.html>
|
||||||
|
@ -2503,14 +2511,14 @@ impl Device {
|
||||||
create_info: &vk::ImageViewCreateInfo<'_>,
|
create_info: &vk::ImageViewCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::ImageView> {
|
) -> VkResult<vk::ImageView> {
|
||||||
let mut image_view = mem::zeroed();
|
let mut image_view = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.create_image_view)(
|
(self.device_fn_1_0.create_image_view)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut image_view,
|
image_view.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(image_view)
|
.assume_init_on_success(image_view)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkAllocateCommandBuffers.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkAllocateCommandBuffers.html>
|
||||||
|
@ -2525,9 +2533,7 @@ impl Device {
|
||||||
allocate_info,
|
allocate_info,
|
||||||
buffers.as_mut_ptr(),
|
buffers.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result()?;
|
.set_vec_len_on_success(buffers, allocate_info.command_buffer_count as usize)
|
||||||
buffers.set_len(allocate_info.command_buffer_count as usize);
|
|
||||||
Ok(buffers)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateCommandPool.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateCommandPool.html>
|
||||||
|
@ -2537,14 +2543,14 @@ impl Device {
|
||||||
create_info: &vk::CommandPoolCreateInfo<'_>,
|
create_info: &vk::CommandPoolCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::CommandPool> {
|
) -> VkResult<vk::CommandPool> {
|
||||||
let mut pool = mem::zeroed();
|
let mut pool = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.create_command_pool)(
|
(self.device_fn_1_0.create_command_pool)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut pool,
|
pool.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(pool)
|
.assume_init_on_success(pool)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateQueryPool.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateQueryPool.html>
|
||||||
|
@ -2554,14 +2560,14 @@ impl Device {
|
||||||
create_info: &vk::QueryPoolCreateInfo<'_>,
|
create_info: &vk::QueryPoolCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::QueryPool> {
|
) -> VkResult<vk::QueryPool> {
|
||||||
let mut pool = mem::zeroed();
|
let mut pool = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.create_query_pool)(
|
(self.device_fn_1_0.create_query_pool)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut pool,
|
pool.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(pool)
|
.assume_init_on_success(pool)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateImage.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateImage.html>
|
||||||
|
@ -2571,14 +2577,14 @@ impl Device {
|
||||||
create_info: &vk::ImageCreateInfo<'_>,
|
create_info: &vk::ImageCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::Image> {
|
) -> VkResult<vk::Image> {
|
||||||
let mut image = mem::zeroed();
|
let mut image = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.create_image)(
|
(self.device_fn_1_0.create_image)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut image,
|
image.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(image)
|
.assume_init_on_success(image)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageSubresourceLayout.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageSubresourceLayout.html>
|
||||||
|
@ -2588,22 +2594,26 @@ impl Device {
|
||||||
image: vk::Image,
|
image: vk::Image,
|
||||||
subresource: vk::ImageSubresource,
|
subresource: vk::ImageSubresource,
|
||||||
) -> vk::SubresourceLayout {
|
) -> vk::SubresourceLayout {
|
||||||
let mut layout = mem::zeroed();
|
let mut layout = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.get_image_subresource_layout)(
|
(self.device_fn_1_0.get_image_subresource_layout)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
image,
|
image,
|
||||||
&subresource,
|
&subresource,
|
||||||
&mut layout,
|
layout.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
layout
|
layout.assume_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageMemoryRequirements.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageMemoryRequirements.html>
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn get_image_memory_requirements(&self, image: vk::Image) -> vk::MemoryRequirements {
|
pub unsafe fn get_image_memory_requirements(&self, image: vk::Image) -> vk::MemoryRequirements {
|
||||||
let mut mem_req = mem::zeroed();
|
let mut mem_req = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.get_image_memory_requirements)(self.handle(), image, &mut mem_req);
|
(self.device_fn_1_0.get_image_memory_requirements)(
|
||||||
mem_req
|
self.handle(),
|
||||||
|
image,
|
||||||
|
mem_req.as_mut_ptr(),
|
||||||
|
);
|
||||||
|
mem_req.assume_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetBufferMemoryRequirements.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetBufferMemoryRequirements.html>
|
||||||
|
@ -2612,9 +2622,13 @@ impl Device {
|
||||||
&self,
|
&self,
|
||||||
buffer: vk::Buffer,
|
buffer: vk::Buffer,
|
||||||
) -> vk::MemoryRequirements {
|
) -> vk::MemoryRequirements {
|
||||||
let mut mem_req = mem::zeroed();
|
let mut mem_req = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.get_buffer_memory_requirements)(self.handle(), buffer, &mut mem_req);
|
(self.device_fn_1_0.get_buffer_memory_requirements)(
|
||||||
mem_req
|
self.handle(),
|
||||||
|
buffer,
|
||||||
|
mem_req.as_mut_ptr(),
|
||||||
|
);
|
||||||
|
mem_req.assume_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkAllocateMemory.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkAllocateMemory.html>
|
||||||
|
@ -2624,14 +2638,14 @@ impl Device {
|
||||||
allocate_info: &vk::MemoryAllocateInfo<'_>,
|
allocate_info: &vk::MemoryAllocateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::DeviceMemory> {
|
) -> VkResult<vk::DeviceMemory> {
|
||||||
let mut memory = mem::zeroed();
|
let mut memory = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.allocate_memory)(
|
(self.device_fn_1_0.allocate_memory)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
allocate_info,
|
allocate_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut memory,
|
memory.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(memory)
|
.assume_init_on_success(memory)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateShaderModule.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateShaderModule.html>
|
||||||
|
@ -2641,14 +2655,14 @@ impl Device {
|
||||||
create_info: &vk::ShaderModuleCreateInfo<'_>,
|
create_info: &vk::ShaderModuleCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::ShaderModule> {
|
) -> VkResult<vk::ShaderModule> {
|
||||||
let mut shader = mem::zeroed();
|
let mut shader = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.create_shader_module)(
|
(self.device_fn_1_0.create_shader_module)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut shader,
|
shader.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(shader)
|
.assume_init_on_success(shader)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateFence.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateFence.html>
|
||||||
|
@ -2658,14 +2672,14 @@ impl Device {
|
||||||
create_info: &vk::FenceCreateInfo<'_>,
|
create_info: &vk::FenceCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::Fence> {
|
) -> VkResult<vk::Fence> {
|
||||||
let mut fence = mem::zeroed();
|
let mut fence = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.create_fence)(
|
(self.device_fn_1_0.create_fence)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut fence,
|
fence.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(fence)
|
.assume_init_on_success(fence)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkBindBufferMemory.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkBindBufferMemory.html>
|
||||||
|
@ -2694,25 +2708,25 @@ impl Device {
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetRenderAreaGranularity.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetRenderAreaGranularity.html>
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn get_render_area_granularity(&self, render_pass: vk::RenderPass) -> vk::Extent2D {
|
pub unsafe fn get_render_area_granularity(&self, render_pass: vk::RenderPass) -> vk::Extent2D {
|
||||||
let mut granularity = mem::zeroed();
|
let mut granularity = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.get_render_area_granularity)(
|
(self.device_fn_1_0.get_render_area_granularity)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
render_pass,
|
render_pass,
|
||||||
&mut granularity,
|
granularity.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
granularity
|
granularity.assume_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceMemoryCommitment.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceMemoryCommitment.html>
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn get_device_memory_commitment(&self, memory: vk::DeviceMemory) -> vk::DeviceSize {
|
pub unsafe fn get_device_memory_commitment(&self, memory: vk::DeviceMemory) -> vk::DeviceSize {
|
||||||
let mut committed_memory_in_bytes = 0;
|
let mut committed_memory_in_bytes = mem::MaybeUninit::uninit();
|
||||||
(self.device_fn_1_0.get_device_memory_commitment)(
|
(self.device_fn_1_0.get_device_memory_commitment)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
memory,
|
memory,
|
||||||
&mut committed_memory_in_bytes,
|
committed_memory_in_bytes.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
committed_memory_in_bytes
|
committed_memory_in_bytes.assume_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageSparseMemoryRequirements.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageSparseMemoryRequirements.html>
|
||||||
|
|
|
@ -219,7 +219,6 @@ impl Entry {
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn try_enumerate_instance_version(&self) -> VkResult<Option<u32>> {
|
pub unsafe fn try_enumerate_instance_version(&self) -> VkResult<Option<u32>> {
|
||||||
let mut api_version = 0;
|
|
||||||
let enumerate_instance_version: Option<vk::PFN_vkEnumerateInstanceVersion> = {
|
let enumerate_instance_version: Option<vk::PFN_vkEnumerateInstanceVersion> = {
|
||||||
let name = CStr::from_bytes_with_nul_unchecked(b"vkEnumerateInstanceVersion\0");
|
let name = CStr::from_bytes_with_nul_unchecked(b"vkEnumerateInstanceVersion\0");
|
||||||
mem::transmute((self.static_fn.get_instance_proc_addr)(
|
mem::transmute((self.static_fn.get_instance_proc_addr)(
|
||||||
|
@ -228,7 +227,10 @@ impl Entry {
|
||||||
))
|
))
|
||||||
};
|
};
|
||||||
if let Some(enumerate_instance_version) = enumerate_instance_version {
|
if let Some(enumerate_instance_version) = enumerate_instance_version {
|
||||||
(enumerate_instance_version)(&mut api_version).result_with_success(Some(api_version))
|
let mut api_version = mem::MaybeUninit::uninit();
|
||||||
|
(enumerate_instance_version)(api_version.as_mut_ptr())
|
||||||
|
.assume_init_on_success(api_version)
|
||||||
|
.map(Some)
|
||||||
} else {
|
} else {
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
|
@ -251,13 +253,13 @@ impl Entry {
|
||||||
create_info: &vk::InstanceCreateInfo<'_>,
|
create_info: &vk::InstanceCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<Instance> {
|
) -> VkResult<Instance> {
|
||||||
let mut instance = mem::zeroed();
|
let mut instance = mem::MaybeUninit::uninit();
|
||||||
(self.entry_fn_1_0.create_instance)(
|
let instance = (self.entry_fn_1_0.create_instance)(
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut instance,
|
instance.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result()?;
|
.assume_init_on_success(instance)?;
|
||||||
Ok(Instance::load(&self.static_fn, instance))
|
Ok(Instance::load(&self.static_fn, instance))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,9 +310,9 @@ impl Entry {
|
||||||
/// Please use [`try_enumerate_instance_version()`][Self::try_enumerate_instance_version()] instead.
|
/// Please use [`try_enumerate_instance_version()`][Self::try_enumerate_instance_version()] instead.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn enumerate_instance_version(&self) -> VkResult<u32> {
|
pub unsafe fn enumerate_instance_version(&self) -> VkResult<u32> {
|
||||||
let mut api_version = 0;
|
let mut api_version = mem::MaybeUninit::uninit();
|
||||||
(self.entry_fn_1_1.enumerate_instance_version)(&mut api_version)
|
(self.entry_fn_1_1.enumerate_instance_version)(api_version.as_mut_ptr())
|
||||||
.result_with_success(api_version)
|
.assume_init_on_success(api_version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ impl ShaderEnqueue {
|
||||||
create_infos: &[vk::ExecutionGraphPipelineCreateInfoAMDX<'_>],
|
create_infos: &[vk::ExecutionGraphPipelineCreateInfoAMDX<'_>],
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<Vec<vk::Pipeline>> {
|
) -> VkResult<Vec<vk::Pipeline>> {
|
||||||
let mut pipelines = vec![mem::zeroed(); create_infos.len()];
|
let mut pipelines = Vec::with_capacity(create_infos.len());
|
||||||
(self.fp.create_execution_graph_pipelines_amdx)(
|
(self.fp.create_execution_graph_pipelines_amdx)(
|
||||||
self.handle,
|
self.handle,
|
||||||
pipeline_cache,
|
pipeline_cache,
|
||||||
|
@ -38,7 +38,7 @@ impl ShaderEnqueue {
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
pipelines.as_mut_ptr(),
|
pipelines.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(pipelines)
|
.set_vec_len_on_success(pipelines, create_infos.len())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetExecutionGraphPipelineScratchSizeAMDX.html>
|
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetExecutionGraphPipelineScratchSizeAMDX.html>
|
||||||
|
@ -63,14 +63,14 @@ impl ShaderEnqueue {
|
||||||
execution_graph: vk::Pipeline,
|
execution_graph: vk::Pipeline,
|
||||||
node_info: &vk::PipelineShaderStageNodeCreateInfoAMDX<'_>,
|
node_info: &vk::PipelineShaderStageNodeCreateInfoAMDX<'_>,
|
||||||
) -> VkResult<u32> {
|
) -> VkResult<u32> {
|
||||||
let mut node_index = 0;
|
let mut node_index = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_execution_graph_pipeline_node_index_amdx)(
|
(self.fp.get_execution_graph_pipeline_node_index_amdx)(
|
||||||
self.handle,
|
self.handle,
|
||||||
execution_graph,
|
execution_graph,
|
||||||
node_info,
|
node_info,
|
||||||
&mut node_index,
|
node_index.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(node_index)
|
.assume_init_on_success(node_index)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdInitializeGraphScratchMemoryAMDX.html>
|
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdInitializeGraphScratchMemoryAMDX.html>
|
||||||
|
|
|
@ -37,9 +37,9 @@ impl ExternalMemoryAndroidHardwareBuffer {
|
||||||
&self,
|
&self,
|
||||||
info: &vk::MemoryGetAndroidHardwareBufferInfoANDROID<'_>,
|
info: &vk::MemoryGetAndroidHardwareBufferInfoANDROID<'_>,
|
||||||
) -> VkResult<*mut vk::AHardwareBuffer> {
|
) -> VkResult<*mut vk::AHardwareBuffer> {
|
||||||
let mut buffer = std::ptr::null_mut();
|
let mut buffer = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_memory_android_hardware_buffer_android)(self.handle, info, &mut buffer)
|
(self.fp.get_memory_android_hardware_buffer_android)(self.handle, info, buffer.as_mut_ptr())
|
||||||
.result_with_success(buffer)
|
.assume_init_on_success(buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const NAME: &'static CStr = vk::AndroidExternalMemoryAndroidHardwareBufferFn::NAME;
|
pub const NAME: &'static CStr = vk::AndroidExternalMemoryAndroidHardwareBufferFn::NAME;
|
||||||
|
|
|
@ -43,16 +43,18 @@ impl CalibratedTimestamps {
|
||||||
device: vk::Device,
|
device: vk::Device,
|
||||||
info: &[vk::CalibratedTimestampInfoEXT<'_>],
|
info: &[vk::CalibratedTimestampInfoEXT<'_>],
|
||||||
) -> VkResult<(Vec<u64>, u64)> {
|
) -> VkResult<(Vec<u64>, u64)> {
|
||||||
let mut timestamps = vec![0u64; info.len()];
|
let mut timestamps = Vec::with_capacity(info.len());
|
||||||
let mut max_deviation = 0u64;
|
let mut max_deviation = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_calibrated_timestamps_ext)(
|
let max_deviation = (self.fp.get_calibrated_timestamps_ext)(
|
||||||
device,
|
device,
|
||||||
info.len() as u32,
|
info.len() as u32,
|
||||||
info.as_ptr(),
|
info.as_ptr(),
|
||||||
timestamps.as_mut_ptr(),
|
timestamps.as_mut_ptr(),
|
||||||
&mut max_deviation,
|
max_deviation.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success((timestamps, max_deviation))
|
.assume_init_on_success(max_deviation)?;
|
||||||
|
timestamps.set_len(info.len());
|
||||||
|
Ok((timestamps, max_deviation))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const NAME: &'static CStr = vk::ExtCalibratedTimestampsFn::NAME;
|
pub const NAME: &'static CStr = vk::ExtCalibratedTimestampsFn::NAME;
|
||||||
|
|
|
@ -41,14 +41,14 @@ impl DebugReport {
|
||||||
create_info: &vk::DebugReportCallbackCreateInfoEXT<'_>,
|
create_info: &vk::DebugReportCallbackCreateInfoEXT<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::DebugReportCallbackEXT> {
|
) -> VkResult<vk::DebugReportCallbackEXT> {
|
||||||
let mut debug_cb = mem::zeroed();
|
let mut debug_cb = mem::MaybeUninit::uninit();
|
||||||
(self.fp.create_debug_report_callback_ext)(
|
(self.fp.create_debug_report_callback_ext)(
|
||||||
self.handle,
|
self.handle,
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut debug_cb,
|
debug_cb.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(debug_cb)
|
.assume_init_on_success(debug_cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const NAME: &'static CStr = vk::ExtDebugReportFn::NAME;
|
pub const NAME: &'static CStr = vk::ExtDebugReportFn::NAME;
|
||||||
|
|
|
@ -98,14 +98,14 @@ impl DebugUtils {
|
||||||
create_info: &vk::DebugUtilsMessengerCreateInfoEXT<'_>,
|
create_info: &vk::DebugUtilsMessengerCreateInfoEXT<'_>,
|
||||||
allocator: Option<&vk::AllocationCallbacks<'_>>,
|
allocator: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::DebugUtilsMessengerEXT> {
|
) -> VkResult<vk::DebugUtilsMessengerEXT> {
|
||||||
let mut messenger = mem::zeroed();
|
let mut messenger = mem::MaybeUninit::uninit();
|
||||||
(self.fp.create_debug_utils_messenger_ext)(
|
(self.fp.create_debug_utils_messenger_ext)(
|
||||||
self.handle,
|
self.handle,
|
||||||
create_info,
|
create_info,
|
||||||
allocator.as_raw_ptr(),
|
allocator.as_raw_ptr(),
|
||||||
&mut messenger,
|
messenger.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(messenger)
|
.assume_init_on_success(messenger)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyDebugUtilsMessengerEXT.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyDebugUtilsMessengerEXT.html>
|
||||||
|
|
|
@ -26,9 +26,9 @@ impl DescriptorBuffer {
|
||||||
&self,
|
&self,
|
||||||
layout: vk::DescriptorSetLayout,
|
layout: vk::DescriptorSetLayout,
|
||||||
) -> vk::DeviceSize {
|
) -> vk::DeviceSize {
|
||||||
let mut count = 0;
|
let mut count = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_descriptor_set_layout_size_ext)(self.handle, layout, &mut count);
|
(self.fp.get_descriptor_set_layout_size_ext)(self.handle, layout, count.as_mut_ptr());
|
||||||
count
|
count.assume_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDescriptorSetLayoutBindingOffsetEXT.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDescriptorSetLayoutBindingOffsetEXT.html>
|
||||||
|
@ -38,14 +38,14 @@ impl DescriptorBuffer {
|
||||||
layout: vk::DescriptorSetLayout,
|
layout: vk::DescriptorSetLayout,
|
||||||
binding: u32,
|
binding: u32,
|
||||||
) -> vk::DeviceSize {
|
) -> vk::DeviceSize {
|
||||||
let mut offset = 0;
|
let mut offset = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_descriptor_set_layout_binding_offset_ext)(
|
(self.fp.get_descriptor_set_layout_binding_offset_ext)(
|
||||||
self.handle,
|
self.handle,
|
||||||
layout,
|
layout,
|
||||||
binding,
|
binding,
|
||||||
&mut offset,
|
offset.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
offset
|
offset.assume_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDescriptorEXT.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDescriptorEXT.html>
|
||||||
|
|
|
@ -60,13 +60,13 @@ impl FullScreenExclusive {
|
||||||
&self,
|
&self,
|
||||||
surface_info: &vk::PhysicalDeviceSurfaceInfo2KHR<'_>,
|
surface_info: &vk::PhysicalDeviceSurfaceInfo2KHR<'_>,
|
||||||
) -> VkResult<vk::DeviceGroupPresentModeFlagsKHR> {
|
) -> VkResult<vk::DeviceGroupPresentModeFlagsKHR> {
|
||||||
let mut present_modes = mem::zeroed();
|
let mut present_modes = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_device_group_surface_present_modes2_ext)(
|
(self.fp.get_device_group_surface_present_modes2_ext)(
|
||||||
self.handle,
|
self.handle,
|
||||||
surface_info,
|
surface_info,
|
||||||
&mut present_modes,
|
present_modes.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(present_modes)
|
.assume_init_on_success(present_modes)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const NAME: &'static CStr = vk::ExtFullScreenExclusiveFn::NAME;
|
pub const NAME: &'static CStr = vk::ExtFullScreenExclusiveFn::NAME;
|
||||||
|
|
|
@ -28,14 +28,14 @@ impl HeadlessSurface {
|
||||||
create_info: &vk::HeadlessSurfaceCreateInfoEXT<'_>,
|
create_info: &vk::HeadlessSurfaceCreateInfoEXT<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::SurfaceKHR> {
|
) -> VkResult<vk::SurfaceKHR> {
|
||||||
let mut surface = mem::zeroed();
|
let mut surface = mem::MaybeUninit::uninit();
|
||||||
(self.fp.create_headless_surface_ext)(
|
(self.fp.create_headless_surface_ext)(
|
||||||
self.handle,
|
self.handle,
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut surface,
|
surface.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(surface)
|
.assume_init_on_success(surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const NAME: &'static CStr = vk::ExtHeadlessSurfaceFn::NAME;
|
pub const NAME: &'static CStr = vk::ExtHeadlessSurfaceFn::NAME;
|
||||||
|
|
|
@ -27,14 +27,14 @@ impl MetalSurface {
|
||||||
create_info: &vk::MetalSurfaceCreateInfoEXT<'_>,
|
create_info: &vk::MetalSurfaceCreateInfoEXT<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::SurfaceKHR> {
|
) -> VkResult<vk::SurfaceKHR> {
|
||||||
let mut surface = mem::zeroed();
|
let mut surface = mem::MaybeUninit::uninit();
|
||||||
(self.fp.create_metal_surface_ext)(
|
(self.fp.create_metal_surface_ext)(
|
||||||
self.handle,
|
self.handle,
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut surface,
|
surface.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(surface)
|
.assume_init_on_success(surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const NAME: &'static CStr = vk::ExtMetalSurfaceFn::NAME;
|
pub const NAME: &'static CStr = vk::ExtMetalSurfaceFn::NAME;
|
||||||
|
|
|
@ -28,14 +28,14 @@ impl PrivateData {
|
||||||
create_info: &vk::PrivateDataSlotCreateInfoEXT<'_>,
|
create_info: &vk::PrivateDataSlotCreateInfoEXT<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::PrivateDataSlotEXT> {
|
) -> VkResult<vk::PrivateDataSlotEXT> {
|
||||||
let mut private_data_slot = mem::zeroed();
|
let mut private_data_slot = mem::MaybeUninit::uninit();
|
||||||
(self.fp.create_private_data_slot_ext)(
|
(self.fp.create_private_data_slot_ext)(
|
||||||
self.handle,
|
self.handle,
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut private_data_slot,
|
private_data_slot.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(private_data_slot)
|
.assume_init_on_success(private_data_slot)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyPrivateDataSlotEXT.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyPrivateDataSlotEXT.html>
|
||||||
|
@ -77,15 +77,15 @@ impl PrivateData {
|
||||||
object: T,
|
object: T,
|
||||||
private_data_slot: vk::PrivateDataSlotEXT,
|
private_data_slot: vk::PrivateDataSlotEXT,
|
||||||
) -> u64 {
|
) -> u64 {
|
||||||
let mut data = mem::zeroed();
|
let mut data = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_private_data_ext)(
|
(self.fp.get_private_data_ext)(
|
||||||
self.handle,
|
self.handle,
|
||||||
T::TYPE,
|
T::TYPE,
|
||||||
object.as_raw(),
|
object.as_raw(),
|
||||||
private_data_slot,
|
private_data_slot,
|
||||||
&mut data,
|
data.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
data
|
data.assume_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const NAME: &'static CStr = vk::ExtPrivateDataFn::NAME;
|
pub const NAME: &'static CStr = vk::ExtPrivateDataFn::NAME;
|
||||||
|
|
|
@ -37,9 +37,7 @@ impl ShaderObject {
|
||||||
allocator.as_raw_ptr(),
|
allocator.as_raw_ptr(),
|
||||||
shaders.as_mut_ptr(),
|
shaders.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result()?;
|
.set_vec_len_on_success(shaders, create_infos.len())
|
||||||
shaders.set_len(create_infos.len());
|
|
||||||
Ok(shaders)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyShaderEXT.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyShaderEXT.html>
|
||||||
|
|
|
@ -37,9 +37,9 @@ impl DisplayTiming {
|
||||||
&self,
|
&self,
|
||||||
swapchain: vk::SwapchainKHR,
|
swapchain: vk::SwapchainKHR,
|
||||||
) -> VkResult<vk::RefreshCycleDurationGOOGLE> {
|
) -> VkResult<vk::RefreshCycleDurationGOOGLE> {
|
||||||
let mut properties = mem::zeroed();
|
let mut properties = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_refresh_cycle_duration_google)(self.handle, swapchain, &mut properties)
|
(self.fp.get_refresh_cycle_duration_google)(self.handle, swapchain, properties.as_mut_ptr())
|
||||||
.result_with_success(properties)
|
.assume_init_on_success(properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const NAME: &'static CStr = vk::GoogleDisplayTimingFn::NAME;
|
pub const NAME: &'static CStr = vk::GoogleDisplayTimingFn::NAME;
|
||||||
|
|
|
@ -28,14 +28,14 @@ impl AccelerationStructure {
|
||||||
create_info: &vk::AccelerationStructureCreateInfoKHR<'_>,
|
create_info: &vk::AccelerationStructureCreateInfoKHR<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::AccelerationStructureKHR> {
|
) -> VkResult<vk::AccelerationStructureKHR> {
|
||||||
let mut accel_struct = mem::zeroed();
|
let mut accel_struct = mem::MaybeUninit::uninit();
|
||||||
(self.fp.create_acceleration_structure_khr)(
|
(self.fp.create_acceleration_structure_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut accel_struct,
|
accel_struct.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(accel_struct)
|
.assume_init_on_success(accel_struct)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyAccelerationStructureKHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyAccelerationStructureKHR.html>
|
||||||
|
@ -259,15 +259,13 @@ impl AccelerationStructure {
|
||||||
&self,
|
&self,
|
||||||
version: &vk::AccelerationStructureVersionInfoKHR<'_>,
|
version: &vk::AccelerationStructureVersionInfoKHR<'_>,
|
||||||
) -> vk::AccelerationStructureCompatibilityKHR {
|
) -> vk::AccelerationStructureCompatibilityKHR {
|
||||||
let mut compatibility = mem::zeroed();
|
let mut compatibility = mem::MaybeUninit::uninit();
|
||||||
|
|
||||||
(self.fp.get_device_acceleration_structure_compatibility_khr)(
|
(self.fp.get_device_acceleration_structure_compatibility_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
version,
|
version,
|
||||||
&mut compatibility,
|
compatibility.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
|
compatibility.assume_init()
|
||||||
compatibility
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetAccelerationStructureBuildSizesKHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetAccelerationStructureBuildSizesKHR.html>
|
||||||
|
|
|
@ -27,14 +27,14 @@ impl AndroidSurface {
|
||||||
create_info: &vk::AndroidSurfaceCreateInfoKHR<'_>,
|
create_info: &vk::AndroidSurfaceCreateInfoKHR<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::SurfaceKHR> {
|
) -> VkResult<vk::SurfaceKHR> {
|
||||||
let mut surface = mem::zeroed();
|
let mut surface = mem::MaybeUninit::uninit();
|
||||||
(self.fp.create_android_surface_khr)(
|
(self.fp.create_android_surface_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut surface,
|
surface.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(surface)
|
.assume_init_on_success(surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const NAME: &'static CStr = vk::KhrAndroidSurfaceFn::NAME;
|
pub const NAME: &'static CStr = vk::KhrAndroidSurfaceFn::NAME;
|
||||||
|
|
|
@ -27,14 +27,14 @@ impl CreateRenderPass2 {
|
||||||
create_info: &vk::RenderPassCreateInfo2<'_>,
|
create_info: &vk::RenderPassCreateInfo2<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::RenderPass> {
|
) -> VkResult<vk::RenderPass> {
|
||||||
let mut renderpass = mem::zeroed();
|
let mut renderpass = mem::MaybeUninit::uninit();
|
||||||
(self.fp.create_render_pass2_khr)(
|
(self.fp.create_render_pass2_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut renderpass,
|
renderpass.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(renderpass)
|
.assume_init_on_success(renderpass)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBeginRenderPass2.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBeginRenderPass2.html>
|
||||||
|
|
|
@ -26,13 +26,13 @@ impl DeferredHostOperations {
|
||||||
&self,
|
&self,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::DeferredOperationKHR> {
|
) -> VkResult<vk::DeferredOperationKHR> {
|
||||||
let mut operation = mem::zeroed();
|
let mut operation = mem::MaybeUninit::uninit();
|
||||||
(self.fp.create_deferred_operation_khr)(
|
(self.fp.create_deferred_operation_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut operation,
|
operation.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(operation)
|
.assume_init_on_success(operation)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDeferredOperationJoinKHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDeferredOperationJoinKHR.html>
|
||||||
|
|
|
@ -30,15 +30,15 @@ impl DeviceGroup {
|
||||||
local_device_index: u32,
|
local_device_index: u32,
|
||||||
remote_device_index: u32,
|
remote_device_index: u32,
|
||||||
) -> vk::PeerMemoryFeatureFlags {
|
) -> vk::PeerMemoryFeatureFlags {
|
||||||
let mut peer_memory_features = mem::zeroed();
|
let mut peer_memory_features = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_device_group_peer_memory_features_khr)(
|
(self.fp.get_device_group_peer_memory_features_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
heap_index,
|
heap_index,
|
||||||
local_device_index,
|
local_device_index,
|
||||||
remote_device_index,
|
remote_device_index,
|
||||||
&mut peer_memory_features,
|
peer_memory_features.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
peer_memory_features
|
peer_memory_features.assume_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDeviceMaskKHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDeviceMaskKHR.html>
|
||||||
|
@ -99,9 +99,13 @@ impl DeviceGroup {
|
||||||
&self,
|
&self,
|
||||||
surface: vk::SurfaceKHR,
|
surface: vk::SurfaceKHR,
|
||||||
) -> VkResult<vk::DeviceGroupPresentModeFlagsKHR> {
|
) -> VkResult<vk::DeviceGroupPresentModeFlagsKHR> {
|
||||||
let mut modes = mem::zeroed();
|
let mut modes = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_device_group_surface_present_modes_khr)(self.handle, surface, &mut modes)
|
(self.fp.get_device_group_surface_present_modes_khr)(
|
||||||
.result_with_success(modes)
|
self.handle,
|
||||||
|
surface,
|
||||||
|
modes.as_mut_ptr(),
|
||||||
|
)
|
||||||
|
.assume_init_on_success(modes)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Requires [`VK_KHR_surface`] to be enabled.
|
/// Requires [`VK_KHR_surface`] to be enabled.
|
||||||
|
@ -143,11 +147,12 @@ impl DeviceGroup {
|
||||||
&self,
|
&self,
|
||||||
acquire_info: &vk::AcquireNextImageInfoKHR<'_>,
|
acquire_info: &vk::AcquireNextImageInfoKHR<'_>,
|
||||||
) -> VkResult<(u32, bool)> {
|
) -> VkResult<(u32, bool)> {
|
||||||
let mut index = 0;
|
let mut index = mem::MaybeUninit::uninit();
|
||||||
let err_code = (self.fp.acquire_next_image2_khr)(self.handle, acquire_info, &mut index);
|
let err_code =
|
||||||
|
(self.fp.acquire_next_image2_khr)(self.handle, acquire_info, index.as_mut_ptr());
|
||||||
match err_code {
|
match err_code {
|
||||||
vk::Result::SUCCESS => Ok((index, false)),
|
vk::Result::SUCCESS => Ok((index.assume_init(), false)),
|
||||||
vk::Result::SUBOPTIMAL_KHR => Ok((index, true)),
|
vk::Result::SUBOPTIMAL_KHR => Ok((index.assume_init(), true)),
|
||||||
_ => Err(err_code),
|
_ => Err(err_code),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,13 +24,14 @@ impl DeviceGroupCreation {
|
||||||
/// Retrieve the number of elements to pass to [`enumerate_physical_device_groups()`][Self::enumerate_physical_device_groups()]
|
/// Retrieve the number of elements to pass to [`enumerate_physical_device_groups()`][Self::enumerate_physical_device_groups()]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn enumerate_physical_device_groups_len(&self) -> VkResult<usize> {
|
pub unsafe fn enumerate_physical_device_groups_len(&self) -> VkResult<usize> {
|
||||||
let mut group_count = 0;
|
let mut group_count = mem::MaybeUninit::uninit();
|
||||||
(self.fp.enumerate_physical_device_groups_khr)(
|
(self.fp.enumerate_physical_device_groups_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
&mut group_count,
|
group_count.as_mut_ptr(),
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
)
|
)
|
||||||
.result_with_success(group_count as usize)
|
.assume_init_on_success(group_count)
|
||||||
|
.map(|c| c as usize)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumeratePhysicalDeviceGroupsKHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumeratePhysicalDeviceGroupsKHR.html>
|
||||||
|
|
|
@ -80,7 +80,7 @@ impl Display {
|
||||||
create_info: &vk::DisplayModeCreateInfoKHR<'_>,
|
create_info: &vk::DisplayModeCreateInfoKHR<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::DisplayModeKHR> {
|
) -> VkResult<vk::DisplayModeKHR> {
|
||||||
let mut display_mode = mem::MaybeUninit::zeroed();
|
let mut display_mode = mem::MaybeUninit::uninit();
|
||||||
(self.fp.create_display_mode_khr)(
|
(self.fp.create_display_mode_khr)(
|
||||||
physical_device,
|
physical_device,
|
||||||
display,
|
display,
|
||||||
|
@ -99,7 +99,7 @@ impl Display {
|
||||||
mode: vk::DisplayModeKHR,
|
mode: vk::DisplayModeKHR,
|
||||||
plane_index: u32,
|
plane_index: u32,
|
||||||
) -> VkResult<vk::DisplayPlaneCapabilitiesKHR> {
|
) -> VkResult<vk::DisplayPlaneCapabilitiesKHR> {
|
||||||
let mut display_plane_capabilities = mem::MaybeUninit::zeroed();
|
let mut display_plane_capabilities = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_display_plane_capabilities_khr)(
|
(self.fp.get_display_plane_capabilities_khr)(
|
||||||
physical_device,
|
physical_device,
|
||||||
mode,
|
mode,
|
||||||
|
@ -116,7 +116,7 @@ impl Display {
|
||||||
create_info: &vk::DisplaySurfaceCreateInfoKHR<'_>,
|
create_info: &vk::DisplaySurfaceCreateInfoKHR<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::SurfaceKHR> {
|
) -> VkResult<vk::SurfaceKHR> {
|
||||||
let mut surface = mem::MaybeUninit::zeroed();
|
let mut surface = mem::MaybeUninit::uninit();
|
||||||
(self.fp.create_display_plane_surface_khr)(
|
(self.fp.create_display_plane_surface_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
create_info,
|
create_info,
|
||||||
|
|
|
@ -35,9 +35,7 @@ impl DisplaySwapchain {
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
swapchains.as_mut_ptr(),
|
swapchains.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result()?;
|
.set_vec_len_on_success(swapchains, create_infos.len())
|
||||||
swapchains.set_len(create_infos.len());
|
|
||||||
Ok(swapchains)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const NAME: &'static CStr = vk::KhrDisplaySwapchainFn::NAME;
|
pub const NAME: &'static CStr = vk::KhrDisplaySwapchainFn::NAME;
|
||||||
|
|
|
@ -31,8 +31,9 @@ impl ExternalFenceFd {
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetFenceFdKHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetFenceFdKHR.html>
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn get_fence_fd(&self, get_info: &vk::FenceGetFdInfoKHR<'_>) -> VkResult<i32> {
|
pub unsafe fn get_fence_fd(&self, get_info: &vk::FenceGetFdInfoKHR<'_>) -> VkResult<i32> {
|
||||||
let mut fd = -1;
|
let mut fd = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_fence_fd_khr)(self.handle, get_info, &mut fd).result_with_success(fd)
|
(self.fp.get_fence_fd_khr)(self.handle, get_info, fd.as_mut_ptr())
|
||||||
|
.assume_init_on_success(fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const NAME: &'static CStr = vk::KhrExternalFenceFdFn::NAME;
|
pub const NAME: &'static CStr = vk::KhrExternalFenceFdFn::NAME;
|
||||||
|
|
|
@ -3,7 +3,6 @@ use crate::vk;
|
||||||
use crate::{Device, Instance};
|
use crate::{Device, Instance};
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::mem::MaybeUninit;
|
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_fence_win32.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_fence_win32.html>
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
@ -36,7 +35,7 @@ impl ExternalFenceWin32 {
|
||||||
&self,
|
&self,
|
||||||
get_info: &vk::FenceGetWin32HandleInfoKHR<'_>,
|
get_info: &vk::FenceGetWin32HandleInfoKHR<'_>,
|
||||||
) -> VkResult<vk::HANDLE> {
|
) -> VkResult<vk::HANDLE> {
|
||||||
let mut handle = MaybeUninit::uninit();
|
let mut handle = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_fence_win32_handle_khr)(self.handle, get_info, handle.as_mut_ptr())
|
(self.fp.get_fence_win32_handle_khr)(self.handle, get_info, handle.as_mut_ptr())
|
||||||
.assume_init_on_success(handle)
|
.assume_init_on_success(handle)
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,9 @@ impl ExternalMemoryFd {
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetMemoryFdKHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetMemoryFdKHR.html>
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn get_memory_fd(&self, get_fd_info: &vk::MemoryGetFdInfoKHR<'_>) -> VkResult<i32> {
|
pub unsafe fn get_memory_fd(&self, get_fd_info: &vk::MemoryGetFdInfoKHR<'_>) -> VkResult<i32> {
|
||||||
let mut fd = -1;
|
let mut fd = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_memory_fd_khr)(self.handle, get_fd_info, &mut fd).result_with_success(fd)
|
(self.fp.get_memory_fd_khr)(self.handle, get_fd_info, fd.as_mut_ptr())
|
||||||
|
.assume_init_on_success(fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetMemoryFdPropertiesKHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetMemoryFdPropertiesKHR.html>
|
||||||
|
|
|
@ -3,7 +3,6 @@ use crate::vk;
|
||||||
use crate::{Device, Instance};
|
use crate::{Device, Instance};
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::mem::MaybeUninit;
|
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_memory_win32.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_memory_win32.html>
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
@ -27,7 +26,7 @@ impl ExternalMemoryWin32 {
|
||||||
&self,
|
&self,
|
||||||
create_info: &vk::MemoryGetWin32HandleInfoKHR<'_>,
|
create_info: &vk::MemoryGetWin32HandleInfoKHR<'_>,
|
||||||
) -> VkResult<vk::HANDLE> {
|
) -> VkResult<vk::HANDLE> {
|
||||||
let mut handle = MaybeUninit::uninit();
|
let mut handle = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_memory_win32_handle_khr)(self.handle, create_info, handle.as_mut_ptr())
|
(self.fp.get_memory_win32_handle_khr)(self.handle, create_info, handle.as_mut_ptr())
|
||||||
.assume_init_on_success(handle)
|
.assume_init_on_success(handle)
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,8 +34,9 @@ impl ExternalSemaphoreFd {
|
||||||
&self,
|
&self,
|
||||||
get_info: &vk::SemaphoreGetFdInfoKHR<'_>,
|
get_info: &vk::SemaphoreGetFdInfoKHR<'_>,
|
||||||
) -> VkResult<i32> {
|
) -> VkResult<i32> {
|
||||||
let mut fd = -1;
|
let mut fd = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_semaphore_fd_khr)(self.handle, get_info, &mut fd).result_with_success(fd)
|
(self.fp.get_semaphore_fd_khr)(self.handle, get_info, fd.as_mut_ptr())
|
||||||
|
.assume_init_on_success(fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const NAME: &'static CStr = vk::KhrExternalSemaphoreFdFn::NAME;
|
pub const NAME: &'static CStr = vk::KhrExternalSemaphoreFdFn::NAME;
|
||||||
|
|
|
@ -3,7 +3,6 @@ use crate::vk;
|
||||||
use crate::{Device, Instance};
|
use crate::{Device, Instance};
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::mem::MaybeUninit;
|
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_semaphore_win32.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_external_semaphore_win32.html>
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
@ -36,7 +35,7 @@ impl ExternalSemaphoreWin32 {
|
||||||
&self,
|
&self,
|
||||||
get_info: &vk::SemaphoreGetWin32HandleInfoKHR<'_>,
|
get_info: &vk::SemaphoreGetWin32HandleInfoKHR<'_>,
|
||||||
) -> VkResult<vk::HANDLE> {
|
) -> VkResult<vk::HANDLE> {
|
||||||
let mut handle = MaybeUninit::uninit();
|
let mut handle = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_semaphore_win32_handle_khr)(self.handle, get_info, handle.as_mut_ptr())
|
(self.fp.get_semaphore_win32_handle_khr)(self.handle, get_info, handle.as_mut_ptr())
|
||||||
.assume_init_on_success(handle)
|
.assume_init_on_success(handle)
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,14 +45,14 @@ impl GetMemoryRequirements2 {
|
||||||
&self,
|
&self,
|
||||||
info: &vk::ImageSparseMemoryRequirementsInfo2KHR<'_>,
|
info: &vk::ImageSparseMemoryRequirementsInfo2KHR<'_>,
|
||||||
) -> usize {
|
) -> usize {
|
||||||
let mut count = 0;
|
let mut count = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_image_sparse_memory_requirements2_khr)(
|
(self.fp.get_image_sparse_memory_requirements2_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
info,
|
info,
|
||||||
&mut count,
|
count.as_mut_ptr(),
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
);
|
);
|
||||||
count as usize
|
count.assume_init() as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageSparseMemoryRequirements2KHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageSparseMemoryRequirements2KHR.html>
|
||||||
|
|
|
@ -85,13 +85,13 @@ impl GetPhysicalDeviceProperties2 {
|
||||||
&self,
|
&self,
|
||||||
physical_device: vk::PhysicalDevice,
|
physical_device: vk::PhysicalDevice,
|
||||||
) -> usize {
|
) -> usize {
|
||||||
let mut count = 0;
|
let mut count = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_physical_device_queue_family_properties2_khr)(
|
(self.fp.get_physical_device_queue_family_properties2_khr)(
|
||||||
physical_device,
|
physical_device,
|
||||||
&mut count,
|
count.as_mut_ptr(),
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
);
|
);
|
||||||
count as usize
|
count.assume_init() as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceQueueFamilyProperties2KHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceQueueFamilyProperties2KHR.html>
|
||||||
|
@ -120,16 +120,16 @@ impl GetPhysicalDeviceProperties2 {
|
||||||
physical_device: vk::PhysicalDevice,
|
physical_device: vk::PhysicalDevice,
|
||||||
format_info: &vk::PhysicalDeviceSparseImageFormatInfo2KHR<'_>,
|
format_info: &vk::PhysicalDeviceSparseImageFormatInfo2KHR<'_>,
|
||||||
) -> usize {
|
) -> usize {
|
||||||
let mut count = 0;
|
let mut count = mem::MaybeUninit::uninit();
|
||||||
(self
|
(self
|
||||||
.fp
|
.fp
|
||||||
.get_physical_device_sparse_image_format_properties2_khr)(
|
.get_physical_device_sparse_image_format_properties2_khr)(
|
||||||
physical_device,
|
physical_device,
|
||||||
format_info,
|
format_info,
|
||||||
&mut count,
|
count.as_mut_ptr(),
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
);
|
);
|
||||||
count as usize
|
count.assume_init() as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSparseImageFormatProperties2KHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSparseImageFormatProperties2KHR.html>
|
||||||
|
|
|
@ -41,14 +41,14 @@ impl GetSurfaceCapabilities2 {
|
||||||
physical_device: vk::PhysicalDevice,
|
physical_device: vk::PhysicalDevice,
|
||||||
surface_info: &vk::PhysicalDeviceSurfaceInfo2KHR<'_>,
|
surface_info: &vk::PhysicalDeviceSurfaceInfo2KHR<'_>,
|
||||||
) -> VkResult<usize> {
|
) -> VkResult<usize> {
|
||||||
let mut count = 0;
|
let mut count = mem::MaybeUninit::uninit();
|
||||||
let err_code = (self.fp.get_physical_device_surface_formats2_khr)(
|
let err_code = (self.fp.get_physical_device_surface_formats2_khr)(
|
||||||
physical_device,
|
physical_device,
|
||||||
surface_info,
|
surface_info,
|
||||||
&mut count,
|
count.as_mut_ptr(),
|
||||||
std::ptr::null_mut(),
|
std::ptr::null_mut(),
|
||||||
);
|
);
|
||||||
err_code.result_with_success(count as usize)
|
err_code.assume_init_on_success(count).map(|c| c as usize)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfaceFormats2KHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfaceFormats2KHR.html>
|
||||||
|
|
|
@ -45,14 +45,14 @@ impl Maintenance4 {
|
||||||
&self,
|
&self,
|
||||||
memory_requirements: &vk::DeviceImageMemoryRequirementsKHR<'_>,
|
memory_requirements: &vk::DeviceImageMemoryRequirementsKHR<'_>,
|
||||||
) -> usize {
|
) -> usize {
|
||||||
let mut count = 0;
|
let mut count = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_device_image_sparse_memory_requirements_khr)(
|
(self.fp.get_device_image_sparse_memory_requirements_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
memory_requirements,
|
memory_requirements,
|
||||||
&mut count,
|
count.as_mut_ptr(),
|
||||||
std::ptr::null_mut(),
|
std::ptr::null_mut(),
|
||||||
);
|
);
|
||||||
count as usize
|
count.assume_init() as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceImageSparseMemoryRequirementsKHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceImageSparseMemoryRequirementsKHR.html>
|
||||||
|
|
|
@ -40,13 +40,13 @@ impl Maintenance5 {
|
||||||
&self,
|
&self,
|
||||||
rendering_area_info: &vk::RenderingAreaInfoKHR<'_>,
|
rendering_area_info: &vk::RenderingAreaInfoKHR<'_>,
|
||||||
) -> vk::Extent2D {
|
) -> vk::Extent2D {
|
||||||
let mut granularity = mem::zeroed();
|
let mut granularity = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_rendering_area_granularity_khr)(
|
(self.fp.get_rendering_area_granularity_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
rendering_area_info,
|
rendering_area_info,
|
||||||
&mut granularity,
|
granularity.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
granularity
|
granularity.assume_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetDeviceImageSubresourceLayoutKHR.html>
|
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetDeviceImageSubresourceLayoutKHR.html>
|
||||||
|
|
|
@ -28,17 +28,18 @@ impl PerformanceQuery {
|
||||||
physical_device: vk::PhysicalDevice,
|
physical_device: vk::PhysicalDevice,
|
||||||
queue_family_index: u32,
|
queue_family_index: u32,
|
||||||
) -> VkResult<usize> {
|
) -> VkResult<usize> {
|
||||||
let mut count = 0;
|
let mut count = mem::MaybeUninit::uninit();
|
||||||
(self
|
(self
|
||||||
.fp
|
.fp
|
||||||
.enumerate_physical_device_queue_family_performance_query_counters_khr)(
|
.enumerate_physical_device_queue_family_performance_query_counters_khr)(
|
||||||
physical_device,
|
physical_device,
|
||||||
queue_family_index,
|
queue_family_index,
|
||||||
&mut count,
|
count.as_mut_ptr(),
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
)
|
)
|
||||||
.result_with_success(count as usize)
|
.assume_init_on_success(count)
|
||||||
|
.map(|c| c as usize)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR.html>
|
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR.html>
|
||||||
|
@ -77,15 +78,15 @@ impl PerformanceQuery {
|
||||||
physical_device: vk::PhysicalDevice,
|
physical_device: vk::PhysicalDevice,
|
||||||
performance_query_create_info: &vk::QueryPoolPerformanceCreateInfoKHR<'_>,
|
performance_query_create_info: &vk::QueryPoolPerformanceCreateInfoKHR<'_>,
|
||||||
) -> u32 {
|
) -> u32 {
|
||||||
let mut num_passes = 0;
|
let mut num_passes = mem::MaybeUninit::uninit();
|
||||||
(self
|
(self
|
||||||
.fp
|
.fp
|
||||||
.get_physical_device_queue_family_performance_query_passes_khr)(
|
.get_physical_device_queue_family_performance_query_passes_khr)(
|
||||||
physical_device,
|
physical_device,
|
||||||
performance_query_create_info,
|
performance_query_create_info,
|
||||||
&mut num_passes,
|
num_passes.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
num_passes
|
num_passes.assume_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkAcquireProfilingLockKHR.html>
|
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkAcquireProfilingLockKHR.html>
|
||||||
|
|
|
@ -54,7 +54,7 @@ impl RayTracingPipeline {
|
||||||
create_info: &[vk::RayTracingPipelineCreateInfoKHR<'_>],
|
create_info: &[vk::RayTracingPipelineCreateInfoKHR<'_>],
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<Vec<vk::Pipeline>> {
|
) -> VkResult<Vec<vk::Pipeline>> {
|
||||||
let mut pipelines = vec![mem::zeroed(); create_info.len()];
|
let mut pipelines = Vec::with_capacity(create_info.len());
|
||||||
(self.fp.create_ray_tracing_pipelines_khr)(
|
(self.fp.create_ray_tracing_pipelines_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
deferred_operation,
|
deferred_operation,
|
||||||
|
@ -64,7 +64,7 @@ impl RayTracingPipeline {
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
pipelines.as_mut_ptr(),
|
pipelines.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(pipelines)
|
.set_vec_len_on_success(pipelines, create_info.len())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetRayTracingShaderGroupHandlesKHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetRayTracingShaderGroupHandlesKHR.html>
|
||||||
|
@ -85,9 +85,7 @@ impl RayTracingPipeline {
|
||||||
data_size,
|
data_size,
|
||||||
data.as_mut_ptr().cast(),
|
data.as_mut_ptr().cast(),
|
||||||
)
|
)
|
||||||
.result()?;
|
.set_vec_len_on_success(data, data_size)
|
||||||
data.set_len(data_size);
|
|
||||||
Ok(data)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetRayTracingCaptureReplayShaderGroupHandlesKHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetRayTracingCaptureReplayShaderGroupHandlesKHR.html>
|
||||||
|
@ -110,9 +108,7 @@ impl RayTracingPipeline {
|
||||||
data_size,
|
data_size,
|
||||||
data.as_mut_ptr().cast(),
|
data.as_mut_ptr().cast(),
|
||||||
)
|
)
|
||||||
.result()?;
|
.set_vec_len_on_success(data, data_size)
|
||||||
data.set_len(data_size);
|
|
||||||
Ok(data)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdTraceRaysIndirectKHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdTraceRaysIndirectKHR.html>
|
||||||
|
|
|
@ -28,14 +28,14 @@ impl SamplerYcbcrConversion {
|
||||||
create_info: &vk::SamplerYcbcrConversionCreateInfo<'_>,
|
create_info: &vk::SamplerYcbcrConversionCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::SamplerYcbcrConversion> {
|
) -> VkResult<vk::SamplerYcbcrConversion> {
|
||||||
let mut ycbcr_conversion = mem::zeroed();
|
let mut ycbcr_conversion = mem::MaybeUninit::uninit();
|
||||||
(self.fp.create_sampler_ycbcr_conversion_khr)(
|
(self.fp.create_sampler_ycbcr_conversion_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut ycbcr_conversion,
|
ycbcr_conversion.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(ycbcr_conversion)
|
.assume_init_on_success(ycbcr_conversion)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroySamplerYcbcrConversion.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroySamplerYcbcrConversion.html>
|
||||||
|
|
|
@ -28,14 +28,15 @@ impl Surface {
|
||||||
queue_family_index: u32,
|
queue_family_index: u32,
|
||||||
surface: vk::SurfaceKHR,
|
surface: vk::SurfaceKHR,
|
||||||
) -> VkResult<bool> {
|
) -> VkResult<bool> {
|
||||||
let mut b = 0;
|
let mut b = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_physical_device_surface_support_khr)(
|
(self.fp.get_physical_device_surface_support_khr)(
|
||||||
physical_device,
|
physical_device,
|
||||||
queue_family_index,
|
queue_family_index,
|
||||||
surface,
|
surface,
|
||||||
&mut b,
|
b.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(b > 0)
|
.result()?;
|
||||||
|
Ok(b.assume_init() > 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfacePresentModesKHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfacePresentModesKHR.html>
|
||||||
|
@ -62,13 +63,13 @@ impl Surface {
|
||||||
physical_device: vk::PhysicalDevice,
|
physical_device: vk::PhysicalDevice,
|
||||||
surface: vk::SurfaceKHR,
|
surface: vk::SurfaceKHR,
|
||||||
) -> VkResult<vk::SurfaceCapabilitiesKHR> {
|
) -> VkResult<vk::SurfaceCapabilitiesKHR> {
|
||||||
let mut surface_capabilities = mem::zeroed();
|
let mut surface_capabilities = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_physical_device_surface_capabilities_khr)(
|
(self.fp.get_physical_device_surface_capabilities_khr)(
|
||||||
physical_device,
|
physical_device,
|
||||||
surface,
|
surface,
|
||||||
&mut surface_capabilities,
|
surface_capabilities.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(surface_capabilities)
|
.assume_init_on_success(surface_capabilities)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfaceFormatsKHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfaceFormatsKHR.html>
|
||||||
|
|
|
@ -29,14 +29,14 @@ impl Swapchain {
|
||||||
create_info: &vk::SwapchainCreateInfoKHR<'_>,
|
create_info: &vk::SwapchainCreateInfoKHR<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::SwapchainKHR> {
|
) -> VkResult<vk::SwapchainKHR> {
|
||||||
let mut swapchain = mem::zeroed();
|
let mut swapchain = mem::MaybeUninit::uninit();
|
||||||
(self.fp.create_swapchain_khr)(
|
(self.fp.create_swapchain_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut swapchain,
|
swapchain.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(swapchain)
|
.assume_init_on_success(swapchain)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroySwapchainKHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroySwapchainKHR.html>
|
||||||
|
@ -71,18 +71,18 @@ impl Swapchain {
|
||||||
semaphore: vk::Semaphore,
|
semaphore: vk::Semaphore,
|
||||||
fence: vk::Fence,
|
fence: vk::Fence,
|
||||||
) -> VkResult<(u32, bool)> {
|
) -> VkResult<(u32, bool)> {
|
||||||
let mut index = 0;
|
let mut index = mem::MaybeUninit::uninit();
|
||||||
let err_code = (self.fp.acquire_next_image_khr)(
|
let err_code = (self.fp.acquire_next_image_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
swapchain,
|
swapchain,
|
||||||
timeout,
|
timeout,
|
||||||
semaphore,
|
semaphore,
|
||||||
fence,
|
fence,
|
||||||
&mut index,
|
index.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
match err_code {
|
match err_code {
|
||||||
vk::Result::SUCCESS => Ok((index, false)),
|
vk::Result::SUCCESS => Ok((index.assume_init(), false)),
|
||||||
vk::Result::SUBOPTIMAL_KHR => Ok((index, true)),
|
vk::Result::SUBOPTIMAL_KHR => Ok((index.assume_init(), true)),
|
||||||
_ => Err(err_code),
|
_ => Err(err_code),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,9 +139,13 @@ impl Swapchain {
|
||||||
&self,
|
&self,
|
||||||
surface: vk::SurfaceKHR,
|
surface: vk::SurfaceKHR,
|
||||||
) -> VkResult<vk::DeviceGroupPresentModeFlagsKHR> {
|
) -> VkResult<vk::DeviceGroupPresentModeFlagsKHR> {
|
||||||
let mut modes = mem::zeroed();
|
let mut modes = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_device_group_surface_present_modes_khr)(self.handle, surface, &mut modes)
|
(self.fp.get_device_group_surface_present_modes_khr)(
|
||||||
.result_with_success(modes)
|
self.handle,
|
||||||
|
surface,
|
||||||
|
modes.as_mut_ptr(),
|
||||||
|
)
|
||||||
|
.assume_init_on_success(modes)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Only available since [Vulkan 1.1].
|
/// Only available since [Vulkan 1.1].
|
||||||
|
@ -185,11 +189,12 @@ impl Swapchain {
|
||||||
&self,
|
&self,
|
||||||
acquire_info: &vk::AcquireNextImageInfoKHR<'_>,
|
acquire_info: &vk::AcquireNextImageInfoKHR<'_>,
|
||||||
) -> VkResult<(u32, bool)> {
|
) -> VkResult<(u32, bool)> {
|
||||||
let mut index = 0;
|
let mut index = mem::MaybeUninit::uninit();
|
||||||
let err_code = (self.fp.acquire_next_image2_khr)(self.handle, acquire_info, &mut index);
|
let err_code =
|
||||||
|
(self.fp.acquire_next_image2_khr)(self.handle, acquire_info, index.as_mut_ptr());
|
||||||
match err_code {
|
match err_code {
|
||||||
vk::Result::SUCCESS => Ok((index, false)),
|
vk::Result::SUCCESS => Ok((index.assume_init(), false)),
|
||||||
vk::Result::SUBOPTIMAL_KHR => Ok((index, true)),
|
vk::Result::SUBOPTIMAL_KHR => Ok((index.assume_init(), true)),
|
||||||
_ => Err(err_code),
|
_ => Err(err_code),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,9 @@ impl TimelineSemaphore {
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetSemaphoreCounterValue.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetSemaphoreCounterValue.html>
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn get_semaphore_counter_value(&self, semaphore: vk::Semaphore) -> VkResult<u64> {
|
pub unsafe fn get_semaphore_counter_value(&self, semaphore: vk::Semaphore) -> VkResult<u64> {
|
||||||
let mut value = 0;
|
let mut value = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_semaphore_counter_value_khr)(self.handle, semaphore, &mut value)
|
(self.fp.get_semaphore_counter_value_khr)(self.handle, semaphore, value.as_mut_ptr())
|
||||||
.result_with_success(value)
|
.assume_init_on_success(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkWaitSemaphores.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkWaitSemaphores.html>
|
||||||
|
|
|
@ -27,14 +27,14 @@ impl WaylandSurface {
|
||||||
create_info: &vk::WaylandSurfaceCreateInfoKHR<'_>,
|
create_info: &vk::WaylandSurfaceCreateInfoKHR<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::SurfaceKHR> {
|
) -> VkResult<vk::SurfaceKHR> {
|
||||||
let mut surface = mem::zeroed();
|
let mut surface = mem::MaybeUninit::uninit();
|
||||||
(self.fp.create_wayland_surface_khr)(
|
(self.fp.create_wayland_surface_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut surface,
|
surface.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(surface)
|
.assume_init_on_success(surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceWaylandPresentationSupportKHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceWaylandPresentationSupportKHR.html>
|
||||||
|
|
|
@ -27,14 +27,14 @@ impl Win32Surface {
|
||||||
create_info: &vk::Win32SurfaceCreateInfoKHR<'_>,
|
create_info: &vk::Win32SurfaceCreateInfoKHR<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::SurfaceKHR> {
|
) -> VkResult<vk::SurfaceKHR> {
|
||||||
let mut surface = mem::zeroed();
|
let mut surface = mem::MaybeUninit::uninit();
|
||||||
(self.fp.create_win32_surface_khr)(
|
(self.fp.create_win32_surface_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut surface,
|
surface.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(surface)
|
.assume_init_on_success(surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceWin32PresentationSupportKHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceWin32PresentationSupportKHR.html>
|
||||||
|
|
|
@ -27,14 +27,14 @@ impl XcbSurface {
|
||||||
create_info: &vk::XcbSurfaceCreateInfoKHR<'_>,
|
create_info: &vk::XcbSurfaceCreateInfoKHR<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::SurfaceKHR> {
|
) -> VkResult<vk::SurfaceKHR> {
|
||||||
let mut surface = mem::zeroed();
|
let mut surface = mem::MaybeUninit::uninit();
|
||||||
(self.fp.create_xcb_surface_khr)(
|
(self.fp.create_xcb_surface_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut surface,
|
surface.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(surface)
|
.assume_init_on_success(surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceXcbPresentationSupportKHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceXcbPresentationSupportKHR.html>
|
||||||
|
|
|
@ -27,14 +27,14 @@ impl XlibSurface {
|
||||||
create_info: &vk::XlibSurfaceCreateInfoKHR<'_>,
|
create_info: &vk::XlibSurfaceCreateInfoKHR<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::SurfaceKHR> {
|
) -> VkResult<vk::SurfaceKHR> {
|
||||||
let mut surface = mem::zeroed();
|
let mut surface = mem::MaybeUninit::uninit();
|
||||||
(self.fp.create_xlib_surface_khr)(
|
(self.fp.create_xlib_surface_khr)(
|
||||||
self.handle,
|
self.handle,
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut surface,
|
surface.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(surface)
|
.assume_init_on_success(surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceXlibPresentationSupportKHR.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceXlibPresentationSupportKHR.html>
|
||||||
|
|
|
@ -27,14 +27,14 @@ impl IOSSurface {
|
||||||
create_info: &vk::IOSSurfaceCreateInfoMVK<'_>,
|
create_info: &vk::IOSSurfaceCreateInfoMVK<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::SurfaceKHR> {
|
) -> VkResult<vk::SurfaceKHR> {
|
||||||
let mut surface = mem::zeroed();
|
let mut surface = mem::MaybeUninit::uninit();
|
||||||
(self.fp.create_ios_surface_mvk)(
|
(self.fp.create_ios_surface_mvk)(
|
||||||
self.handle,
|
self.handle,
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut surface,
|
surface.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(surface)
|
.assume_init_on_success(surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const NAME: &'static CStr = vk::MvkIosSurfaceFn::NAME;
|
pub const NAME: &'static CStr = vk::MvkIosSurfaceFn::NAME;
|
||||||
|
|
|
@ -27,14 +27,14 @@ impl MacOSSurface {
|
||||||
create_info: &vk::MacOSSurfaceCreateInfoMVK<'_>,
|
create_info: &vk::MacOSSurfaceCreateInfoMVK<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::SurfaceKHR> {
|
) -> VkResult<vk::SurfaceKHR> {
|
||||||
let mut surface = mem::zeroed();
|
let mut surface = mem::MaybeUninit::uninit();
|
||||||
(self.fp.create_mac_os_surface_mvk)(
|
(self.fp.create_mac_os_surface_mvk)(
|
||||||
self.handle,
|
self.handle,
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut surface,
|
surface.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(surface)
|
.assume_init_on_success(surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const NAME: &'static CStr = vk::MvkMacosSurfaceFn::NAME;
|
pub const NAME: &'static CStr = vk::MvkMacosSurfaceFn::NAME;
|
||||||
|
|
|
@ -27,14 +27,14 @@ impl ViSurface {
|
||||||
create_info: &vk::ViSurfaceCreateInfoNN<'_>,
|
create_info: &vk::ViSurfaceCreateInfoNN<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::SurfaceKHR> {
|
) -> VkResult<vk::SurfaceKHR> {
|
||||||
let mut surface = mem::zeroed();
|
let mut surface = mem::MaybeUninit::uninit();
|
||||||
(self.fp.create_vi_surface_nn)(
|
(self.fp.create_vi_surface_nn)(
|
||||||
self.handle,
|
self.handle,
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut surface,
|
surface.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(surface)
|
.assume_init_on_success(surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const NAME: &'static CStr = vk::NnViSurfaceFn::NAME;
|
pub const NAME: &'static CStr = vk::NnViSurfaceFn::NAME;
|
||||||
|
|
|
@ -24,15 +24,16 @@ impl CoverageReductionMode {
|
||||||
&self,
|
&self,
|
||||||
physical_device: vk::PhysicalDevice,
|
physical_device: vk::PhysicalDevice,
|
||||||
) -> VkResult<usize> {
|
) -> VkResult<usize> {
|
||||||
let mut count = 0;
|
let mut count = mem::MaybeUninit::uninit();
|
||||||
(self
|
(self
|
||||||
.fp
|
.fp
|
||||||
.get_physical_device_supported_framebuffer_mixed_samples_combinations_nv)(
|
.get_physical_device_supported_framebuffer_mixed_samples_combinations_nv)(
|
||||||
physical_device,
|
physical_device,
|
||||||
&mut count,
|
count.as_mut_ptr(),
|
||||||
std::ptr::null_mut(),
|
std::ptr::null_mut(),
|
||||||
)
|
)
|
||||||
.result_with_success(count as usize)
|
.assume_init_on_success(count)
|
||||||
|
.map(|c| c as usize)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV.html>
|
||||||
|
|
|
@ -31,9 +31,9 @@ impl DeviceDiagnosticCheckpoints {
|
||||||
/// Retrieve the number of elements to pass to [`get_queue_checkpoint_data()`][Self::get_queue_checkpoint_data()]
|
/// Retrieve the number of elements to pass to [`get_queue_checkpoint_data()`][Self::get_queue_checkpoint_data()]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn get_queue_checkpoint_data_len(&self, queue: vk::Queue) -> usize {
|
pub unsafe fn get_queue_checkpoint_data_len(&self, queue: vk::Queue) -> usize {
|
||||||
let mut count = 0;
|
let mut count = mem::MaybeUninit::uninit();
|
||||||
(self.fp.get_queue_checkpoint_data_nv)(queue, &mut count, std::ptr::null_mut());
|
(self.fp.get_queue_checkpoint_data_nv)(queue, count.as_mut_ptr(), std::ptr::null_mut());
|
||||||
count as usize
|
count.assume_init() as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetQueueCheckpointDataNV.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetQueueCheckpointDataNV.html>
|
||||||
|
|
|
@ -27,14 +27,14 @@ impl RayTracing {
|
||||||
create_info: &vk::AccelerationStructureCreateInfoNV<'_>,
|
create_info: &vk::AccelerationStructureCreateInfoNV<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<vk::AccelerationStructureNV> {
|
) -> VkResult<vk::AccelerationStructureNV> {
|
||||||
let mut accel_struct = mem::zeroed();
|
let mut accel_struct = mem::MaybeUninit::uninit();
|
||||||
(self.fp.create_acceleration_structure_nv)(
|
(self.fp.create_acceleration_structure_nv)(
|
||||||
self.handle,
|
self.handle,
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut accel_struct,
|
accel_struct.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(accel_struct)
|
.assume_init_on_success(accel_struct)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyAccelerationStructureNV.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyAccelerationStructureNV.html>
|
||||||
|
@ -166,7 +166,7 @@ impl RayTracing {
|
||||||
create_info: &[vk::RayTracingPipelineCreateInfoNV<'_>],
|
create_info: &[vk::RayTracingPipelineCreateInfoNV<'_>],
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<Vec<vk::Pipeline>> {
|
) -> VkResult<Vec<vk::Pipeline>> {
|
||||||
let mut pipelines = vec![mem::zeroed(); create_info.len()];
|
let mut pipelines = Vec::with_capacity(create_info.len());
|
||||||
(self.fp.create_ray_tracing_pipelines_nv)(
|
(self.fp.create_ray_tracing_pipelines_nv)(
|
||||||
self.handle,
|
self.handle,
|
||||||
pipeline_cache,
|
pipeline_cache,
|
||||||
|
@ -175,7 +175,7 @@ impl RayTracing {
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
pipelines.as_mut_ptr(),
|
pipelines.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(pipelines)
|
.set_vec_len_on_success(pipelines, create_info.len())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetRayTracingShaderGroupHandlesNV.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetRayTracingShaderGroupHandlesNV.html>
|
||||||
|
@ -204,15 +204,14 @@ impl RayTracing {
|
||||||
&self,
|
&self,
|
||||||
accel_struct: vk::AccelerationStructureNV,
|
accel_struct: vk::AccelerationStructureNV,
|
||||||
) -> VkResult<u64> {
|
) -> VkResult<u64> {
|
||||||
let mut handle: u64 = 0;
|
let mut handle = mem::MaybeUninit::<u64>::uninit();
|
||||||
let handle_ptr: *mut u64 = &mut handle;
|
|
||||||
(self.fp.get_acceleration_structure_handle_nv)(
|
(self.fp.get_acceleration_structure_handle_nv)(
|
||||||
self.handle,
|
self.handle,
|
||||||
accel_struct,
|
accel_struct,
|
||||||
std::mem::size_of::<u64>(),
|
std::mem::size_of_val(&handle),
|
||||||
handle_ptr.cast(),
|
handle.as_mut_ptr().cast(),
|
||||||
)
|
)
|
||||||
.result_with_success(handle)
|
.assume_init_on_success(handle)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdWriteAccelerationStructuresPropertiesNV.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdWriteAccelerationStructuresPropertiesNV.html>
|
||||||
|
|
|
@ -67,13 +67,14 @@ impl Instance {
|
||||||
&self,
|
&self,
|
||||||
physical_device: vk::PhysicalDevice,
|
physical_device: vk::PhysicalDevice,
|
||||||
) -> VkResult<usize> {
|
) -> VkResult<usize> {
|
||||||
let mut count = 0;
|
let mut count = mem::MaybeUninit::uninit();
|
||||||
(self.instance_fn_1_3.get_physical_device_tool_properties)(
|
(self.instance_fn_1_3.get_physical_device_tool_properties)(
|
||||||
physical_device,
|
physical_device,
|
||||||
&mut count,
|
count.as_mut_ptr(),
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
)
|
)
|
||||||
.result_with_success(count as usize)
|
.assume_init_on_success(count)
|
||||||
|
.map(|c| c as usize)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceToolProperties.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceToolProperties.html>
|
||||||
|
@ -108,13 +109,14 @@ impl Instance {
|
||||||
/// Retrieve the number of elements to pass to [`enumerate_physical_device_groups()`][Self::enumerate_physical_device_groups()]
|
/// Retrieve the number of elements to pass to [`enumerate_physical_device_groups()`][Self::enumerate_physical_device_groups()]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn enumerate_physical_device_groups_len(&self) -> VkResult<usize> {
|
pub unsafe fn enumerate_physical_device_groups_len(&self) -> VkResult<usize> {
|
||||||
let mut group_count = 0;
|
let mut group_count = mem::MaybeUninit::uninit();
|
||||||
(self.instance_fn_1_1.enumerate_physical_device_groups)(
|
(self.instance_fn_1_1.enumerate_physical_device_groups)(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
&mut group_count,
|
group_count.as_mut_ptr(),
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
)
|
)
|
||||||
.result_with_success(group_count as usize)
|
.assume_init_on_success(group_count)
|
||||||
|
.map(|c| c as usize)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumeratePhysicalDeviceGroups.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumeratePhysicalDeviceGroups.html>
|
||||||
|
@ -192,15 +194,15 @@ impl Instance {
|
||||||
&self,
|
&self,
|
||||||
physical_device: vk::PhysicalDevice,
|
physical_device: vk::PhysicalDevice,
|
||||||
) -> usize {
|
) -> usize {
|
||||||
let mut queue_count = 0;
|
let mut queue_count = mem::MaybeUninit::uninit();
|
||||||
(self
|
(self
|
||||||
.instance_fn_1_1
|
.instance_fn_1_1
|
||||||
.get_physical_device_queue_family_properties2)(
|
.get_physical_device_queue_family_properties2)(
|
||||||
physical_device,
|
physical_device,
|
||||||
&mut queue_count,
|
queue_count.as_mut_ptr(),
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
);
|
);
|
||||||
queue_count as usize
|
queue_count.assume_init() as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceQueueFamilyProperties2.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceQueueFamilyProperties2.html>
|
||||||
|
@ -241,16 +243,16 @@ impl Instance {
|
||||||
physical_device: vk::PhysicalDevice,
|
physical_device: vk::PhysicalDevice,
|
||||||
format_info: &vk::PhysicalDeviceSparseImageFormatInfo2<'_>,
|
format_info: &vk::PhysicalDeviceSparseImageFormatInfo2<'_>,
|
||||||
) -> usize {
|
) -> usize {
|
||||||
let mut format_count = 0;
|
let mut format_count = mem::MaybeUninit::uninit();
|
||||||
(self
|
(self
|
||||||
.instance_fn_1_1
|
.instance_fn_1_1
|
||||||
.get_physical_device_sparse_image_format_properties2)(
|
.get_physical_device_sparse_image_format_properties2)(
|
||||||
physical_device,
|
physical_device,
|
||||||
format_info,
|
format_info,
|
||||||
&mut format_count,
|
format_count.as_mut_ptr(),
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
);
|
);
|
||||||
format_count as usize
|
format_count.assume_init() as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSparseImageFormatProperties2.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSparseImageFormatProperties2.html>
|
||||||
|
@ -356,14 +358,14 @@ impl Instance {
|
||||||
create_info: &vk::DeviceCreateInfo<'_>,
|
create_info: &vk::DeviceCreateInfo<'_>,
|
||||||
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
|
||||||
) -> VkResult<Device> {
|
) -> VkResult<Device> {
|
||||||
let mut device = mem::zeroed();
|
let mut device = mem::MaybeUninit::uninit();
|
||||||
(self.instance_fn_1_0.create_device)(
|
let device = (self.instance_fn_1_0.create_device)(
|
||||||
physical_device,
|
physical_device,
|
||||||
create_info,
|
create_info,
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
&mut device,
|
device.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result()?;
|
.assume_init_on_success(device)?;
|
||||||
Ok(Device::load(&self.instance_fn_1_0, device))
|
Ok(Device::load(&self.instance_fn_1_0, device))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,13 +395,13 @@ impl Instance {
|
||||||
physical_device: vk::PhysicalDevice,
|
physical_device: vk::PhysicalDevice,
|
||||||
format: vk::Format,
|
format: vk::Format,
|
||||||
) -> vk::FormatProperties {
|
) -> vk::FormatProperties {
|
||||||
let mut format_prop = mem::zeroed();
|
let mut format_prop = mem::MaybeUninit::uninit();
|
||||||
(self.instance_fn_1_0.get_physical_device_format_properties)(
|
(self.instance_fn_1_0.get_physical_device_format_properties)(
|
||||||
physical_device,
|
physical_device,
|
||||||
format,
|
format,
|
||||||
&mut format_prop,
|
format_prop.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
format_prop
|
format_prop.assume_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceImageFormatProperties.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceImageFormatProperties.html>
|
||||||
|
@ -413,7 +415,7 @@ impl Instance {
|
||||||
usage: vk::ImageUsageFlags,
|
usage: vk::ImageUsageFlags,
|
||||||
flags: vk::ImageCreateFlags,
|
flags: vk::ImageCreateFlags,
|
||||||
) -> VkResult<vk::ImageFormatProperties> {
|
) -> VkResult<vk::ImageFormatProperties> {
|
||||||
let mut image_format_prop = mem::zeroed();
|
let mut image_format_prop = mem::MaybeUninit::uninit();
|
||||||
(self
|
(self
|
||||||
.instance_fn_1_0
|
.instance_fn_1_0
|
||||||
.get_physical_device_image_format_properties)(
|
.get_physical_device_image_format_properties)(
|
||||||
|
@ -423,9 +425,9 @@ impl Instance {
|
||||||
tiling,
|
tiling,
|
||||||
usage,
|
usage,
|
||||||
flags,
|
flags,
|
||||||
&mut image_format_prop,
|
image_format_prop.as_mut_ptr(),
|
||||||
)
|
)
|
||||||
.result_with_success(image_format_prop)
|
.assume_init_on_success(image_format_prop)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceMemoryProperties.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceMemoryProperties.html>
|
||||||
|
@ -434,12 +436,12 @@ impl Instance {
|
||||||
&self,
|
&self,
|
||||||
physical_device: vk::PhysicalDevice,
|
physical_device: vk::PhysicalDevice,
|
||||||
) -> vk::PhysicalDeviceMemoryProperties {
|
) -> vk::PhysicalDeviceMemoryProperties {
|
||||||
let mut memory_prop = mem::zeroed();
|
let mut memory_prop = mem::MaybeUninit::uninit();
|
||||||
(self.instance_fn_1_0.get_physical_device_memory_properties)(
|
(self.instance_fn_1_0.get_physical_device_memory_properties)(
|
||||||
physical_device,
|
physical_device,
|
||||||
&mut memory_prop,
|
memory_prop.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
memory_prop
|
memory_prop.assume_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceProperties.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceProperties.html>
|
||||||
|
@ -448,9 +450,9 @@ impl Instance {
|
||||||
&self,
|
&self,
|
||||||
physical_device: vk::PhysicalDevice,
|
physical_device: vk::PhysicalDevice,
|
||||||
) -> vk::PhysicalDeviceProperties {
|
) -> vk::PhysicalDeviceProperties {
|
||||||
let mut prop = mem::zeroed();
|
let mut prop = mem::MaybeUninit::uninit();
|
||||||
(self.instance_fn_1_0.get_physical_device_properties)(physical_device, &mut prop);
|
(self.instance_fn_1_0.get_physical_device_properties)(physical_device, prop.as_mut_ptr());
|
||||||
prop
|
prop.assume_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceQueueFamilyProperties.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceQueueFamilyProperties.html>
|
||||||
|
@ -477,9 +479,9 @@ impl Instance {
|
||||||
&self,
|
&self,
|
||||||
physical_device: vk::PhysicalDevice,
|
physical_device: vk::PhysicalDevice,
|
||||||
) -> vk::PhysicalDeviceFeatures {
|
) -> vk::PhysicalDeviceFeatures {
|
||||||
let mut prop = mem::zeroed();
|
let mut prop = mem::MaybeUninit::uninit();
|
||||||
(self.instance_fn_1_0.get_physical_device_features)(physical_device, &mut prop);
|
(self.instance_fn_1_0.get_physical_device_features)(physical_device, prop.as_mut_ptr());
|
||||||
prop
|
prop.assume_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumeratePhysicalDevices.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkEnumeratePhysicalDevices.html>
|
||||||
|
|
|
@ -24,6 +24,14 @@ impl vk::Result {
|
||||||
pub unsafe fn assume_init_on_success<T>(self, v: mem::MaybeUninit<T>) -> VkResult<T> {
|
pub unsafe fn assume_init_on_success<T>(self, v: mem::MaybeUninit<T>) -> VkResult<T> {
|
||||||
self.result().map(move |()| v.assume_init())
|
self.result().map(move |()| v.assume_init())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub unsafe fn set_vec_len_on_success<T>(self, mut v: Vec<T>, len: usize) -> VkResult<Vec<T>> {
|
||||||
|
self.result().map(move |()| {
|
||||||
|
v.set_len(len);
|
||||||
|
v
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Repeatedly calls `f` until it does not return [`vk::Result::INCOMPLETE`] anymore, ensuring all
|
/// Repeatedly calls `f` until it does not return [`vk::Result::INCOMPLETE`] anymore, ensuring all
|
||||||
|
@ -48,9 +56,10 @@ where
|
||||||
|
|
||||||
let err_code = f(&mut count, data.as_mut_ptr());
|
let err_code = f(&mut count, data.as_mut_ptr());
|
||||||
if err_code != vk::Result::INCOMPLETE {
|
if err_code != vk::Result::INCOMPLETE {
|
||||||
err_code.result()?;
|
break err_code.set_vec_len_on_success(
|
||||||
data.set_len(count.try_into().expect("`N` failed to convert to `usize`"));
|
data,
|
||||||
break Ok(data);
|
count.try_into().expect("`N` failed to convert to `usize`"),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,8 +94,10 @@ where
|
||||||
|
|
||||||
let err_code = f(&mut count, data.as_mut_ptr());
|
let err_code = f(&mut count, data.as_mut_ptr());
|
||||||
if err_code != vk::Result::INCOMPLETE {
|
if err_code != vk::Result::INCOMPLETE {
|
||||||
data.set_len(count.try_into().expect("`N` failed to convert to `usize`"));
|
break err_code.set_vec_len_on_success(
|
||||||
break err_code.result_with_success(data);
|
data,
|
||||||
|
count.try_into().expect("`N` failed to convert to `usize`"),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue