Struct vulkano::command_buffer::sys::UnsafeCommandBufferBuilder
source · pub struct UnsafeCommandBufferBuilder<P> { /* private fields */ }
Expand description
Command buffer being built.
You can add commands to an UnsafeCommandBufferBuilder
by using the AddCommand
trait.
The AddCommand<&Cmd>
trait is implemented on the UnsafeCommandBufferBuilder
for any Cmd
that is a raw Vulkan command.
When you are finished adding commands, you can use the CommandBufferBuild
trait to turn this
builder into an UnsafeCommandBuffer
.
Implementations
sourceimpl<P> UnsafeCommandBufferBuilder<P>
impl<P> UnsafeCommandBufferBuilder<P>
sourcepub unsafe fn new<Pool, R, F, A>(
pool: &Pool,
kind: Kind<R, F>,
flags: Flags
) -> Result<UnsafeCommandBufferBuilder<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<UnsafeCommandBufferBuilder<P>, OomError>where
Pool: CommandPool<Builder = P, Alloc = A>,
P: CommandPoolBuilderAlloc<Alloc = A>,
A: CommandPoolAlloc,
R: RenderPassAbstract,
F: FramebufferAbstract,
Creates a new builder.
Safety
Creating and destroying an unsafe command buffer is not unsafe per se, but the commands that you add to it are unchecked, do not have any synchronization, and are not kept alive.
In other words, it is your job to make sure that the commands you add are valid, that they don’t use resources that have been destroyed, and that they do not introduce any race condition.
Note: Some checks are still made with
debug_assert!
. Do not expect to be able to submit invalid commands.
sourcepub unsafe fn already_allocated<R, F>(
alloc: P,
kind: Kind<R, F>,
flags: Flags
) -> Result<UnsafeCommandBufferBuilder<P>, OomError>where
R: RenderPassAbstract,
F: FramebufferAbstract,
P: CommandPoolBuilderAlloc,
pub unsafe fn already_allocated<R, F>(
alloc: P,
kind: Kind<R, F>,
flags: Flags
) -> Result<UnsafeCommandBufferBuilder<P>, OomError>where
R: RenderPassAbstract,
F: FramebufferAbstract,
P: CommandPoolBuilderAlloc,
Creates a new command buffer builder from an already-allocated command buffer.
Safety
See the new
method.
The kind must match how the command buffer was allocated.
sourcepub fn queue_family(&self) -> QueueFamily<'_>where
P: CommandPoolBuilderAlloc,
pub fn queue_family(&self) -> QueueFamily<'_>where
P: CommandPoolBuilderAlloc,
Returns the queue family of the builder.
sourcepub fn build(self) -> Result<UnsafeCommandBuffer<P::Alloc>, OomError>where
P: CommandPoolBuilderAlloc,
pub fn build(self) -> Result<UnsafeCommandBuffer<P::Alloc>, OomError>where
P: CommandPoolBuilderAlloc,
Turns the builder into an actual command buffer.
sourcepub unsafe fn begin_query(&mut self, query: UnsafeQuery<'_>, precise: bool)
pub unsafe fn begin_query(&mut self, query: UnsafeQuery<'_>, precise: bool)
Calls vkCmdBeginQuery
on the builder.
sourcepub unsafe fn begin_render_pass<F, I>(
&mut self,
framebuffer: &F,
subpass_contents: SubpassContents,
clear_values: I
)where
F: ?Sized + FramebufferAbstract,
I: Iterator<Item = ClearValue>,
pub unsafe fn begin_render_pass<F, I>(
&mut self,
framebuffer: &F,
subpass_contents: SubpassContents,
clear_values: I
)where
F: ?Sized + FramebufferAbstract,
I: Iterator<Item = ClearValue>,
Calls vkCmdBeginRenderPass
on the builder.
sourcepub unsafe fn bind_descriptor_sets<'s, Pl, S, I>(
&mut self,
graphics: bool,
pipeline_layout: &Pl,
first_binding: u32,
sets: S,
dynamic_offsets: I
)where
Pl: ?Sized + PipelineLayoutAbstract,
S: Iterator<Item = &'s UnsafeDescriptorSet>,
I: Iterator<Item = u32>,
pub unsafe fn bind_descriptor_sets<'s, Pl, S, I>(
&mut self,
graphics: bool,
pipeline_layout: &Pl,
first_binding: u32,
sets: S,
dynamic_offsets: I
)where
Pl: ?Sized + PipelineLayoutAbstract,
S: Iterator<Item = &'s UnsafeDescriptorSet>,
I: Iterator<Item = u32>,
Calls vkCmdBindDescriptorSets
on the builder.
Does nothing if the list of descriptor sets is empty, as it would be a no-op and isn’t a valid usage of the command anyway.
sourcepub unsafe fn bind_index_buffer<B>(&mut self, buffer: &B, index_ty: IndexType)where
B: ?Sized + BufferAccess,
pub unsafe fn bind_index_buffer<B>(&mut self, buffer: &B, index_ty: IndexType)where
B: ?Sized + BufferAccess,
Calls vkCmdBindIndexBuffer
on the builder.
sourcepub unsafe fn bind_pipeline_compute<Cp>(&mut self, pipeline: &Cp)where
Cp: ?Sized + ComputePipelineAbstract,
pub unsafe fn bind_pipeline_compute<Cp>(&mut self, pipeline: &Cp)where
Cp: ?Sized + ComputePipelineAbstract,
Calls vkCmdBindPipeline
on the builder with a compute pipeline.
sourcepub unsafe fn bind_pipeline_graphics<Gp>(&mut self, pipeline: &Gp)where
Gp: ?Sized + GraphicsPipelineAbstract,
pub unsafe fn bind_pipeline_graphics<Gp>(&mut self, pipeline: &Gp)where
Gp: ?Sized + GraphicsPipelineAbstract,
Calls vkCmdBindPipeline
on the builder with a graphics pipeline.
sourcepub unsafe fn bind_vertex_buffers(
&mut self,
first_binding: u32,
params: UnsafeCommandBufferBuilderBindVertexBuffer
)
pub unsafe fn bind_vertex_buffers(
&mut self,
first_binding: u32,
params: UnsafeCommandBufferBuilderBindVertexBuffer
)
Calls vkCmdBindVertexBuffers
on the builder.
Does nothing if the list of buffers is empty, as it would be a no-op and isn’t a valid usage of the command anyway.
sourcepub unsafe fn copy_image<S, D, R>(
&mut self,
source: &S,
source_layout: ImageLayout,
destination: &D,
destination_layout: ImageLayout,
regions: R
)where
S: ?Sized + ImageAccess,
D: ?Sized + ImageAccess,
R: Iterator<Item = UnsafeCommandBufferBuilderImageCopy>,
pub unsafe fn copy_image<S, D, R>(
&mut self,
source: &S,
source_layout: ImageLayout,
destination: &D,
destination_layout: ImageLayout,
regions: R
)where
S: ?Sized + ImageAccess,
D: ?Sized + ImageAccess,
R: Iterator<Item = UnsafeCommandBufferBuilderImageCopy>,
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
)where
S: ?Sized + ImageAccess,
D: ?Sized + ImageAccess,
R: Iterator<Item = UnsafeCommandBufferBuilderImageBlit>,
pub unsafe fn blit_image<S, D, R>(
&mut self,
source: &S,
source_layout: ImageLayout,
destination: &D,
destination_layout: ImageLayout,
regions: R,
filter: Filter
)where
S: ?Sized + ImageAccess,
D: ?Sized + ImageAccess,
R: Iterator<Item = UnsafeCommandBufferBuilderImageBlit>,
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
)where
I: ?Sized + ImageAccess,
R: Iterator<Item = UnsafeCommandBufferBuilderColorImageClear>,
pub unsafe fn clear_color_image<I, R>(
&mut self,
image: &I,
layout: ImageLayout,
color: ClearValue,
regions: R
)where
I: ?Sized + ImageAccess,
R: Iterator<Item = UnsafeCommandBufferBuilderColorImageClear>,
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
)where
S: ?Sized + BufferAccess,
D: ?Sized + BufferAccess,
R: Iterator<Item = (usize, usize, usize)>,
pub unsafe fn copy_buffer<S, D, R>(
&mut self,
source: &S,
destination: &D,
regions: R
)where
S: ?Sized + BufferAccess,
D: ?Sized + BufferAccess,
R: Iterator<Item = (usize, usize, usize)>,
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
)where
S: ?Sized + BufferAccess,
D: ?Sized + ImageAccess,
R: Iterator<Item = UnsafeCommandBufferBuilderBufferImageCopy>,
pub unsafe fn copy_buffer_to_image<S, D, R>(
&mut self,
source: &S,
destination: &D,
destination_layout: ImageLayout,
regions: R
)where
S: ?Sized + BufferAccess,
D: ?Sized + ImageAccess,
R: Iterator<Item = UnsafeCommandBufferBuilderBufferImageCopy>,
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
)where
S: ?Sized + ImageAccess,
D: ?Sized + BufferAccess,
R: Iterator<Item = UnsafeCommandBufferBuilderBufferImageCopy>,
pub unsafe fn copy_image_to_buffer<S, D, R>(
&mut self,
source: &S,
source_layout: ImageLayout,
destination: &D,
regions: R
)where
S: ?Sized + ImageAccess,
D: ?Sized + BufferAccess,
R: Iterator<Item = UnsafeCommandBufferBuilderBufferImageCopy>,
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 copy_query_pool_results(
&mut self,
queries: UnsafeQueriesRange<'_>,
destination: &dyn BufferAccess,
stride: usize
)
pub unsafe fn copy_query_pool_results(
&mut self,
queries: UnsafeQueriesRange<'_>,
destination: &dyn BufferAccess,
stride: usize
)
Calls vkCmdCopyQueryPoolResults
on the builder.
sourcepub unsafe fn dispatch_indirect<B>(&mut self, buffer: &B)where
B: ?Sized + BufferAccess,
pub unsafe fn dispatch_indirect<B>(&mut self, buffer: &B)where
B: ?Sized + BufferAccess,
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)where
B: ?Sized + BufferAccess,
pub unsafe fn draw_indirect<B>(&mut self, buffer: &B, draw_count: u32, stride: u32)where
B: ?Sized + BufferAccess,
Calls vkCmdDrawIndirect
on the builder.
sourcepub unsafe fn draw_indexed_indirect<B>(
&mut self,
buffer: &B,
draw_count: u32,
stride: u32
)where
B: ?Sized + BufferAccess,
pub unsafe fn draw_indexed_indirect<B>(
&mut self,
buffer: &B,
draw_count: u32,
stride: u32
)where
B: ?Sized + BufferAccess,
Calls vkCmdDrawIndexedIndirect
on the builder.
sourcepub unsafe fn end_query(&mut self, query: UnsafeQuery<'_>)
pub unsafe fn end_query(&mut self, query: UnsafeQuery<'_>)
Calls vkCmdEndQuery
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,
cbs: UnsafeCommandBufferBuilderExecuteCommands
)
pub unsafe fn execute_commands(
&mut self,
cbs: UnsafeCommandBufferBuilderExecuteCommands
)
Calls vkCmdExecuteCommands
on the builder.
Does nothing if the list of command buffers is empty, as it would be a no-op and isn’t a valid usage of the command anyway.
sourcepub unsafe fn fill_buffer<B>(&mut self, buffer: &B, data: u32)where
B: ?Sized + BufferAccess,
pub unsafe fn fill_buffer<B>(&mut self, buffer: &B, data: u32)where
B: ?Sized + BufferAccess,
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.
pub unsafe fn pipeline_barrier(
&mut self,
command: &UnsafeCommandBufferBuilderPipelineBarrier
)
sourcepub unsafe fn push_constants<Pl, D>(
&mut self,
pipeline_layout: &Pl,
stages: ShaderStages,
offset: u32,
size: u32,
data: &D
)where
Pl: ?Sized + PipelineLayoutAbstract,
D: ?Sized,
pub unsafe fn push_constants<Pl, D>(
&mut self,
pipeline_layout: &Pl,
stages: ShaderStages,
offset: u32,
size: u32,
data: &D
)where
Pl: ?Sized + PipelineLayoutAbstract,
D: ?Sized,
Calls vkCmdPushConstants
on the builder.
sourcepub unsafe fn reset_event(&mut self, event: &Event, stages: PipelineStages)
pub unsafe fn reset_event(&mut self, event: &Event, stages: PipelineStages)
Calls vkCmdResetEvent
on the builder.
sourcepub unsafe fn reset_query_pool(&mut self, queries: UnsafeQueriesRange<'_>)
pub unsafe fn reset_query_pool(&mut self, queries: UnsafeQueriesRange<'_>)
Calls vkCmdResetQueryPool
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: &Event, stages: PipelineStages)
pub unsafe fn set_event(&mut self, event: &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>,
pub unsafe fn set_scissor<I>(&mut self, first_scissor: u32, scissors: I)where
I: Iterator<Item = Scissor>,
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>,
pub unsafe fn set_viewport<I>(&mut self, first_viewport: u32, viewports: I)where
I: Iterator<Item = Viewport>,
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: ?Sized + BufferAccess,
D: ?Sized,
pub unsafe fn update_buffer<B, D>(&mut self, buffer: &B, data: &D)where
B: ?Sized + BufferAccess,
D: ?Sized,
Calls vkCmdUpdateBuffer
on the builder.
sourcepub unsafe fn write_timestamp(
&mut self,
query: UnsafeQuery<'_>,
stages: PipelineStages
)
pub unsafe fn write_timestamp(
&mut self,
query: UnsafeQuery<'_>,
stages: PipelineStages
)
Calls vkCmdWriteTimestamp
on the builder.
sourcepub unsafe fn debug_marker_begin(&mut self, name: &CStr, color: [f32; 4])
pub unsafe fn debug_marker_begin(&mut self, name: &CStr, color: [f32; 4])
sourcepub unsafe fn debug_marker_end(&mut self)
pub unsafe fn debug_marker_end(&mut self)
Calls vkCmdDebugMarkerEndEXT
on the builder.
Panics
Requires the VK_EXT_debug_marker
device extension to be loaded.
Safety
There must be an outstanding vkCmdDebugMarkerBeginEXT
command prior to the
vkCmdDebugMarkerEndEXT
on the queue that this command buffer is submitted to. If the
matching vkCmdDebugMarkerBeginEXT
command was in a secondary command buffer, the
vkCmdDebugMarkerEndEXT
must be in the same command buffer.
sourcepub unsafe fn debug_marker_insert(&mut self, name: &CStr, color: [f32; 4])
pub unsafe fn debug_marker_insert(&mut self, name: &CStr, color: [f32; 4])
Trait Implementations
sourceimpl<P> Debug for UnsafeCommandBufferBuilder<P>
impl<P> Debug for UnsafeCommandBufferBuilder<P>
sourceimpl<P> DeviceOwned for UnsafeCommandBufferBuilder<P>
impl<P> DeviceOwned for UnsafeCommandBufferBuilder<P>
sourceimpl<P> VulkanObject for UnsafeCommandBufferBuilder<P>
impl<P> VulkanObject for UnsafeCommandBufferBuilder<P>
sourceconst TYPE: DebugReportObjectTypeEXT = 6u32
const TYPE: DebugReportObjectTypeEXT = 6u32
DebugReportObjectTypeEXT
of the internal Vulkan handle.