From 2f51478d54788fd8f831790c9749fc79bde9e11f Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Fri, 12 Nov 2021 16:35:36 +0100 Subject: [PATCH] remove From for VkResult this is a breaking change see https://github.com/MaikKlein/ash/pull/493 --- ash/src/device.rs | 52 ++++++++++--------- ash/src/extensions/ext/debug_marker.rs | 2 +- ash/src/extensions/ext/debug_utils.rs | 4 +- .../extensions/khr/acceleration_structure.rs | 10 ++-- ash/src/extensions/khr/timeline_semaphore.rs | 4 +- ash/src/extensions/nv/ray_tracing.rs | 6 +-- ash/src/instance.rs | 4 +- ash/src/prelude.rs | 6 --- 8 files changed, 43 insertions(+), 45 deletions(-) diff --git a/ash/src/device.rs b/ash/src/device.rs index fae9cc6..426fa16 100644 --- a/ash/src/device.rs +++ b/ash/src/device.rs @@ -166,14 +166,14 @@ impl Device { ) -> VkResult<()> { self.device_fn_1_2 .wait_semaphores(self.handle(), wait_info, timeout) - .into() + .result() } #[doc = ""] pub unsafe fn signal_semaphore(&self, signal_info: &vk::SemaphoreSignalInfo) -> VkResult<()> { self.device_fn_1_2 .signal_semaphore(self.handle(), signal_info) - .into() + .result() } #[doc = ""] @@ -218,7 +218,7 @@ impl Device { ) -> VkResult<()> { self.device_fn_1_1 .bind_buffer_memory2(self.handle(), bind_infos.len() as _, bind_infos.as_ptr()) - .into() + .result() } #[doc = ""] @@ -228,7 +228,7 @@ impl Device { ) -> VkResult<()> { self.device_fn_1_1 .bind_image_memory2(self.handle(), bind_infos.len() as _, bind_infos.as_ptr()) - .into() + .result() } #[doc = ""] @@ -507,12 +507,14 @@ impl Device { #[doc = ""] pub unsafe fn set_event(&self, event: vk::Event) -> VkResult<()> { - self.device_fn_1_0.set_event(self.handle(), event).into() + self.device_fn_1_0.set_event(self.handle(), event).result() } #[doc = ""] pub unsafe fn reset_event(&self, event: vk::Event) -> VkResult<()> { - self.device_fn_1_0.reset_event(self.handle(), event).into() + self.device_fn_1_0 + .reset_event(self.handle(), event) + .result() } #[doc = ""] pub unsafe fn cmd_set_event( @@ -770,7 +772,7 @@ impl Device { descriptor_sets.len() as u32, descriptor_sets.as_ptr(), ) - .into() + .result() } #[doc = ""] @@ -990,7 +992,7 @@ impl Device { #[doc = ""] pub unsafe fn device_wait_idle(&self) -> VkResult<()> { - self.device_fn_1_0.device_wait_idle(self.handle()).into() + self.device_fn_1_0.device_wait_idle(self.handle()).result() } #[doc = ""] @@ -1018,7 +1020,7 @@ impl Device { ) -> VkResult<()> { self.device_fn_1_0 .reset_descriptor_pool(self.handle(), pool, flags) - .into() + .result() } #[doc = ""] @@ -1029,7 +1031,7 @@ impl Device { ) -> VkResult<()> { self.device_fn_1_0 .reset_command_pool(self.handle(), command_pool, flags) - .into() + .result() } #[doc = ""] @@ -1040,14 +1042,14 @@ impl Device { ) -> VkResult<()> { self.device_fn_1_0 .reset_command_buffer(command_buffer, flags) - .into() + .result() } #[doc = ""] pub unsafe fn reset_fences(&self, fences: &[vk::Fence]) -> VkResult<()> { self.device_fn_1_0 .reset_fences(self.handle(), fences.len() as u32, fences.as_ptr()) - .into() + .result() } #[doc = ""] @@ -1473,7 +1475,7 @@ impl Device { mem::size_of::() as _, flags, ) - .into() + .result() } #[doc = ""] @@ -1665,7 +1667,7 @@ impl Device { src_caches.len() as u32, src_caches.as_ptr(), ) - .into() + .result() } #[doc = ""] @@ -1694,7 +1696,7 @@ impl Device { ) -> VkResult<()> { self.device_fn_1_0 .invalidate_mapped_memory_ranges(self.handle(), ranges.len() as u32, ranges.as_ptr()) - .into() + .result() } #[doc = ""] @@ -1704,7 +1706,7 @@ impl Device { ) -> VkResult<()> { self.device_fn_1_0 .flush_mapped_memory_ranges(self.handle(), ranges.len() as u32, ranges.as_ptr()) - .into() + .result() } #[doc = ""] @@ -1786,12 +1788,14 @@ impl Device { ) -> VkResult<()> { self.device_fn_1_0 .begin_command_buffer(command_buffer, begin_info) - .into() + .result() } #[doc = ""] pub unsafe fn end_command_buffer(&self, command_buffer: vk::CommandBuffer) -> VkResult<()> { - self.device_fn_1_0.end_command_buffer(command_buffer).into() + self.device_fn_1_0 + .end_command_buffer(command_buffer) + .result() } #[doc = ""] @@ -1809,7 +1813,7 @@ impl Device { wait_all as u32, timeout, ) - .into() + .result() } #[doc = ""] @@ -1824,7 +1828,7 @@ impl Device { #[doc = ""] pub unsafe fn queue_wait_idle(&self, queue: vk::Queue) -> VkResult<()> { - self.device_fn_1_0.queue_wait_idle(queue).into() + self.device_fn_1_0.queue_wait_idle(queue).result() } #[doc = ""] @@ -1836,7 +1840,7 @@ impl Device { ) -> VkResult<()> { self.device_fn_1_0 .queue_submit(queue, submits.len() as u32, submits.as_ptr(), fence) - .into() + .result() } #[doc = ""] @@ -1848,7 +1852,7 @@ impl Device { ) -> VkResult<()> { self.device_fn_1_0 .queue_bind_sparse(queue, bind_info.len() as u32, bind_info.as_ptr(), fence) - .into() + .result() } #[doc = ""] @@ -2059,7 +2063,7 @@ impl Device { ) -> VkResult<()> { self.device_fn_1_0 .bind_buffer_memory(self.handle(), buffer, device_memory, offset) - .into() + .result() } #[doc = ""] @@ -2071,7 +2075,7 @@ impl Device { ) -> VkResult<()> { self.device_fn_1_0 .bind_image_memory(self.handle(), image, device_memory, offset) - .into() + .result() } #[doc = ""] diff --git a/ash/src/extensions/ext/debug_marker.rs b/ash/src/extensions/ext/debug_marker.rs index 5e86083..102ea46 100755 --- a/ash/src/extensions/ext/debug_marker.rs +++ b/ash/src/extensions/ext/debug_marker.rs @@ -29,7 +29,7 @@ impl DebugMarker { ) -> VkResult<()> { self.debug_marker_fn .debug_marker_set_object_name_ext(device, name_info) - .into() + .result() } #[doc = ""] diff --git a/ash/src/extensions/ext/debug_utils.rs b/ash/src/extensions/ext/debug_utils.rs index 9faa401..6b6dd09 100755 --- a/ash/src/extensions/ext/debug_utils.rs +++ b/ash/src/extensions/ext/debug_utils.rs @@ -33,7 +33,7 @@ impl DebugUtils { ) -> VkResult<()> { self.debug_utils_fn .set_debug_utils_object_name_ext(device, name_info) - .into() + .result() } #[doc = ""] @@ -44,7 +44,7 @@ impl DebugUtils { ) -> VkResult<()> { self.debug_utils_fn .set_debug_utils_object_tag_ext(device, tag_info) - .into() + .result() } #[doc = ""] diff --git a/ash/src/extensions/khr/acceleration_structure.rs b/ash/src/extensions/khr/acceleration_structure.rs index 0e5c46e..801f3e1 100644 --- a/ash/src/extensions/khr/acceleration_structure.rs +++ b/ash/src/extensions/khr/acceleration_structure.rs @@ -151,7 +151,7 @@ impl AccelerationStructure { infos.as_ptr(), build_range_infos.as_ptr(), ) - .into() + .result() } #[doc = ""] @@ -162,7 +162,7 @@ impl AccelerationStructure { ) -> VkResult<()> { self.acceleration_structure_fn .copy_acceleration_structure_khr(self.handle, deferred_operation, info as *const _) - .into() + .result() } #[doc = ""] @@ -177,7 +177,7 @@ impl AccelerationStructure { deferred_operation, info as *const _, ) - .into() + .result() } #[doc = ""] @@ -192,7 +192,7 @@ impl AccelerationStructure { deferred_operation, info as *const _, ) - .into() + .result() } #[doc = ""] @@ -213,7 +213,7 @@ impl AccelerationStructure { data.as_mut_ptr() as *mut std::ffi::c_void, stride, ) - .into() + .result() } #[doc = ""] diff --git a/ash/src/extensions/khr/timeline_semaphore.rs b/ash/src/extensions/khr/timeline_semaphore.rs index 2abb7a2..4de9c3f 100644 --- a/ash/src/extensions/khr/timeline_semaphore.rs +++ b/ash/src/extensions/khr/timeline_semaphore.rs @@ -46,7 +46,7 @@ impl TimelineSemaphore { ) -> VkResult<()> { self.timeline_semaphore_fn .wait_semaphores_khr(device, wait_info, timeout) - .into() + .result() } #[doc = ""] @@ -57,7 +57,7 @@ impl TimelineSemaphore { ) -> VkResult<()> { self.timeline_semaphore_fn .signal_semaphore_khr(device, signal_info) - .into() + .result() } pub fn fp(&self) -> &vk::KhrTimelineSemaphoreFn { diff --git a/ash/src/extensions/nv/ray_tracing.rs b/ash/src/extensions/nv/ray_tracing.rs index 6b430a2..c773957 100755 --- a/ash/src/extensions/nv/ray_tracing.rs +++ b/ash/src/extensions/nv/ray_tracing.rs @@ -90,7 +90,7 @@ impl RayTracing { bind_info.len() as u32, bind_info.as_ptr(), ) - .into() + .result() } #[doc = ""] @@ -206,7 +206,7 @@ impl RayTracing { data.len(), data.as_mut_ptr() as *mut std::ffi::c_void, ) - .into() + .result() } #[doc = ""] @@ -250,7 +250,7 @@ impl RayTracing { pub unsafe fn compile_deferred(&self, pipeline: vk::Pipeline, shader: u32) -> VkResult<()> { self.ray_tracing_fn .compile_deferred_nv(self.handle, pipeline, shader) - .into() + .result() } pub fn name() -> &'static CStr { diff --git a/ash/src/instance.rs b/ash/src/instance.rs index b27f3d2..1ea464e 100644 --- a/ash/src/instance.rs +++ b/ash/src/instance.rs @@ -70,7 +70,7 @@ impl Instance { let mut group_count = out.len() as u32; self.instance_fn_1_1 .enumerate_physical_device_groups(self.handle(), &mut group_count, out.as_mut_ptr()) - .into() + .result() } #[doc = ""] @@ -117,7 +117,7 @@ impl Instance { format_info, image_format_prop, ) - .into() + .result() } /// Retrieve the number of elements to pass to [`Self::get_physical_device_queue_family_properties2()`] diff --git a/ash/src/prelude.rs b/ash/src/prelude.rs index 1130a39..d497e5d 100644 --- a/ash/src/prelude.rs +++ b/ash/src/prelude.rs @@ -3,12 +3,6 @@ use std::convert::TryInto; use crate::vk; pub type VkResult = Result; -impl From for VkResult<()> { - fn from(err_code: vk::Result) -> Self { - err_code.result() - } -} - impl vk::Result { pub fn result(self) -> VkResult<()> { self.result_with_success(())