Skip to main content

CommandBuffer

Struct CommandBuffer 

Source
pub struct CommandBuffer {
    pub device: Device,
    pub handle: CommandBuffer,
    pub info: CommandBufferInfo,
    /* private fields */
}
Expand description

Represents a Vulkan command buffer allocation.

See VkCommandBuffer.

Fields§

§device: Device

The device which owns this command buffer resource.

Note: This field is read-only.

§handle: CommandBuffer

The native Vulkan resource handle of this command buffer.

Note: This field is read-only.

§info: CommandBufferInfo

Information used to create this object.

Implementations§

Source§

impl CommandBuffer

Source

pub fn begin( &self, info: &CommandBufferBeginInfo<'_>, ) -> Result<(), DriverError>

Begins recording this command buffer.

This is a thin wrapper around ash::Device::begin_command_buffer that maps Vulkan errors to DriverError variants.

See vkBeginCommandBuffer.

Source

pub fn create( device: &Device, info: impl Into<CommandBufferInfo>, ) -> Result<Self, DriverError>

Creates a command buffer allocation backed by a transient resettable command pool.

See vkAllocateCommandBuffers.

Source

pub fn end(&self) -> Result<(), DriverError>

Ends recording this command buffer.

This is a thin wrapper around ash::Device::end_command_buffer that maps Vulkan errors to DriverError variants.

See vkEndCommandBuffer.

Source

pub fn end_render_pass(&self)

Ends recording a render pass.

Source

pub fn queue_submit( &self, queue: Queue, fence: &mut Fence, submits: &[SubmitInfo<'_>], ) -> Result<(), DriverError>

Submits command buffers to a queue using fence.

This method does not begin, end, or reset self or fence. Callers are expected to submit only executable command buffers and to manage fence waits and resets as needed.

Typical handling is:

  1. Begin recording with Self::begin.
  2. Record commands.
  3. End recording with Self::end.
  4. Submit this command buffer with queue_submit.
  5. Later, check or wait for completion with Fence::status or Fence::wait.
  6. Before re-submitting this same command buffer, reset the fence with Fence::reset, then begin recording again.

See vkQueueSubmit.

Source

pub fn queue_submit2( &self, queue: Queue, fence: &mut Fence, submits: &[SubmitInfo2<'_>], ) -> Result<(), DriverError>

Submits command buffers to a queue using vkQueueSubmit2 (Vulkan 1.3 core or VK_KHR_synchronization2).

See vkQueueSubmit2 and VK_KHR_synchronization2.

Source

pub fn set_debug_name(&self, name: impl AsRef<str>)

Sets the debugging name assigned to this command buffer.

Source

pub fn with_debug_name(self, name: impl AsRef<str>) -> Self

Sets the debugging name assigned to this command buffer.

Trait Implementations§

Source§

impl AsRef<CommandBuffer> for CommandBuffer

Source§

fn as_ref(&self) -> &CommandBuffer

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Debug for CommandBuffer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for CommandBuffer

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Pool<CommandBufferInfo, CommandBuffer> for FifoPool

Source§

fn resource( &mut self, info: CommandBufferInfo, ) -> Result<Lease<CommandBuffer>, DriverError>

Request a resource.
Source§

impl Pool<CommandBufferInfo, CommandBuffer> for HashPool

Source§

fn resource( &mut self, info: CommandBufferInfo, ) -> Result<Lease<CommandBuffer>, DriverError>

Request a resource.
Source§

impl Pool<CommandBufferInfo, CommandBuffer> for LazyPool

Source§

fn resource( &mut self, info: CommandBufferInfo, ) -> Result<Lease<CommandBuffer>, DriverError>

Request a resource.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.