From 82db4298fb8f72df2bb92fde4b1295ae46c6ca68 Mon Sep 17 00:00:00 2001 From: marc0246 <40955683+marc0246@users.noreply.github.com> Date: Mon, 4 Nov 2024 11:51:36 +0100 Subject: [PATCH] Revert #2419 (#2600) --- examples/image-self-copy-blit/main.rs | 2 +- examples/image/main.rs | 2 +- examples/immutable-sampler/main.rs | 2 +- .../fractal_compute_pipeline.rs | 1 + examples/msaa-renderpass/main.rs | 2 +- examples/offscreen/main.rs | 3 +- examples/push-descriptors/main.rs | 2 +- examples/runtime-array/main.rs | 2 +- examples/simple-particles/main.rs | 2 +- examples/texture-array/main.rs | 2 +- vulkano/src/buffer/allocator.rs | 4 +- vulkano/src/buffer/mod.rs | 5 +- vulkano/src/command_buffer/auto/mod.rs | 52 +++---- .../src/command_buffer/commands/secondary.rs | 20 +-- vulkano/src/command_buffer/mod.rs | 14 +- vulkano/src/command_buffer/traits.rs | 127 +++++++++++++++++- vulkano/src/sync/future/mod.rs | 8 +- 17 files changed, 179 insertions(+), 71 deletions(-) diff --git a/examples/image-self-copy-blit/main.rs b/examples/image-self-copy-blit/main.rs index db2183f5..01860944 100644 --- a/examples/image-self-copy-blit/main.rs +++ b/examples/image-self-copy-blit/main.rs @@ -4,7 +4,7 @@ use vulkano::{ command_buffer::{ allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, BlitImageInfo, BufferImageCopy, ClearColorImageInfo, CommandBufferUsage, CopyBufferToImageInfo, - CopyImageInfo, ImageBlit, ImageCopy, RenderPassBeginInfo, + CopyImageInfo, ImageBlit, ImageCopy, PrimaryCommandBufferAbstract, RenderPassBeginInfo, }, descriptor_set::{ allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet, diff --git a/examples/image/main.rs b/examples/image/main.rs index b5b3fca4..ed26c589 100644 --- a/examples/image/main.rs +++ b/examples/image/main.rs @@ -3,7 +3,7 @@ use vulkano::{ buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer}, command_buffer::{ allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage, - CopyBufferToImageInfo, RenderPassBeginInfo, + CopyBufferToImageInfo, PrimaryCommandBufferAbstract, RenderPassBeginInfo, }, descriptor_set::{ allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet, diff --git a/examples/immutable-sampler/main.rs b/examples/immutable-sampler/main.rs index 0e28f1e6..355197e7 100644 --- a/examples/immutable-sampler/main.rs +++ b/examples/immutable-sampler/main.rs @@ -12,7 +12,7 @@ use vulkano::{ buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer}, command_buffer::{ allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage, - CopyBufferToImageInfo, RenderPassBeginInfo, + CopyBufferToImageInfo, PrimaryCommandBufferAbstract, RenderPassBeginInfo, }, descriptor_set::{ allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet, diff --git a/examples/interactive-fractal/fractal_compute_pipeline.rs b/examples/interactive-fractal/fractal_compute_pipeline.rs index ace0705a..da122408 100644 --- a/examples/interactive-fractal/fractal_compute_pipeline.rs +++ b/examples/interactive-fractal/fractal_compute_pipeline.rs @@ -5,6 +5,7 @@ use vulkano::{ buffer::{Buffer, BufferCreateInfo, BufferUsage, Subbuffer}, command_buffer::{ allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage, + PrimaryCommandBufferAbstract, }, descriptor_set::{ allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet, diff --git a/examples/msaa-renderpass/main.rs b/examples/msaa-renderpass/main.rs index 6b28e083..91d8d9b7 100644 --- a/examples/msaa-renderpass/main.rs +++ b/examples/msaa-renderpass/main.rs @@ -58,7 +58,7 @@ use vulkano::{ buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage}, command_buffer::{ allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage, - CopyImageToBufferInfo, RenderPassBeginInfo, + CopyImageToBufferInfo, PrimaryCommandBufferAbstract, RenderPassBeginInfo, }, device::{ physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo, diff --git a/examples/offscreen/main.rs b/examples/offscreen/main.rs index 78f9218c..12ee43a0 100644 --- a/examples/offscreen/main.rs +++ b/examples/offscreen/main.rs @@ -6,7 +6,8 @@ use vulkano::{ buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage}, command_buffer::{ allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage, - CopyImageToBufferInfo, RenderPassBeginInfo, SubpassBeginInfo, SubpassContents, + CopyImageToBufferInfo, PrimaryCommandBufferAbstract, RenderPassBeginInfo, SubpassBeginInfo, + SubpassContents, }, device::{physical::PhysicalDeviceType, Device, DeviceCreateInfo, QueueCreateInfo, QueueFlags}, format::Format, diff --git a/examples/push-descriptors/main.rs b/examples/push-descriptors/main.rs index 29763a05..fd00c3ad 100644 --- a/examples/push-descriptors/main.rs +++ b/examples/push-descriptors/main.rs @@ -3,7 +3,7 @@ use vulkano::{ buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer}, command_buffer::{ allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage, - CopyBufferToImageInfo, RenderPassBeginInfo, + CopyBufferToImageInfo, PrimaryCommandBufferAbstract, RenderPassBeginInfo, }, descriptor_set::{layout::DescriptorSetLayoutCreateFlags, WriteDescriptorSet}, device::{ diff --git a/examples/runtime-array/main.rs b/examples/runtime-array/main.rs index 705cd354..122aa9e6 100644 --- a/examples/runtime-array/main.rs +++ b/examples/runtime-array/main.rs @@ -3,7 +3,7 @@ use vulkano::{ buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer}, command_buffer::{ allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage, - CopyBufferToImageInfo, RenderPassBeginInfo, + CopyBufferToImageInfo, PrimaryCommandBufferAbstract, RenderPassBeginInfo, }, descriptor_set::{ allocator::StandardDescriptorSetAllocator, layout::DescriptorBindingFlags, DescriptorSet, diff --git a/examples/simple-particles/main.rs b/examples/simple-particles/main.rs index 194f88f0..7b96d12d 100644 --- a/examples/simple-particles/main.rs +++ b/examples/simple-particles/main.rs @@ -8,7 +8,7 @@ use vulkano::{ buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer}, command_buffer::{ allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage, - CopyBufferInfo, RenderPassBeginInfo, + CopyBufferInfo, PrimaryCommandBufferAbstract, RenderPassBeginInfo, }, descriptor_set::{ allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet, diff --git a/examples/texture-array/main.rs b/examples/texture-array/main.rs index 4ae0e59d..748145bf 100644 --- a/examples/texture-array/main.rs +++ b/examples/texture-array/main.rs @@ -3,7 +3,7 @@ use vulkano::{ buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer}, command_buffer::{ allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage, - CopyBufferToImageInfo, RenderPassBeginInfo, + CopyBufferToImageInfo, PrimaryCommandBufferAbstract, RenderPassBeginInfo, }, descriptor_set::{ allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet, diff --git a/vulkano/src/buffer/allocator.rs b/vulkano/src/buffer/allocator.rs index 18cc3921..61452a44 100644 --- a/vulkano/src/buffer/allocator.rs +++ b/vulkano/src/buffer/allocator.rs @@ -78,7 +78,9 @@ const MAX_ARENAS: usize = 32; /// allocator::{SubbufferAllocator, SubbufferAllocatorCreateInfo}, /// BufferUsage, /// }, -/// command_buffer::{AutoCommandBufferBuilder, CommandBufferUsage}, +/// command_buffer::{ +/// AutoCommandBufferBuilder, CommandBufferUsage, PrimaryCommandBufferAbstract, +/// }, /// memory::allocator::MemoryTypeFilter, /// sync::GpuFuture, /// }; diff --git a/vulkano/src/buffer/mod.rs b/vulkano/src/buffer/mod.rs index 086a051c..4631c6cf 100644 --- a/vulkano/src/buffer/mod.rs +++ b/vulkano/src/buffer/mod.rs @@ -121,7 +121,10 @@ pub mod view; /// ``` /// use vulkano::{ /// buffer::{BufferUsage, Buffer, BufferCreateInfo}, -/// command_buffer::{AutoCommandBufferBuilder, CommandBufferUsage, CopyBufferInfo}, +/// command_buffer::{ +/// AutoCommandBufferBuilder, CommandBufferUsage, CopyBufferInfo, +/// PrimaryCommandBufferAbstract, +/// }, /// memory::allocator::{AllocationCreateInfo, MemoryTypeFilter}, /// sync::GpuFuture, /// DeviceSize, diff --git a/vulkano/src/command_buffer/auto/mod.rs b/vulkano/src/command_buffer/auto/mod.rs index 1e5008c5..a4d2a0f8 100644 --- a/vulkano/src/command_buffer/auto/mod.rs +++ b/vulkano/src/command_buffer/auto/mod.rs @@ -65,8 +65,8 @@ pub(in crate::command_buffer) use self::builder::{ use super::{ sys::{CommandBuffer, RecordingCommandBuffer}, CommandBufferInheritanceInfo, CommandBufferResourcesUsage, CommandBufferState, - CommandBufferUsage, ResourceInCommand, SecondaryCommandBufferResourcesUsage, - SecondaryResourceUseRef, + CommandBufferUsage, PrimaryCommandBufferAbstract, ResourceInCommand, + SecondaryCommandBufferAbstract, SecondaryCommandBufferResourcesUsage, SecondaryResourceUseRef, }; use crate::{ buffer::Subbuffer, @@ -118,30 +118,27 @@ impl Debug for PrimaryAutoCommandBuffer { } } -impl PrimaryAutoCommandBuffer { - /// Returns the inner raw command buffer. +unsafe impl PrimaryCommandBufferAbstract for PrimaryAutoCommandBuffer { #[inline] - pub fn inner(&self) -> &CommandBuffer { + fn as_raw(&self) -> &CommandBuffer { &self.inner } - /// Returns the queue family index of this command buffer. #[inline] - pub fn queue_family_index(&self) -> u32 { + fn queue_family_index(&self) -> u32 { self.inner.queue_family_index() } - /// Returns the usage of this command buffer. #[inline] - pub fn usage(&self) -> CommandBufferUsage { + fn usage(&self) -> CommandBufferUsage { self.inner.usage() } - pub(crate) fn state(&self) -> MutexGuard<'_, CommandBufferState> { + fn state(&self) -> MutexGuard<'_, CommandBufferState> { self.state.lock() } - pub(crate) fn resources_usage(&self) -> &CommandBufferResourcesUsage { + fn resources_usage(&self) -> &CommandBufferResourcesUsage { &self.resources_usage } } @@ -177,36 +174,23 @@ impl Debug for SecondaryAutoCommandBuffer { } } -impl SecondaryAutoCommandBuffer { - /// Returns the inner raw command buffer. +unsafe impl SecondaryCommandBufferAbstract for SecondaryAutoCommandBuffer { #[inline] - pub fn inner(&self) -> &CommandBuffer { + fn as_raw(&self) -> &CommandBuffer { &self.inner } - /// Returns the queue family index of this command buffer. #[inline] - pub fn queue_family_index(&self) -> u32 { - self.inner.queue_family_index() - } - - /// Returns the usage of this command buffer. - #[inline] - pub fn usage(&self) -> CommandBufferUsage { + fn usage(&self) -> CommandBufferUsage { self.inner.usage() } - /// Returns the inheritance info of the command buffer. #[inline] - pub fn inheritance_info(&self) -> &CommandBufferInheritanceInfo { + fn inheritance_info(&self) -> &CommandBufferInheritanceInfo { self.inner.inheritance_info().unwrap() } - /// Checks whether this command buffer is allowed to be recorded to a command buffer, - /// and if so locks it. - /// - /// If you call this function, then you should call `unlock` afterwards. - pub fn lock_record(&self) -> Result<(), Box> { + fn lock_record(&self) -> Result<(), Box> { match self.submit_state { SubmitState::OneTime { ref already_submitted, @@ -242,12 +226,7 @@ impl SecondaryAutoCommandBuffer { Ok(()) } - /// Unlocks the command buffer. Should be called once for each call to `lock_record`. - /// - /// # Safety - /// - /// Must not be called if you haven't called `lock_record` before. - pub unsafe fn unlock(&self) { + unsafe fn unlock(&self) { match self.submit_state { SubmitState::OneTime { ref already_submitted, @@ -262,7 +241,7 @@ impl SecondaryAutoCommandBuffer { }; } - pub(crate) fn resources_usage(&self) -> &SecondaryCommandBufferResourcesUsage { + fn resources_usage(&self) -> &SecondaryCommandBufferResourcesUsage { &self.resources_usage } } @@ -347,6 +326,7 @@ mod tests { command_buffer::{ allocator::{StandardCommandBufferAllocator, StandardCommandBufferAllocatorCreateInfo}, AutoCommandBufferBuilder, BufferCopy, CommandBufferUsage, CopyBufferInfoTyped, + PrimaryCommandBufferAbstract, }, descriptor_set::{ allocator::StandardDescriptorSetAllocator, diff --git a/vulkano/src/command_buffer/commands/secondary.rs b/vulkano/src/command_buffer/commands/secondary.rs index 500a43b7..15e1b762 100644 --- a/vulkano/src/command_buffer/commands/secondary.rs +++ b/vulkano/src/command_buffer/commands/secondary.rs @@ -3,7 +3,7 @@ use crate::{ auto::{RenderPassStateType, Resource, ResourceUseRef2}, sys::{CommandBuffer, RecordingCommandBuffer}, AutoCommandBufferBuilder, CommandBufferInheritanceRenderPassType, CommandBufferLevel, - ResourceInCommand, SecondaryAutoCommandBuffer, SecondaryCommandBufferBufferUsage, + ResourceInCommand, SecondaryCommandBufferAbstract, SecondaryCommandBufferBufferUsage, SecondaryCommandBufferImageUsage, SecondaryCommandBufferResourcesUsage, SubpassContents, }, device::{DeviceOwned, QueueFlags}, @@ -25,7 +25,7 @@ impl AutoCommandBufferBuilder { /// with `Flags::OneTimeSubmit` will set `self`'s flags to `Flags::OneTimeSubmit` also. pub fn execute_commands( &mut self, - command_buffer: Arc, + command_buffer: Arc, ) -> Result<&mut Self, Box> { let command_buffer = DropUnlockCommandBuffer::new(command_buffer)?; self.validate_execute_commands(iter::once(&**command_buffer))?; @@ -41,7 +41,7 @@ impl AutoCommandBufferBuilder { // TODO ^ would be nice if this just worked without errors pub fn execute_commands_from_vec( &mut self, - command_buffers: Vec>, + command_buffers: Vec>, ) -> Result<&mut Self, Box> { let command_buffers: SmallVec<[_; 4]> = command_buffers .into_iter() @@ -55,10 +55,10 @@ impl AutoCommandBufferBuilder { fn validate_execute_commands<'a>( &self, - command_buffers: impl Iterator + Clone, + command_buffers: impl Iterator + Clone, ) -> Result<(), Box> { self.inner - .validate_execute_commands(command_buffers.clone().map(|cb| cb.inner()))?; + .validate_execute_commands(command_buffers.clone().map(|cb| cb.as_raw()))?; if let Some(render_pass_state) = &self.builder_state.render_pass { if render_pass_state.contents != SubpassContents::SecondaryCommandBuffers { @@ -459,7 +459,7 @@ impl AutoCommandBufferBuilder { #[cfg_attr(not(feature = "document_unchecked"), doc(hidden))] pub unsafe fn execute_commands_unchecked( &mut self, - command_buffers: SmallVec<[Arc; 4]>, + command_buffers: SmallVec<[Arc; 4]>, ) -> &mut Self { self.execute_commands_locked( command_buffers @@ -670,17 +670,19 @@ impl RecordingCommandBuffer { } } -struct DropUnlockCommandBuffer(Arc); +struct DropUnlockCommandBuffer(Arc); impl DropUnlockCommandBuffer { - fn new(command_buffer: Arc) -> Result> { + fn new( + command_buffer: Arc, + ) -> Result> { command_buffer.lock_record()?; Ok(Self(command_buffer)) } } impl std::ops::Deref for DropUnlockCommandBuffer { - type Target = Arc; + type Target = Arc; fn deref(&self) -> &Self::Target { &self.0 diff --git a/vulkano/src/command_buffer/mod.rs b/vulkano/src/command_buffer/mod.rs index 0dfd48bd..88e719c8 100644 --- a/vulkano/src/command_buffer/mod.rs +++ b/vulkano/src/command_buffer/mod.rs @@ -52,7 +52,10 @@ //! on the GPU. //! //! ``` -//! use vulkano::command_buffer::{AutoCommandBufferBuilder, CommandBufferUsage, SubpassContents}; +//! use vulkano::command_buffer::{ +//! AutoCommandBufferBuilder, CommandBufferUsage, PrimaryCommandBufferAbstract, +//! SubpassContents, +//! }; //! //! # let device: std::sync::Arc = return; //! # let queue: std::sync::Arc = return; @@ -97,7 +100,10 @@ pub use self::commands::{ pub use self::{ auto::{AutoCommandBufferBuilder, PrimaryAutoCommandBuffer, SecondaryAutoCommandBuffer}, sys::{CommandBuffer, CommandBufferBeginInfo, RecordingCommandBuffer}, - traits::{CommandBufferExecError, CommandBufferExecFuture}, + traits::{ + CommandBufferExecError, CommandBufferExecFuture, PrimaryCommandBufferAbstract, + SecondaryCommandBufferAbstract, + }, }; use crate::{ buffer::{Buffer, Subbuffer}, @@ -1185,7 +1191,7 @@ pub struct CommandBufferSubmitInfo { /// The command buffer to execute. /// /// There is no default value. - pub command_buffer: Arc, + pub command_buffer: Arc, pub _ne: crate::NonExhaustive, } @@ -1193,7 +1199,7 @@ pub struct CommandBufferSubmitInfo { impl CommandBufferSubmitInfo { /// Returns a `CommandBufferSubmitInfo` with the specified `command_buffer`. #[inline] - pub fn new(command_buffer: Arc) -> Self { + pub fn new(command_buffer: Arc) -> Self { Self { command_buffer, _ne: crate::NonExhaustive(()), diff --git a/vulkano/src/command_buffer/traits.rs b/vulkano/src/command_buffer/traits.rs index 63432233..44850222 100644 --- a/vulkano/src/command_buffer/traits.rs +++ b/vulkano/src/command_buffer/traits.rs @@ -1,4 +1,8 @@ -use super::{CommandBufferSubmitInfo, PrimaryAutoCommandBuffer, SemaphoreSubmitInfo, SubmitInfo}; +use super::{ + CommandBuffer, CommandBufferInheritanceInfo, CommandBufferResourcesUsage, CommandBufferState, + CommandBufferSubmitInfo, CommandBufferUsage, SecondaryCommandBufferResourcesUsage, + SemaphoreSubmitInfo, SubmitInfo, +}; use crate::{ buffer::Buffer, device::{Device, DeviceOwned, Queue}, @@ -11,9 +15,9 @@ use crate::{ }, PipelineStages, }, - DeviceSize, Validated, VulkanError, VulkanObject, + DeviceSize, SafeDeref, Validated, ValidationError, VulkanError, VulkanObject, }; -use parking_lot::Mutex; +use parking_lot::{Mutex, MutexGuard}; use std::{ borrow::Cow, error::Error, @@ -26,7 +30,18 @@ use std::{ thread, }; -impl PrimaryAutoCommandBuffer { +pub unsafe trait PrimaryCommandBufferAbstract: + VulkanObject + DeviceOwned + Send + Sync +{ + /// Returns the underlying raw command buffer. + fn as_raw(&self) -> &CommandBuffer; + + /// Returns the queue family index of this command buffer. + fn queue_family_index(&self) -> u32; + + /// Returns the usage of this command buffer. + fn usage(&self) -> CommandBufferUsage; + /// Executes this command buffer on a queue. /// /// This function returns an object that implements the [`GpuFuture`] trait. See the @@ -50,7 +65,7 @@ impl PrimaryAutoCommandBuffer { /// /// - Panics if the device of the command buffer is not the same as the device of the future. #[inline] - pub fn execute( + fn execute( self: Arc, queue: Arc, ) -> Result, CommandBufferExecError> @@ -87,7 +102,7 @@ impl PrimaryAutoCommandBuffer { /// # Panics /// /// - Panics if the device of the command buffer is not the same as the device of the future. - pub fn execute_after( + fn execute_after( self: Arc, future: F, queue: Arc, @@ -110,6 +125,104 @@ impl PrimaryAutoCommandBuffer { finished: AtomicBool::new(false), }) } + + #[doc(hidden)] + fn state(&self) -> MutexGuard<'_, CommandBufferState>; + + #[doc(hidden)] + fn resources_usage(&self) -> &CommandBufferResourcesUsage; +} + +impl Debug for dyn PrimaryCommandBufferAbstract { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + Debug::fmt(&self.handle(), f) + } +} + +unsafe impl PrimaryCommandBufferAbstract for T +where + T: VulkanObject + SafeDeref + Send + Sync, + T::Target: PrimaryCommandBufferAbstract, +{ + fn as_raw(&self) -> &CommandBuffer { + (**self).as_raw() + } + + fn queue_family_index(&self) -> u32 { + (**self).queue_family_index() + } + + fn usage(&self) -> CommandBufferUsage { + (**self).usage() + } + + fn state(&self) -> MutexGuard<'_, CommandBufferState> { + (**self).state() + } + + fn resources_usage(&self) -> &CommandBufferResourcesUsage { + (**self).resources_usage() + } +} + +pub unsafe trait SecondaryCommandBufferAbstract: + VulkanObject + DeviceOwned + Send + Sync +{ + /// Returns the underlying raw command buffer. + fn as_raw(&self) -> &CommandBuffer; + + /// Returns the usage of this command buffer. + fn usage(&self) -> CommandBufferUsage; + + /// Returns a `CommandBufferInheritance` value describing the properties that the command + /// buffer inherits from its parent primary command buffer. + fn inheritance_info(&self) -> &CommandBufferInheritanceInfo; + + /// Checks whether this command buffer is allowed to be recorded to a command buffer, + /// and if so locks it. + /// + /// If you call this function, then you should call `unlock` afterwards. + fn lock_record(&self) -> Result<(), Box>; + + /// Unlocks the command buffer. Should be called once for each call to `lock_record`. + /// + /// # Safety + /// + /// Must not be called if you haven't called `lock_record` before. + unsafe fn unlock(&self); + + #[doc(hidden)] + fn resources_usage(&self) -> &SecondaryCommandBufferResourcesUsage; +} + +unsafe impl SecondaryCommandBufferAbstract for T +where + T: VulkanObject + SafeDeref + Send + Sync, + T::Target: SecondaryCommandBufferAbstract, +{ + fn as_raw(&self) -> &CommandBuffer { + (**self).as_raw() + } + + fn usage(&self) -> CommandBufferUsage { + (**self).usage() + } + + fn inheritance_info(&self) -> &CommandBufferInheritanceInfo { + (**self).inheritance_info() + } + + fn lock_record(&self) -> Result<(), Box> { + (**self).lock_record() + } + + unsafe fn unlock(&self) { + (**self).unlock(); + } + + fn resources_usage(&self) -> &SecondaryCommandBufferResourcesUsage { + (**self).resources_usage() + } } /// Represents a command buffer being executed by the GPU and the moment when the execution @@ -121,7 +234,7 @@ where F: GpuFuture, { previous: F, - command_buffer: Arc, + command_buffer: Arc, queue: Arc, // True if the command buffer has already been submitted. // If flush is called multiple times, we want to block so that only one flushing is executed. diff --git a/vulkano/src/sync/future/mod.rs b/vulkano/src/sync/future/mod.rs index eedc2607..504ef1d2 100644 --- a/vulkano/src/sync/future/mod.rs +++ b/vulkano/src/sync/future/mod.rs @@ -92,8 +92,8 @@ use crate::{ buffer::{Buffer, BufferState}, command_buffer::{ CommandBufferExecError, CommandBufferExecFuture, CommandBufferResourcesUsage, - CommandBufferState, CommandBufferSubmitInfo, CommandBufferUsage, PrimaryAutoCommandBuffer, - SubmitInfo, + CommandBufferState, CommandBufferSubmitInfo, CommandBufferUsage, + PrimaryCommandBufferAbstract, SubmitInfo, }, device::{DeviceOwned, Queue}, image::{Image, ImageLayout, ImageState}, @@ -242,7 +242,7 @@ pub unsafe trait GpuFuture: DeviceOwned { fn then_execute( self, queue: Arc, - command_buffer: Arc, + command_buffer: Arc, ) -> Result, CommandBufferExecError> where Self: Sized, @@ -256,7 +256,7 @@ pub unsafe trait GpuFuture: DeviceOwned { /// > `CommandBuffer` trait. fn then_execute_same_queue( self, - command_buffer: Arc, + command_buffer: Arc, ) -> Result, CommandBufferExecError> where Self: Sized,