Struct gfx::Encoder
[−]
[src]
pub struct Encoder<R: Resources, C: CommandBuffer<R>> { /* 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: CommandBuffer<R>> Encoder<R, C>
[src]
pub 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.
pub fn clone_empty(&self) -> Encoder<R, C>
[src]
Clone the renderer shared data but ignore the commands.
pub fn update_buffer<T: Copy>(
&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.
pub fn update_constant_buffer<T: Copy>(&mut self, buf: &Buffer<R, T>, data: &T)
[src]
Update a buffer with a single structure.
pub fn update_texture<S, T>(
&mut self,
tex: &Texture<R, T::Surface>,
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>,
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.
pub 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
.
pub 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.
pub 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.
pub 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.