Struct vulkano::command_buffer::cb::StateCacheLayer
[−]
[src]
pub struct StateCacheLayer<I> { /* fields omitted */ }
Layer around a command buffer builder that caches the current state of the command buffer and avoids redundant state changes.
For example if you add a command that sets the current vertex buffer, then later another command that sets the current vertex buffer to the same value, then the second one will be discarded by this layer.
As a general rule there's no reason not to use this layer unless you know that your commands are already optimized in this regard.
Safety
This layer expects that the commands passed to it all belong to the same device.
Since this layer can potentially optimize out some commands, a mismatch between devices could potentially go undetected if it is checked in a lower layer.
Methods
impl<I> StateCacheLayer<I>
[src]
fn new(inner: I) -> StateCacheLayer<I>
Builds a new StateCacheLayer
.
It is safe to start caching at any point of the construction of a command buffer.
fn into_inner(self) -> I
Destroys the layer and returns the underlying command buffer.
Trait Implementations
impl<I> DeviceOwned for StateCacheLayer<I> where
I: DeviceOwned,
[src]
I: DeviceOwned,
impl<I> CommandBufferBuilder for StateCacheLayer<I> where
I: CommandBufferBuilder,
[src]
I: CommandBufferBuilder,
fn queue_family(&self) -> QueueFamily
Returns the queue family of the command buffer builder.
fn fill_buffer<B, O>(
self,
buffer: B,
data: u32
) -> Result<O, CommandBufferBuilderError<CmdFillBufferError>> where
Self: Sized + AddCommand<CmdFillBuffer<B::Access>, Out = O>,
B: Buffer,
self,
buffer: B,
data: u32
) -> Result<O, CommandBufferBuilderError<CmdFillBufferError>> where
Self: Sized + AddCommand<CmdFillBuffer<B::Access>, Out = O>,
B: Buffer,
Adds a command that writes the content of a buffer. Read more
fn update_buffer<B, D, O>(
self,
buffer: B,
data: D
) -> Result<O, CommandBufferBuilderError<CmdUpdateBufferError>> where
Self: Sized + AddCommand<CmdUpdateBuffer<B::Access, D>, Out = O>,
B: Buffer + TypedBuffer<Content = D>,
D: 'static,
self,
buffer: B,
data: D
) -> Result<O, CommandBufferBuilderError<CmdUpdateBufferError>> where
Self: Sized + AddCommand<CmdUpdateBuffer<B::Access, D>, Out = O>,
B: Buffer + TypedBuffer<Content = D>,
D: 'static,
Adds a command that writes data to a buffer.
fn copy_buffer<S, D, O>(
self,
src: S,
dest: D
) -> Result<O, CommandBufferBuilderError<CmdCopyBufferError>> where
Self: Sized + AddCommand<CmdCopyBuffer<S::Access, D::Access>, Out = O>,
S: Buffer,
D: Buffer,
self,
src: S,
dest: D
) -> Result<O, CommandBufferBuilderError<CmdCopyBufferError>> where
Self: Sized + AddCommand<CmdCopyBuffer<S::Access, D::Access>, Out = O>,
S: Buffer,
D: Buffer,
Adds a command that copies from a buffer to another.
fn copy_buffer_to_image<B, I, O>(
self,
buffer: B,
image: I
) -> Result<O, CommandBufferBuilderError<CmdCopyBufferToImageError>> where
Self: Sized + AddCommand<CmdCopyBufferToImage<B::Access, I::Access>, Out = O>,
B: Buffer,
I: Image,
self,
buffer: B,
image: I
) -> Result<O, CommandBufferBuilderError<CmdCopyBufferToImageError>> where
Self: Sized + AddCommand<CmdCopyBufferToImage<B::Access, I::Access>, Out = O>,
B: Buffer,
I: Image,
Adds a command that copies the content of a buffer to an image. Read more
fn copy_buffer_to_image_dimensions<B, I, O>(
self,
buffer: B,
image: I,
offset: [u32; 3],
size: [u32; 3],
first_layer: u32,
num_layers: u32,
mipmap: u32
) -> Result<O, CommandBufferBuilderError<CmdCopyBufferToImageError>> where
Self: Sized + AddCommand<CmdCopyBufferToImage<B::Access, I::Access>, Out = O>,
B: Buffer,
I: Image,
self,
buffer: B,
image: I,
offset: [u32; 3],
size: [u32; 3],
first_layer: u32,
num_layers: u32,
mipmap: u32
) -> Result<O, CommandBufferBuilderError<CmdCopyBufferToImageError>> where
Self: Sized + AddCommand<CmdCopyBufferToImage<B::Access, I::Access>, Out = O>,
B: Buffer,
I: Image,
Same as copy_buffer_to_image
but lets you specify a range for the destination image.
fn begin_render_pass<F, C, O>(
self,
framebuffer: F,
secondary: bool,
clear_values: C
) -> Result<O, CommandAddError> where
Self: Sized + AddCommand<CmdBeginRenderPass<Arc<RenderPassAbstract + Send + Sync>, F>, Out = O>,
F: FramebufferAbstract + RenderPassDescClearValues<C>,
self,
framebuffer: F,
secondary: bool,
clear_values: C
) -> Result<O, CommandAddError> where
Self: Sized + AddCommand<CmdBeginRenderPass<Arc<RenderPassAbstract + Send + Sync>, F>, Out = O>,
F: FramebufferAbstract + RenderPassDescClearValues<C>,
Adds a command that starts a render pass. Read more
fn next_subpass<O>(self, secondary: bool) -> Result<O, CommandAddError> where
Self: Sized + AddCommand<CmdNextSubpass, Out = O>,
Self: Sized + AddCommand<CmdNextSubpass, Out = O>,
Adds a command that jumps to the next subpass of the current render pass.
fn end_render_pass<O>(self) -> Result<O, CommandAddError> where
Self: Sized + AddCommand<CmdEndRenderPass, Out = O>,
Self: Sized + AddCommand<CmdEndRenderPass, Out = O>,
Adds a command that ends the current render pass. Read more
fn draw<P, S, Pc, V, O>(
self,
pipeline: P,
dynamic: DynamicState,
vertices: V,
sets: S,
push_constants: Pc
) -> Result<O, CommandAddError> where
Self: Sized + AddCommand<CmdDraw<V, P, S, Pc>, Out = O>,
S: DescriptorSetsCollection,
P: VertexSource<V> + GraphicsPipelineAbstract + Clone,
self,
pipeline: P,
dynamic: DynamicState,
vertices: V,
sets: S,
push_constants: Pc
) -> Result<O, CommandAddError> where
Self: Sized + AddCommand<CmdDraw<V, P, S, Pc>, Out = O>,
S: DescriptorSetsCollection,
P: VertexSource<V> + GraphicsPipelineAbstract + Clone,
Adds a command that draws. Read more
fn draw_indexed<P, S, Pc, V, Ib, I, O>(
self,
pipeline: P,
dynamic: DynamicState,
vertices: V,
index_buffer: Ib,
sets: S,
push_constants: Pc
) -> Result<O, CommandAddError> where
Self: Sized + AddCommand<CmdDrawIndexed<V, Ib::Access, P, S, Pc>, Out = O>,
S: DescriptorSetsCollection,
P: VertexSource<V> + GraphicsPipelineAbstract + Clone,
Ib: Buffer,
Ib::Access: TypedBufferAccess<Content = [I]>,
I: Index + 'static,
self,
pipeline: P,
dynamic: DynamicState,
vertices: V,
index_buffer: Ib,
sets: S,
push_constants: Pc
) -> Result<O, CommandAddError> where
Self: Sized + AddCommand<CmdDrawIndexed<V, Ib::Access, P, S, Pc>, Out = O>,
S: DescriptorSetsCollection,
P: VertexSource<V> + GraphicsPipelineAbstract + Clone,
Ib: Buffer,
Ib::Access: TypedBufferAccess<Content = [I]>,
I: Index + 'static,
Adds a command that draws indexed vertices. Read more
fn draw_indirect<P, S, Pc, V, B, O>(
self,
pipeline: P,
dynamic: DynamicState,
vertices: V,
indirect_buffer: B,
sets: S,
push_constants: Pc
) -> Result<O, CommandAddError> where
Self: Sized + AddCommand<CmdDrawIndirect<V, B::Access, P, S, Pc>, Out = O>,
S: DescriptorSetsCollection,
P: VertexSource<V> + GraphicsPipelineAbstract + Clone,
B: Buffer,
B::Access: TypedBufferAccess<Content = [DrawIndirectCommand]>,
self,
pipeline: P,
dynamic: DynamicState,
vertices: V,
indirect_buffer: B,
sets: S,
push_constants: Pc
) -> Result<O, CommandAddError> where
Self: Sized + AddCommand<CmdDrawIndirect<V, B::Access, P, S, Pc>, Out = O>,
S: DescriptorSetsCollection,
P: VertexSource<V> + GraphicsPipelineAbstract + Clone,
B: Buffer,
B::Access: TypedBufferAccess<Content = [DrawIndirectCommand]>,
Adds an indirect draw command. Read more
fn dispatch<P, S, Pc, O>(
self,
dimensions: [u32; 3],
pipeline: P,
sets: S,
push_constants: Pc
) -> Result<O, CommandBufferBuilderError<CmdDispatchError>> where
Self: Sized + AddCommand<CmdDispatch<P, S, Pc>, Out = O>,
S: DescriptorSetsCollection,
P: Clone + ComputePipelineAbstract,
self,
dimensions: [u32; 3],
pipeline: P,
sets: S,
push_constants: Pc
) -> Result<O, CommandBufferBuilderError<CmdDispatchError>> where
Self: Sized + AddCommand<CmdDispatch<P, S, Pc>, Out = O>,
S: DescriptorSetsCollection,
P: Clone + ComputePipelineAbstract,
Executes a compute shader.
fn build(self) -> Result<Self::Out, Self::Err> where
Self: Sized + CommandBufferBuild,
Self: Sized + CommandBufferBuild,
Builds the actual command buffer. Read more
fn supports_graphics(&self) -> bool
Returns true if the pool of the builder supports graphics operations.
fn supports_compute(&self) -> bool
Returns true if the pool of the builder supports compute operations.
impl<Pl, I, O> AddCommand<CmdBindPipeline<Pl>> for StateCacheLayer<I> where
I: AddCommand<CmdBindPipeline<Pl>, Out = O>,
[src]
I: AddCommand<CmdBindPipeline<Pl>, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(self, command: CmdBindPipeline<Pl>) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<Cb, I, O> AddCommand<CmdExecuteCommands<Cb>> for StateCacheLayer<I> where
I: AddCommand<CmdExecuteCommands<Cb>, Out = O>,
[src]
I: AddCommand<CmdExecuteCommands<Cb>, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(
self,
command: CmdExecuteCommands<Cb>
) -> Result<Self::Out, CommandAddError>
self,
command: CmdExecuteCommands<Cb>
) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<I, O> AddCommand<CmdSetState> for StateCacheLayer<I> where
I: AddCommand<CmdSetState, Out = O>,
[src]
I: AddCommand<CmdSetState, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(self, command: CmdSetState) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<I, O, B> AddCommand<CmdBindVertexBuffers<B>> for StateCacheLayer<I> where
I: AddCommand<CmdBindVertexBuffers<B>, Out = O>,
[src]
I: AddCommand<CmdBindVertexBuffers<B>, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(
self,
command: CmdBindVertexBuffers<B>
) -> Result<Self::Out, CommandAddError>
self,
command: CmdBindVertexBuffers<B>
) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<I, O, E> CommandBufferBuild for StateCacheLayer<I> where
I: CommandBufferBuild<Out = O, Err = E>,
[src]
I: CommandBufferBuild<Out = O, Err = E>,
type Out = O
The type of the built command buffer.
type Err = E
Error that can be returned when building.
fn build(self) -> Result<O, E>
Builds the command buffer.
impl<'a, I, O, Rp, F> AddCommand<CmdBeginRenderPass<Rp, F>> for StateCacheLayer<I> where
I: AddCommand<CmdBeginRenderPass<Rp, F>, Out = O>,
[src]
I: AddCommand<CmdBeginRenderPass<Rp, F>, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(
self,
command: CmdBeginRenderPass<Rp, F>
) -> Result<Self::Out, CommandAddError>
self,
command: CmdBeginRenderPass<Rp, F>
) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<'a, I, O, S, Pl> AddCommand<CmdBindDescriptorSets<S, Pl>> for StateCacheLayer<I> where
I: AddCommand<CmdBindDescriptorSets<S, Pl>, Out = O>,
[src]
I: AddCommand<CmdBindDescriptorSets<S, Pl>, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(
self,
command: CmdBindDescriptorSets<S, Pl>
) -> Result<Self::Out, CommandAddError>
self,
command: CmdBindDescriptorSets<S, Pl>
) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<'a, I, O, B> AddCommand<CmdBindIndexBuffer<B>> for StateCacheLayer<I> where
I: AddCommand<CmdBindIndexBuffer<B>, Out = O>,
[src]
I: AddCommand<CmdBindIndexBuffer<B>, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(
self,
command: CmdBindIndexBuffer<B>
) -> Result<Self::Out, CommandAddError>
self,
command: CmdBindIndexBuffer<B>
) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<'a, I, O, S, D> AddCommand<CmdBlitImage<S, D>> for StateCacheLayer<I> where
I: AddCommand<CmdBlitImage<S, D>, Out = O>,
[src]
I: AddCommand<CmdBlitImage<S, D>, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(self, command: CmdBlitImage<S, D>) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<'a, I, O> AddCommand<CmdClearAttachments> for StateCacheLayer<I> where
I: AddCommand<CmdClearAttachments, Out = O>,
[src]
I: AddCommand<CmdClearAttachments, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(self, command: CmdClearAttachments) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<'a, I, O, S, D> AddCommand<CmdCopyBuffer<S, D>> for StateCacheLayer<I> where
I: AddCommand<CmdCopyBuffer<S, D>, Out = O>,
[src]
I: AddCommand<CmdCopyBuffer<S, D>, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(self, command: CmdCopyBuffer<S, D>) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<'a, I, O, S, D> AddCommand<CmdCopyBufferToImage<S, D>> for StateCacheLayer<I> where
I: AddCommand<CmdCopyBufferToImage<S, D>, Out = O>,
[src]
I: AddCommand<CmdCopyBufferToImage<S, D>, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(
self,
command: CmdCopyBufferToImage<S, D>
) -> Result<Self::Out, CommandAddError>
self,
command: CmdCopyBufferToImage<S, D>
) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<'a, I, O, S, D> AddCommand<CmdCopyImage<S, D>> for StateCacheLayer<I> where
I: AddCommand<CmdCopyImage<S, D>, Out = O>,
[src]
I: AddCommand<CmdCopyImage<S, D>, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(self, command: CmdCopyImage<S, D>) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<'a, I, O> AddCommand<CmdDispatchRaw> for StateCacheLayer<I> where
I: AddCommand<CmdDispatchRaw, Out = O>,
[src]
I: AddCommand<CmdDispatchRaw, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(self, command: CmdDispatchRaw) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<'a, I, O> AddCommand<CmdDrawIndexedRaw> for StateCacheLayer<I> where
I: AddCommand<CmdDrawIndexedRaw, Out = O>,
[src]
I: AddCommand<CmdDrawIndexedRaw, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(self, command: CmdDrawIndexedRaw) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<'a, I, O, B> AddCommand<CmdDrawIndirectRaw<B>> for StateCacheLayer<I> where
I: AddCommand<CmdDrawIndirectRaw<B>, Out = O>,
[src]
I: AddCommand<CmdDrawIndirectRaw<B>, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(
self,
command: CmdDrawIndirectRaw<B>
) -> Result<Self::Out, CommandAddError>
self,
command: CmdDrawIndirectRaw<B>
) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<'a, I, O> AddCommand<CmdDrawRaw> for StateCacheLayer<I> where
I: AddCommand<CmdDrawRaw, Out = O>,
[src]
I: AddCommand<CmdDrawRaw, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(self, command: CmdDrawRaw) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<'a, I, O> AddCommand<CmdEndRenderPass> for StateCacheLayer<I> where
I: AddCommand<CmdEndRenderPass, Out = O>,
[src]
I: AddCommand<CmdEndRenderPass, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(self, command: CmdEndRenderPass) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<'a, I, O, B> AddCommand<CmdFillBuffer<B>> for StateCacheLayer<I> where
I: AddCommand<CmdFillBuffer<B>, Out = O>,
[src]
I: AddCommand<CmdFillBuffer<B>, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(self, command: CmdFillBuffer<B>) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<'a, I, O> AddCommand<CmdNextSubpass> for StateCacheLayer<I> where
I: AddCommand<CmdNextSubpass, Out = O>,
[src]
I: AddCommand<CmdNextSubpass, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(self, command: CmdNextSubpass) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<'a, I, O, Pc, Pl> AddCommand<CmdPushConstants<Pc, Pl>> for StateCacheLayer<I> where
I: AddCommand<CmdPushConstants<Pc, Pl>, Out = O>,
[src]
I: AddCommand<CmdPushConstants<Pc, Pl>, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(
self,
command: CmdPushConstants<Pc, Pl>
) -> Result<Self::Out, CommandAddError>
self,
command: CmdPushConstants<Pc, Pl>
) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<'a, I, O, S, D> AddCommand<CmdResolveImage<S, D>> for StateCacheLayer<I> where
I: AddCommand<CmdResolveImage<S, D>, Out = O>,
[src]
I: AddCommand<CmdResolveImage<S, D>, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(
self,
command: CmdResolveImage<S, D>
) -> Result<Self::Out, CommandAddError>
self,
command: CmdResolveImage<S, D>
) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<'a, I, O> AddCommand<CmdSetEvent> for StateCacheLayer<I> where
I: AddCommand<CmdSetEvent, Out = O>,
[src]
I: AddCommand<CmdSetEvent, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(self, command: CmdSetEvent) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more
impl<'a, I, O, B, D> AddCommand<CmdUpdateBuffer<B, D>> for StateCacheLayer<I> where
I: AddCommand<CmdUpdateBuffer<B, D>, Out = O>,
[src]
I: AddCommand<CmdUpdateBuffer<B, D>, Out = O>,
type Out = StateCacheLayer<O>
The new command buffer builder type.
fn add(
self,
command: CmdUpdateBuffer<B, D>
) -> Result<Self::Out, CommandAddError>
self,
command: CmdUpdateBuffer<B, D>
) -> Result<Self::Out, CommandAddError>
Adds the command. This takes ownership of the builder and returns a new builder with the command appended at the end of it. Read more