Struct gfx::Encoder [−][src]
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
.
Implementations
impl<R: Resources, C: Buffer<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 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.
pub 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.
pub fn reset(&mut self)
[src]
Resets the encoded commands.
pub 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
pub 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
pub 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
pub 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
pub 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.
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>,
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.
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 clear_raw(&mut self, view: &RawRenderTargetView<R>, value: ClearColor)
[src]
Clears the supplied RawRenderTargetView
to the supplied ClearColor
.
pub fn clear_depth_raw(&mut self, view: &RawDepthStencilView<R>, depth: Depth)
[src]
Clear a raw depth view with a specified value.
pub fn clear_stencil_raw(
&mut self,
view: &RawDepthStencilView<R>,
stencil: Stencil
)
[src]
&mut self,
view: &RawDepthStencilView<R>,
stencil: Stencil
)
Clear a raw 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.
pub fn generate_mipmap<T: BlendFormat>(
&mut self,
view: &ShaderResourceView<R, T>
)
[src]
&mut self,
view: &ShaderResourceView<R, T>
)
Generate a mipmap chain for the given resource view.
pub fn generate_mipmap_raw(&mut self, view: &RawShaderResourceView<R>)
[src]
Untyped version of mipmap generation.
Trait Implementations
impl<R: Debug + Resources, C: Debug> Debug for Encoder<R, C>
[src]
impl<R: Resources, C> From<C> for Encoder<R, C>
[src]
Auto Trait Implementations
impl<R, C> !RefUnwindSafe for Encoder<R, C>
impl<R, C> Send for Encoder<R, C> where
C: Send,
C: Send,
impl<R, C> Sync for Encoder<R, C> where
C: Sync,
C: Sync,
impl<R, C> Unpin for Encoder<R, C> where
C: Unpin,
<R as Resources>::Buffer: Unpin,
<R as Resources>::DepthStencilView: Unpin,
<R as Resources>::RenderTargetView: Unpin,
<R as Resources>::Sampler: Unpin,
<R as Resources>::ShaderResourceView: Unpin,
<R as Resources>::UnorderedAccessView: Unpin,
C: Unpin,
<R as Resources>::Buffer: Unpin,
<R as Resources>::DepthStencilView: Unpin,
<R as Resources>::RenderTargetView: Unpin,
<R as Resources>::Sampler: Unpin,
<R as Resources>::ShaderResourceView: Unpin,
<R as Resources>::UnorderedAccessView: Unpin,
impl<R, C> !UnwindSafe for Encoder<R, C>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<!> for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,