Struct vulkano::command_buffer::synced::SyncCommandBufferBuilder
source · pub struct SyncCommandBufferBuilder<P> { /* private fields */ }
Expand description
Wrapper around UnsafeCommandBufferBuilder
that handles synchronization for you.
Each method of the UnsafeCommandBufferBuilder
has an equivalent in this wrapper, except
for pipeline_layout
which is automatically handled. This wrapper automatically builds
pipeline barriers, keeps used resources alive and implements the CommandBuffer
trait.
Since the implementation needs to cache commands in a Vec
, most methods have additional
Send + Sync + 'static
trait requirements on their generics.
If this builder finds out that a command isn’t valid because of synchronization reasons (eg. trying to copy from a buffer to an image which share the same memory), then an error is returned. Note that all methods are still unsafe, because this builder doesn’t check the validity of the commands except for synchronization purposes. The builder may panic if you pass invalid commands.
The P
generic is the same as UnsafeCommandBufferBuilder
.
Implementations
sourceimpl<P> SyncCommandBufferBuilder<P>
impl<P> SyncCommandBufferBuilder<P>
sourcepub unsafe fn new<Pool, R, F, A>(
pool: &Pool,
kind: Kind<R, F>,
flags: Flags
) -> Result<SyncCommandBufferBuilder<P>, OomError>where
Pool: CommandPool<Builder = P, Alloc = A>,
P: CommandPoolBuilderAlloc<Alloc = A>,
A: CommandPoolAlloc,
R: RenderPassAbstract,
F: FramebufferAbstract,
pub unsafe fn new<Pool, R, F, A>(
pool: &Pool,
kind: Kind<R, F>,
flags: Flags
) -> Result<SyncCommandBufferBuilder<P>, OomError>where
Pool: CommandPool<Builder = P, Alloc = A>,
P: CommandPoolBuilderAlloc<Alloc = A>,
A: CommandPoolAlloc,
R: RenderPassAbstract,
F: FramebufferAbstract,
Builds a new SyncCommandBufferBuilder
. The parameters are the same as the
UnsafeCommandBufferBuilder::new
function.
Safety
See UnsafeCommandBufferBuilder::new()
and SyncCommandBufferBuilder
.
sourcepub unsafe fn from_unsafe_cmd(
cmd: UnsafeCommandBufferBuilder<P>,
is_secondary: bool,
inside_render_pass: bool
) -> SyncCommandBufferBuilder<P>
pub unsafe fn from_unsafe_cmd(
cmd: UnsafeCommandBufferBuilder<P>,
is_secondary: bool,
inside_render_pass: bool
) -> SyncCommandBufferBuilder<P>
Builds a SyncCommandBufferBuilder
from an existing UnsafeCommandBufferBuilder
.
Safety
See UnsafeCommandBufferBuilder::new()
and SyncCommandBufferBuilder
.
In addition to this, the UnsafeCommandBufferBuilder
should be empty. If it isn’t, then
you must take into account the fact that the SyncCommandBufferBuilder
won’t be aware of
any existing resource usage.
sourcepub fn build(self) -> Result<SyncCommandBuffer<P::Alloc>, OomError>where
P: CommandPoolBuilderAlloc,
pub fn build(self) -> Result<SyncCommandBuffer<P::Alloc>, OomError>where
P: CommandPoolBuilderAlloc,
Builds the command buffer and turns it into a SyncCommandBuffer
.
sourceimpl<P> SyncCommandBufferBuilder<P>
impl<P> SyncCommandBufferBuilder<P>
sourcepub unsafe fn begin_render_pass<F, I>(
&mut self,
framebuffer: F,
subpass_contents: SubpassContents,
clear_values: I
) -> Result<(), SyncCommandBufferBuilderError>where
F: FramebufferAbstract + Send + Sync + 'static,
I: Iterator<Item = ClearValue> + Send + Sync + 'static,
pub unsafe fn begin_render_pass<F, I>(
&mut self,
framebuffer: F,
subpass_contents: SubpassContents,
clear_values: I
) -> Result<(), SyncCommandBufferBuilderError>where
F: FramebufferAbstract + Send + Sync + 'static,
I: Iterator<Item = ClearValue> + Send + Sync + 'static,
Calls vkBeginRenderPass
on the builder.
sourcepub unsafe fn bind_index_buffer<B>(
&mut self,
buffer: B,
index_ty: IndexType
) -> Result<(), SyncCommandBufferBuilderError>where
B: BufferAccess + Send + Sync + 'static,
pub unsafe fn bind_index_buffer<B>(
&mut self,
buffer: B,
index_ty: IndexType
) -> Result<(), SyncCommandBufferBuilderError>where
B: BufferAccess + Send + Sync + 'static,
Calls vkCmdBindIndexBuffer
on the builder.
sourcepub unsafe fn bind_pipeline_graphics<Gp>(&mut self, pipeline: Gp)where
Gp: GraphicsPipelineAbstract + Send + Sync + 'static,
pub unsafe fn bind_pipeline_graphics<Gp>(&mut self, pipeline: Gp)where
Gp: GraphicsPipelineAbstract + Send + Sync + 'static,
Calls vkCmdBindPipeline
on the builder with a graphics pipeline.
sourcepub unsafe fn bind_pipeline_compute<Cp>(&mut self, pipeline: Cp)where
Cp: ComputePipelineAbstract + Send + Sync + 'static,
pub unsafe fn bind_pipeline_compute<Cp>(&mut self, pipeline: Cp)where
Cp: ComputePipelineAbstract + Send + Sync + 'static,
Calls vkCmdBindPipeline
on the builder with a compute pipeline.
sourcepub fn bind_descriptor_sets(
&mut self
) -> SyncCommandBufferBuilderBindDescriptorSets<'_, P>
pub fn bind_descriptor_sets(
&mut self
) -> SyncCommandBufferBuilderBindDescriptorSets<'_, P>
Starts the process of binding descriptor sets. Returns an intermediate struct which can be used to add the sets.
sourcepub fn bind_vertex_buffers(
&mut self
) -> SyncCommandBufferBuilderBindVertexBuffer<'_, P>
pub fn bind_vertex_buffers(
&mut self
) -> SyncCommandBufferBuilderBindVertexBuffer<'_, P>
Starts the process of binding vertex buffers. Returns an intermediate struct which can be used to add the buffers.
sourcepub unsafe fn copy_image<S, D, R>(
&mut self,
source: S,
source_layout: ImageLayout,
destination: D,
destination_layout: ImageLayout,
regions: R
) -> Result<(), SyncCommandBufferBuilderError>where
S: ImageAccess + Send + Sync + 'static,
D: ImageAccess + Send + Sync + 'static,
R: Iterator<Item = UnsafeCommandBufferBuilderImageCopy> + Send + Sync + 'static,
pub unsafe fn copy_image<S, D, R>(
&mut self,
source: S,
source_layout: ImageLayout,
destination: D,
destination_layout: ImageLayout,
regions: R
) -> Result<(), SyncCommandBufferBuilderError>where
S: ImageAccess + Send + Sync + 'static,
D: ImageAccess + Send + Sync + 'static,
R: Iterator<Item = UnsafeCommandBufferBuilderImageCopy> + Send + Sync + 'static,
Calls vkCmdCopyImage
on the builder.
Does nothing if the list of regions is empty, as it would be a no-op and isn’t a valid usage of the command anyway.
sourcepub unsafe fn blit_image<S, D, R>(
&mut self,
source: S,
source_layout: ImageLayout,
destination: D,
destination_layout: ImageLayout,
regions: R,
filter: Filter
) -> Result<(), SyncCommandBufferBuilderError>where
S: ImageAccess + Send + Sync + 'static,
D: ImageAccess + Send + Sync + 'static,
R: Iterator<Item = UnsafeCommandBufferBuilderImageBlit> + Send + Sync + 'static,
pub unsafe fn blit_image<S, D, R>(
&mut self,
source: S,
source_layout: ImageLayout,
destination: D,
destination_layout: ImageLayout,
regions: R,
filter: Filter
) -> Result<(), SyncCommandBufferBuilderError>where
S: ImageAccess + Send + Sync + 'static,
D: ImageAccess + Send + Sync + 'static,
R: Iterator<Item = UnsafeCommandBufferBuilderImageBlit> + Send + Sync + 'static,
Calls vkCmdBlitImage
on the builder.
Does nothing if the list of regions is empty, as it would be a no-op and isn’t a valid usage of the command anyway.
sourcepub unsafe fn clear_color_image<I, R>(
&mut self,
image: I,
layout: ImageLayout,
color: ClearValue,
regions: R
) -> Result<(), SyncCommandBufferBuilderError>where
I: ImageAccess + Send + Sync + 'static,
R: Iterator<Item = UnsafeCommandBufferBuilderColorImageClear> + Send + Sync + 'static,
pub unsafe fn clear_color_image<I, R>(
&mut self,
image: I,
layout: ImageLayout,
color: ClearValue,
regions: R
) -> Result<(), SyncCommandBufferBuilderError>where
I: ImageAccess + Send + Sync + 'static,
R: Iterator<Item = UnsafeCommandBufferBuilderColorImageClear> + Send + Sync + 'static,
Calls vkCmdClearColorImage
on the builder.
Does nothing if the list of regions is empty, as it would be a no-op and isn’t a valid usage of the command anyway.
sourcepub unsafe fn copy_buffer<S, D, R>(
&mut self,
source: S,
destination: D,
regions: R
) -> Result<(), SyncCommandBufferBuilderError>where
S: BufferAccess + Send + Sync + 'static,
D: BufferAccess + Send + Sync + 'static,
R: Iterator<Item = (usize, usize, usize)> + Send + Sync + 'static,
pub unsafe fn copy_buffer<S, D, R>(
&mut self,
source: S,
destination: D,
regions: R
) -> Result<(), SyncCommandBufferBuilderError>where
S: BufferAccess + Send + Sync + 'static,
D: BufferAccess + Send + Sync + 'static,
R: Iterator<Item = (usize, usize, usize)> + Send + Sync + 'static,
Calls vkCmdCopyBuffer
on the builder.
Does nothing if the list of regions is empty, as it would be a no-op and isn’t a valid usage of the command anyway.
sourcepub unsafe fn copy_buffer_to_image<S, D, R>(
&mut self,
source: S,
destination: D,
destination_layout: ImageLayout,
regions: R
) -> Result<(), SyncCommandBufferBuilderError>where
S: BufferAccess + Send + Sync + 'static,
D: ImageAccess + Send + Sync + 'static,
R: Iterator<Item = UnsafeCommandBufferBuilderBufferImageCopy> + Send + Sync + 'static,
pub unsafe fn copy_buffer_to_image<S, D, R>(
&mut self,
source: S,
destination: D,
destination_layout: ImageLayout,
regions: R
) -> Result<(), SyncCommandBufferBuilderError>where
S: BufferAccess + Send + Sync + 'static,
D: ImageAccess + Send + Sync + 'static,
R: Iterator<Item = UnsafeCommandBufferBuilderBufferImageCopy> + Send + Sync + 'static,
Calls vkCmdCopyBufferToImage
on the builder.
Does nothing if the list of regions is empty, as it would be a no-op and isn’t a valid usage of the command anyway.
sourcepub unsafe fn copy_image_to_buffer<S, D, R>(
&mut self,
source: S,
source_layout: ImageLayout,
destination: D,
regions: R
) -> Result<(), SyncCommandBufferBuilderError>where
S: ImageAccess + Send + Sync + 'static,
D: BufferAccess + Send + Sync + 'static,
R: Iterator<Item = UnsafeCommandBufferBuilderBufferImageCopy> + Send + Sync + 'static,
pub unsafe fn copy_image_to_buffer<S, D, R>(
&mut self,
source: S,
source_layout: ImageLayout,
destination: D,
regions: R
) -> Result<(), SyncCommandBufferBuilderError>where
S: ImageAccess + Send + Sync + 'static,
D: BufferAccess + Send + Sync + 'static,
R: Iterator<Item = UnsafeCommandBufferBuilderBufferImageCopy> + Send + Sync + 'static,
Calls vkCmdCopyImageToBuffer
on the builder.
Does nothing if the list of regions is empty, as it would be a no-op and isn’t a valid usage of the command anyway.
sourcepub unsafe fn dispatch_indirect<B>(
&mut self,
buffer: B
) -> Result<(), SyncCommandBufferBuilderError>where
B: BufferAccess + Send + Sync + 'static,
pub unsafe fn dispatch_indirect<B>(
&mut self,
buffer: B
) -> Result<(), SyncCommandBufferBuilderError>where
B: BufferAccess + Send + Sync + 'static,
Calls vkCmdDispatchIndirect
on the builder.
sourcepub unsafe fn draw(
&mut self,
vertex_count: u32,
instance_count: u32,
first_vertex: u32,
first_instance: u32
)
pub unsafe fn draw(
&mut self,
vertex_count: u32,
instance_count: u32,
first_vertex: u32,
first_instance: u32
)
Calls vkCmdDraw
on the builder.
sourcepub unsafe fn draw_indexed(
&mut self,
index_count: u32,
instance_count: u32,
first_index: u32,
vertex_offset: i32,
first_instance: u32
)
pub unsafe fn draw_indexed(
&mut self,
index_count: u32,
instance_count: u32,
first_index: u32,
vertex_offset: i32,
first_instance: u32
)
Calls vkCmdDrawIndexed
on the builder.
sourcepub unsafe fn draw_indirect<B>(
&mut self,
buffer: B,
draw_count: u32,
stride: u32
) -> Result<(), SyncCommandBufferBuilderError>where
B: BufferAccess + Send + Sync + 'static,
pub unsafe fn draw_indirect<B>(
&mut self,
buffer: B,
draw_count: u32,
stride: u32
) -> Result<(), SyncCommandBufferBuilderError>where
B: BufferAccess + Send + Sync + 'static,
Calls vkCmdDrawIndirect
on the builder.
sourcepub unsafe fn draw_indexed_indirect<B>(
&mut self,
buffer: B,
draw_count: u32,
stride: u32
) -> Result<(), SyncCommandBufferBuilderError>where
B: BufferAccess + Send + Sync + 'static,
pub unsafe fn draw_indexed_indirect<B>(
&mut self,
buffer: B,
draw_count: u32,
stride: u32
) -> Result<(), SyncCommandBufferBuilderError>where
B: BufferAccess + Send + Sync + 'static,
Calls vkCmdDrawIndexedIndirect
on the builder.
sourcepub unsafe fn end_render_pass(&mut self)
pub unsafe fn end_render_pass(&mut self)
Calls vkCmdEndRenderPass
on the builder.
sourcepub unsafe fn execute_commands(
&mut self
) -> SyncCommandBufferBuilderExecuteCommands<'_, P>
pub unsafe fn execute_commands(
&mut self
) -> SyncCommandBufferBuilderExecuteCommands<'_, P>
Starts the process of executing secondary command buffers. Returns an intermediate struct which can be used to add the command buffers.
sourcepub unsafe fn fill_buffer<B>(&mut self, buffer: B, data: u32)where
B: BufferAccess + Send + Sync + 'static,
pub unsafe fn fill_buffer<B>(&mut self, buffer: B, data: u32)where
B: BufferAccess + Send + Sync + 'static,
Calls vkCmdFillBuffer
on the builder.
sourcepub unsafe fn next_subpass(&mut self, subpass_contents: SubpassContents)
pub unsafe fn next_subpass(&mut self, subpass_contents: SubpassContents)
Calls vkCmdNextSubpass
on the builder.
sourcepub unsafe fn push_constants<Pl, D>(
&mut self,
pipeline_layout: Pl,
stages: ShaderStages,
offset: u32,
size: u32,
data: &D
)where
Pl: PipelineLayoutAbstract + Send + Sync + 'static,
D: ?Sized + Send + Sync + 'static,
pub unsafe fn push_constants<Pl, D>(
&mut self,
pipeline_layout: Pl,
stages: ShaderStages,
offset: u32,
size: u32,
data: &D
)where
Pl: PipelineLayoutAbstract + Send + Sync + 'static,
D: ?Sized + Send + Sync + 'static,
Calls vkCmdPushConstants
on the builder.
sourcepub unsafe fn reset_event(&mut self, event: Arc<Event>, stages: PipelineStages)
pub unsafe fn reset_event(&mut self, event: Arc<Event>, stages: PipelineStages)
Calls vkCmdResetEvent
on the builder.
sourcepub unsafe fn set_blend_constants(&mut self, constants: [f32; 4])
pub unsafe fn set_blend_constants(&mut self, constants: [f32; 4])
Calls vkCmdSetBlendConstants
on the builder.
sourcepub unsafe fn set_depth_bias(
&mut self,
constant_factor: f32,
clamp: f32,
slope_factor: f32
)
pub unsafe fn set_depth_bias(
&mut self,
constant_factor: f32,
clamp: f32,
slope_factor: f32
)
Calls vkCmdSetDepthBias
on the builder.
sourcepub unsafe fn set_depth_bounds(&mut self, min: f32, max: f32)
pub unsafe fn set_depth_bounds(&mut self, min: f32, max: f32)
Calls vkCmdSetDepthBounds
on the builder.
sourcepub unsafe fn set_event(&mut self, event: Arc<Event>, stages: PipelineStages)
pub unsafe fn set_event(&mut self, event: Arc<Event>, stages: PipelineStages)
Calls vkCmdSetEvent
on the builder.
sourcepub unsafe fn set_line_width(&mut self, line_width: f32)
pub unsafe fn set_line_width(&mut self, line_width: f32)
Calls vkCmdSetLineWidth
on the builder.
sourcepub unsafe fn set_scissor<I>(&mut self, first_scissor: u32, scissors: I)where
I: Iterator<Item = Scissor> + Send + Sync + 'static,
pub unsafe fn set_scissor<I>(&mut self, first_scissor: u32, scissors: I)where
I: Iterator<Item = Scissor> + Send + Sync + 'static,
Calls vkCmdSetScissor
on the builder.
If the list is empty then the command is automatically ignored.
sourcepub unsafe fn set_viewport<I>(&mut self, first_viewport: u32, viewports: I)where
I: Iterator<Item = Viewport> + Send + Sync + 'static,
pub unsafe fn set_viewport<I>(&mut self, first_viewport: u32, viewports: I)where
I: Iterator<Item = Viewport> + Send + Sync + 'static,
Calls vkCmdSetViewport
on the builder.
If the list is empty then the command is automatically ignored.
sourcepub unsafe fn update_buffer<B, D>(&mut self, buffer: B, data: D)where
B: BufferAccess + Send + Sync + 'static,
D: Send + Sync + 'static,
pub unsafe fn update_buffer<B, D>(&mut self, buffer: B, data: D)where
B: BufferAccess + Send + Sync + 'static,
D: Send + Sync + 'static,
Calls vkCmdUpdateBuffer
on the builder.