Struct gfx::Encoder
[−]
[src]
pub struct Encoder<R: Resources, C> { /* fields omitted */ }
Graphics Command Encoder
Overview
The Encoder
is a wrapper structure around a CommandBuffer
. It is responsible for sending
commands to the CommandBuffer
.
Construction & Handling
The Encoder
implements From<CommandBuffer>
, which is how it is constructed. There is no
cross-API way to create a CommandBuffer
, however, an API back-end should expose a function to
create one in its Factory
type. See the specific back-end for details on how to construct a
CommandBuffer
.
The encoder exposes multiple functions that add commands to its internal CommandBuffer
. To
submit these commands to the GPU so they can be rendered, call flush
.
Methods
impl<R: Resources, C: Buffer<R>> Encoder<R, C>
[src]
fn flush<D>(&mut self, device: &mut D) where
D: Device<Resources = R, CommandBuffer = C>,
[src]
D: Device<Resources = R, CommandBuffer = C>,
Submits the commands in this Encoder
's internal CommandBuffer
to the GPU, so they can
be executed.
Calling flush
before swapping buffers is critical as without it the commands of the
internal ´CommandBuffer´ will not be sent to the GPU, and as a result they will not be
processed. Calling flush too often however will result in a performance hit. It is
generally recommended to call flush once per frame, when all draw calls have been made.
fn flush_no_reset<D>(&mut self, device: &mut D) -> SubmissionResult<()> where
D: Device<Resources = R, CommandBuffer = C>,
[src]
D: Device<Resources = R, CommandBuffer = C>,
Like flush
but keeps the encoded commands.
fn fenced_flush_no_reset<D>(
&mut self,
device: &mut D,
after: Option<Fence<R>>
) -> SubmissionResult<Fence<R>> where
D: Device<Resources = R, CommandBuffer = C>,
[src]
&mut self,
device: &mut D,
after: Option<Fence<R>>
) -> SubmissionResult<Fence<R>> where
D: Device<Resources = R, CommandBuffer = C>,
Like flush_no_reset
but places a fence.
fn reset(&mut self)
[src]
Resets the encoded commands.
fn copy_buffer<T: Pod>(
&mut self,
src: &Buffer<R, T>,
dst: &Buffer<R, T>,
src_offset: usize,
dst_offset: usize,
size: usize
) -> CopyBufferResult
[src]
&mut self,
src: &Buffer<R, T>,
dst: &Buffer<R, T>,
src_offset: usize,
dst_offset: usize,
size: usize
) -> CopyBufferResult
Copy part of a buffer to another
fn copy_buffer_to_texture_raw(
&mut self,
src: &RawBuffer<R>,
src_offset_bytes: usize,
dst: &RawTexture<R>,
cube_face: Option<CubeFace>,
info: RawImageInfo
) -> CopyBufferTextureResult
[src]
&mut self,
src: &RawBuffer<R>,
src_offset_bytes: usize,
dst: &RawTexture<R>,
cube_face: Option<CubeFace>,
info: RawImageInfo
) -> CopyBufferTextureResult
Copy part of a buffer to a texture
fn copy_texture_to_buffer_raw(
&mut self,
src: &RawTexture<R>,
cube_face: Option<CubeFace>,
info: RawImageInfo,
dst: &RawBuffer<R>,
dst_offset_bytes: usize
) -> CopyTextureBufferResult
[src]
&mut self,
src: &RawTexture<R>,
cube_face: Option<CubeFace>,
info: RawImageInfo,
dst: &RawBuffer<R>,
dst_offset_bytes: usize
) -> CopyTextureBufferResult
Copy part of a texture to a buffer
fn copy_texture_to_texture_raw(
&mut self,
src: &RawTexture<R>,
src_face: Option<CubeFace>,
src_info: RawImageInfo,
dst: &RawTexture<R>,
dst_face: Option<CubeFace>,
dst_info: RawImageInfo
) -> Result<(), CopyError<[Size; 3], [Size; 3]>>
[src]
&mut self,
src: &RawTexture<R>,
src_face: Option<CubeFace>,
src_info: RawImageInfo,
dst: &RawTexture<R>,
dst_face: Option<CubeFace>,
dst_info: RawImageInfo
) -> Result<(), CopyError<[Size; 3], [Size; 3]>>
Copy part of a texture to another texture
fn update_buffer<T: Pod>(
&mut self,
buf: &Buffer<R, T>,
data: &[T],
offset_elements: usize
) -> Result<(), UpdateError<usize>>
[src]
&mut self,
buf: &Buffer<R, T>,
data: &[T],
offset_elements: usize
) -> Result<(), UpdateError<usize>>
Update a buffer with a slice of data.
fn update_constant_buffer<T: Copy>(&mut self, buf: &Buffer<R, T>, data: &T)
[src]
Update a buffer with a single structure.
fn update_texture<S, T>(
&mut self,
tex: &Texture<R, T::Surface>,
cube_face: Option<CubeFace>,
img: NewImageInfo,
data: &[S::DataType]
) -> Result<(), UpdateError<[Size; 3]>> where
S: SurfaceTyped,
S::DataType: Copy,
T: Formatted<Surface = S>,
[src]
&mut self,
tex: &Texture<R, T::Surface>,
cube_face: Option<CubeFace>,
img: NewImageInfo,
data: &[S::DataType]
) -> Result<(), UpdateError<[Size; 3]>> where
S: SurfaceTyped,
S::DataType: Copy,
T: Formatted<Surface = S>,
Update the contents of a texture.
fn clear<T: RenderFormat>(
&mut self,
view: &RenderTargetView<R, T>,
value: T::View
) where
T::View: Into<ClearColor>,
[src]
&mut self,
view: &RenderTargetView<R, T>,
value: T::View
) where
T::View: Into<ClearColor>,
Clears the supplied RenderTargetView
to the supplied ClearColor
.
fn clear_depth<T: DepthFormat>(
&mut self,
view: &DepthStencilView<R, T>,
depth: Depth
)
[src]
&mut self,
view: &DepthStencilView<R, T>,
depth: Depth
)
Clear a depth view with a specified value.
fn clear_stencil<T: StencilFormat>(
&mut self,
view: &DepthStencilView<R, T>,
stencil: Stencil
)
[src]
&mut self,
view: &DepthStencilView<R, T>,
stencil: Stencil
)
Clear a stencil view with a specified value.
fn draw<D: PipelineData<R>>(
&mut self,
slice: &Slice<R>,
pipeline: &PipelineState<R, D::Meta>,
user_data: &D
)
[src]
&mut self,
slice: &Slice<R>,
pipeline: &PipelineState<R, D::Meta>,
user_data: &D
)
Draws a slice::Slice
using a pipeline state object, and its matching Data
structure.
fn generate_mipmap<T: BlendFormat>(&mut self, view: &ShaderResourceView<R, T>)
[src]
Generate a mipmap chain for the given resource view.
fn generate_mipmap_raw(&mut self, view: &RawShaderResourceView<R>)
[src]
Untyped version of mipmap generation.