Encoder

Struct Encoder 

Source
pub struct Encoder<'a> { /* private fields */ }
Expand description

Command encoder that can encode commands outside render pass.

Implementations§

Source§

impl<'a> Encoder<'a>

Source

pub fn discard(self)

Source§

impl<'a> Encoder<'a>

Source

pub fn with_framebuffer( &mut self, framebuffer: &'a Framebuffer, clears: &[ClearValue], ) -> RenderPassEncoder<'_, 'a>

Begins render pass and returns RenderPassEncoder to encode commands of the render pass. RenderPassEncoder borrows Encoder. To continue use this Encoder returned RenderPassEncoder must be dropped which implicitly ends render pass.

framebuffer - a framebuffer (set of attachments) for render pass to use. clears - an array of clear values. render pass will clear attachments with load_op == LoadOp::Clear using those values. They will be used in order.

Source

pub fn with_render_pass<R, I>( &mut self, render_pass: &'a mut R, input: &I, device: &Device, ) -> Result<RenderPassEncoder<'_, 'a>, FramebufferError>
where R: RenderPassInstance<Input = I>,

Begins render pass and returns RenderPassEncoder to encode commands of the render pass. RenderPassEncoder borrows Encoder. To continue use this Encoder returned RenderPassEncoder must be dropped which implicitly ends render pass.

pass - render pass to encode. framebuffer - a framebuffer (set of attachments) for render pass to use. clears - an array of clear values. render pass will clear attachments with load_op == LoadOp::Clear using those values. They will be used in order.

Source

pub fn begin_rendering( &mut self, info: RenderingInfo<'_>, ) -> RenderingEncoder<'_, 'a>

Begins rendering

Source

pub fn update_buffer<T>(&mut self, buffer: &Buffer, offset: u64, data: &[T])
where T: Pod,

Updates a buffer’s contents from host memory

Source

pub fn upload_buffer<T>( &mut self, buffer: &'a Buffer, offset: u64, data: &'a [T], device: &Device, ) -> Result<(), OutOfMemory>
where T: Pod,

Uploads data to the buffer. May create intermediate staging buffer if necessary.

Source

pub fn upload_buffer_cached<T, S>( &mut self, buffer: &'a Buffer, offset: u64, data: &'a [T], device: &Device, staging: &mut S, ) -> Result<(), OutOfMemory>
where T: Pod, S: AsMut<[Buffer]> + Extend<Buffer>,

Uploads data to the buffer. Uses cached staging buffers and may create new if necessary.

Source

pub fn build_acceleration_structure( &mut self, infos: &[AccelerationStructureBuildGeometryInfo<'_>], )

Builds acceleration structures.

Source

pub fn trace_rays( &mut self, shader_binding_table: &'a ShaderBindingTable, extent: Extent3, )

Source

pub fn copy_buffer( &mut self, src_buffer: &Buffer, dst_buffer: &Buffer, regions: &[BufferCopy], )

Source

pub fn copy_image( &mut self, src_image: &Image, src_layout: Layout, dst_image: &Image, dst_layout: Layout, regions: &[ImageCopy], )

Source

pub fn copy_buffer_to_image( &mut self, src_buffer: &Buffer, dst_image: &Image, dst_layout: Layout, regions: &[BufferImageCopy], )

Source

pub fn blit_image( &mut self, src_image: &Image, src_layout: Layout, dst_image: &Image, dst_layout: Layout, regions: &[ImageBlit], filter: Filter, )

Source

pub fn dispatch(&mut self, x: u32, y: u32, z: u32)

Source

pub fn memory_barrier( &mut self, src: PipelineStages, src_acc: Access, dst: PipelineStages, dst_acc: Access, )

Source

pub fn image_barriers( &mut self, src: PipelineStages, dst: PipelineStages, images: &[ImageMemoryBarrier<'_>], )

Source

pub fn buffer_barriers( &mut self, src: PipelineStages, dst: PipelineStages, buffers: &[BufferMemoryBarrier<'_>], )

Source

pub fn finish(self) -> CommandBuffer

Flushes commands recorded into this encoder to the underlying command buffer.

Methods from Deref<Target = EncoderCommon<'a>>§

Source

pub fn scope(&self) -> &'a Scope<'a>

Source

pub fn set_viewport(&mut self, viewport: Viewport)

Source

pub fn set_scissor(&mut self, scissor: Rect)

Source

pub fn bind_graphics_pipeline(&mut self, pipeline: &GraphicsPipeline)

Source

pub fn bind_compute_pipeline(&mut self, pipeline: &ComputePipeline)

Source

pub fn bind_ray_tracing_pipeline(&mut self, pipeline: &RayTracingPipeline)

Source

pub fn bind_vertex_buffers(&mut self, first: u32, buffers: &[(&Buffer, u64)])

Source

pub fn bind_index_buffer( &mut self, buffer: &Buffer, offset: u64, index_type: IndexType, )

Source

pub fn bind_graphics_descriptor_sets( &mut self, layout: &PipelineLayout, first_set: u32, sets: &[&DescriptorSet], dynamic_offsets: &[u32], )

Source

pub fn bind_graphics_descriptors<P, const N: u32>( &mut self, layout: &P, descriptors: &impl UpdatedPipelineDescriptors<P, N>, )

Source

pub fn bind_compute_descriptor_sets( &mut self, layout: &PipelineLayout, first_set: u32, sets: &[&DescriptorSet], dynamic_offsets: &[u32], )

Source

pub fn bind_compute_descriptors<P, const N: u32>( &mut self, layout: &P, descriptors: &impl UpdatedPipelineDescriptors<P, N>, )

Source

pub fn bind_ray_tracing_descriptor_sets( &mut self, layout: &PipelineLayout, first_set: u32, sets: &[&DescriptorSet], dynamic_offsets: &[u32], )

Source

pub fn bind_ray_tracing_descriptors<P, const N: u32>( &mut self, layout: &P, descriptors: &impl UpdatedPipelineDescriptors<P, N>, )

Source

pub fn push_constants_pod<T>( &mut self, layout: &PipelineLayout, stages: ShaderStageFlags, offset: u32, data: &[T], )
where T: Pod,

Source

pub fn push_constants<P>( &mut self, layout: &P, constants: &impl PipelinePushConstants<P>, )

Trait Implementations§

Source§

impl<'a> Debug for Encoder<'a>

Source§

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

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

impl<'a> Deref for Encoder<'a>

Source§

type Target = EncoderCommon<'a>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &EncoderCommon<'a>

Dereferences the value.
Source§

impl<'a> DerefMut for Encoder<'a>

Source§

fn deref_mut(&mut self) -> &mut EncoderCommon<'a>

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'a> Freeze for Encoder<'a>

§

impl<'a> !RefUnwindSafe for Encoder<'a>

§

impl<'a> !Send for Encoder<'a>

§

impl<'a> !Sync for Encoder<'a>

§

impl<'a> Unpin for Encoder<'a>

§

impl<'a> !UnwindSafe for Encoder<'a>

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<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<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.