Struct bgfx_rs::static_lib::Encoder
source · #[repr(C)]pub struct Encoder {}
Expand description
Encoders are used for submitting draw calls from multiple threads. Only one encoder
per thread should be used. Use bgfx::begin()
to obtain an encoder for a thread.
Implementations§
source§impl Encoder
impl Encoder
pub fn new() -> Encoder
sourcepub fn set_marker(&self, marker: *const i8)
pub fn set_marker(&self, marker: *const i8)
marker
: Marker string.
sourcepub fn set_state(&self, state: u64, rgba: u32)
pub fn set_state(&self, state: u64, rgba: u32)
state
: State flags. Default state for primitive type is triangles. See: StateFlags::DEFAULT.- StateDepthTestFlags - Depth test function.
- StateBlendFlags - See remark 1 about BGFX_STATE_BLEND_FUNC.
- StateBlendEquationFlags - See remark 2.
- StateCullFlags - Backface culling mode.
- StateWriteFlags - Enable R, G, B, A or Z write.
- StateFlags::MSAA - Enable hardware multisample antialiasing.
- [StatePtFlags::[TRISTRIP/LINES/POINTS]] - Primitive type.
rgba
: Sets blend factor used by StateBlendFlags::FACTOR and StateBlendFlags::INV_FACTOR blend modes.
sourcepub fn set_condition(&self, handle: &OcclusionQuery, visible: bool)
pub fn set_condition(&self, handle: &OcclusionQuery, visible: bool)
handle
: Occlusion query handle.visible
: Render if occlusion query is visible.
sourcepub fn set_stencil(&self, fstencil: u32, bstencil: u32)
pub fn set_stencil(&self, fstencil: u32, bstencil: u32)
fstencil
: Front stencil state.bstencil
: Back stencil state. If back is set to StencilFlags::NONE _fstencil is applied to both front and back facing primitives.
sourcepub fn set_scissor(&self, x: u16, y: u16, width: u16, height: u16) -> u16
pub fn set_scissor(&self, x: u16, y: u16, width: u16, height: u16) -> u16
x
: Position x from the left corner of the window.y
: Position y from the top corner of the window.width
: Width of view scissor region.height
: Height of view scissor region.
sourcepub fn set_scissor_cached(&self, cache: u16)
pub fn set_scissor_cached(&self, cache: u16)
cache
: Index in scissor cache.
sourcepub fn alloc_transform(&self, transform: &mut Transform, num: u16) -> u32
pub fn alloc_transform(&self, transform: &mut Transform, num: u16) -> u32
transform
: Pointer toTransform
structure.num
: Number of matrices.
sourcepub fn set_index_buffer(
&self,
handle: &IndexBuffer,
first_index: u32,
num_indices: u32
)
pub fn set_index_buffer( &self, handle: &IndexBuffer, first_index: u32, num_indices: u32 )
handle
: Index buffer.first_index
: First index to render.num_indices
: Number of indices to render.
sourcepub fn set_dynamic_index_buffer(
&self,
handle: &DynamicIndexBuffer,
first_index: u32,
num_indices: u32
)
pub fn set_dynamic_index_buffer( &self, handle: &DynamicIndexBuffer, first_index: u32, num_indices: u32 )
handle
: Dynamic index buffer.first_index
: First index to render.num_indices
: Number of indices to render.
sourcepub fn set_transient_index_buffer(
&self,
tib: &TransientIndexBuffer,
first_index: u32,
num_indices: u32
)
pub fn set_transient_index_buffer( &self, tib: &TransientIndexBuffer, first_index: u32, num_indices: u32 )
tib
: Transient index buffer.first_index
: First index to render.num_indices
: Number of indices to render.
sourcepub fn set_vertex_buffer(
&self,
stream: u8,
handle: &VertexBuffer,
start_vertex: u32,
num_vertices: u32
)
pub fn set_vertex_buffer( &self, stream: u8, handle: &VertexBuffer, start_vertex: u32, num_vertices: u32 )
stream
: Vertex stream.handle
: Vertex buffer.start_vertex
: First vertex to render.num_vertices
: Number of vertices to render.
sourcepub fn set_vertex_buffer_with_layout(
&self,
stream: u8,
handle: &VertexBuffer,
start_vertex: u32,
num_vertices: u32,
layout_handle: &VertexLayout
)
pub fn set_vertex_buffer_with_layout( &self, stream: u8, handle: &VertexBuffer, start_vertex: u32, num_vertices: u32, layout_handle: &VertexLayout )
stream
: Vertex stream.handle
: Vertex buffer.start_vertex
: First vertex to render.num_vertices
: Number of vertices to render.layout_handle
: Vertex layout for aliasing vertex buffer. If invalid handle is used, vertex layout used for creation of vertex buffer will be used.
sourcepub fn set_dynamic_vertex_buffer(
&self,
stream: u8,
handle: &DynamicVertexBuffer,
start_vertex: u32,
num_vertices: u32
)
pub fn set_dynamic_vertex_buffer( &self, stream: u8, handle: &DynamicVertexBuffer, start_vertex: u32, num_vertices: u32 )
stream
: Vertex stream.handle
: Dynamic vertex buffer.start_vertex
: First vertex to render.num_vertices
: Number of vertices to render. Vertex stream. Dynamic vertex buffer. First vertex to render. Number of vertices to render. Vertex layout for aliasing vertex buffer. If invalid handle is used, vertex layout used for creation of vertex buffer will be used.
sourcepub fn set_dynamic_vertex_buffer_with_layout(
&self,
stream: u8,
handle: &DynamicVertexBuffer,
start_vertex: u32,
num_vertices: u32,
layout_handle: &VertexLayout
)
pub fn set_dynamic_vertex_buffer_with_layout( &self, stream: u8, handle: &DynamicVertexBuffer, start_vertex: u32, num_vertices: u32, layout_handle: &VertexLayout )
stream
: Vertex stream.handle
: Dynamic vertex buffer.start_vertex
: First vertex to render.num_vertices
: Number of vertices to render.layout_handle
: Vertex layout for aliasing vertex buffer. If invalid handle is used, vertex layout used for creation of vertex buffer will be used.
sourcepub fn set_transient_vertex_buffer(
&self,
stream: u8,
tvb: &TransientVertexBuffer,
start_vertex: u32,
num_vertices: u32
)
pub fn set_transient_vertex_buffer( &self, stream: u8, tvb: &TransientVertexBuffer, start_vertex: u32, num_vertices: u32 )
stream
: Vertex stream.tvb
: Transient vertex buffer.start_vertex
: First vertex to render.num_vertices
: Number of vertices to render.
sourcepub fn set_transient_vertex_buffer_with_layout(
&self,
stream: u8,
tvb: &TransientVertexBuffer,
start_vertex: u32,
num_vertices: u32,
layout_handle: &VertexLayout
)
pub fn set_transient_vertex_buffer_with_layout( &self, stream: u8, tvb: &TransientVertexBuffer, start_vertex: u32, num_vertices: u32, layout_handle: &VertexLayout )
stream
: Vertex stream.tvb
: Transient vertex buffer.start_vertex
: First vertex to render.num_vertices
: Number of vertices to render.layout_handle
: Vertex layout for aliasing vertex buffer. If invalid handle is used, vertex layout used for creation of vertex buffer will be used.
sourcepub fn set_vertex_count(&self, num_vertices: u32)
pub fn set_vertex_count(&self, num_vertices: u32)
num_vertices
: Number of vertices.
sourcepub fn set_instance_data_buffer(
&self,
idb: &InstanceDataBuffer,
start: u32,
num: u32
)
pub fn set_instance_data_buffer( &self, idb: &InstanceDataBuffer, start: u32, num: u32 )
idb
: Transient instance data buffer.start
: First instance data.num
: Number of data instances.
sourcepub fn set_instance_data_from_vertex_buffer(
&self,
handle: &VertexBuffer,
start_vertex: u32,
num: u32
)
pub fn set_instance_data_from_vertex_buffer( &self, handle: &VertexBuffer, start_vertex: u32, num: u32 )
handle
: Vertex buffer.start_vertex
: First instance data.num
: Number of data instances. Set instance data buffer for draw primitive. Dynamic vertex buffer.
sourcepub fn set_instance_data_from_dynamic_vertex_buffer(
&self,
handle: &DynamicVertexBuffer,
start_vertex: u32,
num: u32
)
pub fn set_instance_data_from_dynamic_vertex_buffer( &self, handle: &DynamicVertexBuffer, start_vertex: u32, num: u32 )
handle
: Dynamic vertex buffer.start_vertex
: First instance data.num
: Number of data instances.
sourcepub fn set_instance_count(&self, num_instances: u32)
pub fn set_instance_count(&self, num_instances: u32)
num_instances
:
sourcepub fn set_texture(
&self,
stage: u8,
sampler: &Uniform,
handle: &Texture,
flags: u32
)
pub fn set_texture( &self, stage: u8, sampler: &Uniform, handle: &Texture, flags: u32 )
stage
: Texture unit.sampler
: Program sampler.handle
: Texture handle.flags
: Texture sampling mode. Default value UINT32_MAX uses texture sampling settings from the texture.- [SamplerFlags::[U/V/W]_[MIRROR/CLAMP]] - Mirror or clamp to edge wrap mode.
- [SamplerFlags::[MIN/MAG/MIP]_[POINT/ANISOTROPIC]] - Point or anisotropic sampling.
sourcepub fn submit(&self, id: ViewId, program: &Program, params: SubmitArgs)
pub fn submit(&self, id: ViewId, program: &Program, params: SubmitArgs)
id
: View id.program
: Program.depth
: Depth for sorting.flags
: Discard or preserve states. See DiscardFlags.
sourcepub fn submit_occlusion_query(
&self,
id: ViewId,
program: &Program,
occlusion_query: &OcclusionQuery,
params: SubmitOcclusionQueryArgs
)
pub fn submit_occlusion_query( &self, id: ViewId, program: &Program, occlusion_query: &OcclusionQuery, params: SubmitOcclusionQueryArgs )
id
: View id.program
: Program.occlusion_query
: Occlusion query.depth
: Depth for sorting.flags
: Discard or preserve states. See DiscardFlags.
sourcepub fn submit_indirect(
&self,
id: ViewId,
program: &Program,
indirect_handle: &IndirectBuffer,
params: SubmitIndirectArgs
)
pub fn submit_indirect( &self, id: ViewId, program: &Program, indirect_handle: &IndirectBuffer, params: SubmitIndirectArgs )
id
: View id.program
: Program.indirect_handle
: Indirect buffer.start
: First element in indirect buffer.num
: Number of draws.depth
: Depth for sorting.flags
: Discard or preserve states. See DiscardFlags.
sourcepub fn submit_indirect_count(
&self,
id: ViewId,
program: &Program,
indirect_handle: &IndirectBuffer,
start: u16,
num_handle: &IndexBuffer,
params: SubmitIndirectCountArgs
)
pub fn submit_indirect_count( &self, id: ViewId, program: &Program, indirect_handle: &IndirectBuffer, start: u16, num_handle: &IndexBuffer, params: SubmitIndirectCountArgs )
id
: View id.program
: Program.indirect_handle
: Indirect buffer.start
: First element in indirect buffer.num_handle
: Buffer for number of draws. Must be created with [BufferFlags::INDEX32] and BufferFlags::DRAW_INDIRECT.num_index
: Element in number buffer.num_max
: Max number of draws.depth
: Depth for sorting.flags
: Discard or preserve states. See DiscardFlags.
sourcepub fn set_compute_index_buffer(
&self,
stage: u8,
handle: &IndexBuffer,
access: Access
)
pub fn set_compute_index_buffer( &self, stage: u8, handle: &IndexBuffer, access: Access )
stage
: Compute stage.handle
: Index buffer handle.access
: Buffer access. See Access.
sourcepub fn set_compute_vertex_buffer(
&self,
stage: u8,
handle: &VertexBuffer,
access: Access
)
pub fn set_compute_vertex_buffer( &self, stage: u8, handle: &VertexBuffer, access: Access )
stage
: Compute stage.handle
: Vertex buffer handle.access
: Buffer access. See Access.
sourcepub fn set_compute_dynamic_index_buffer(
&self,
stage: u8,
handle: &DynamicIndexBuffer,
access: Access
)
pub fn set_compute_dynamic_index_buffer( &self, stage: u8, handle: &DynamicIndexBuffer, access: Access )
stage
: Compute stage.handle
: Dynamic index buffer handle.access
: Buffer access. See Access.
sourcepub fn set_compute_dynamic_vertex_buffer(
&self,
stage: u8,
handle: &DynamicVertexBuffer,
access: Access
)
pub fn set_compute_dynamic_vertex_buffer( &self, stage: u8, handle: &DynamicVertexBuffer, access: Access )
stage
: Compute stage.handle
: Dynamic vertex buffer handle.access
: Buffer access. See Access.
sourcepub fn set_compute_indirect_buffer(
&self,
stage: u8,
handle: &IndirectBuffer,
access: Access
)
pub fn set_compute_indirect_buffer( &self, stage: u8, handle: &IndirectBuffer, access: Access )
stage
: Compute stage.handle
: Indirect buffer handle.access
: Buffer access. See Access.
sourcepub fn set_image(
&self,
stage: u8,
handle: &Texture,
mip: u8,
access: Access,
format: TextureFormat
)
pub fn set_image( &self, stage: u8, handle: &Texture, mip: u8, access: Access, format: TextureFormat )
stage
: Compute stage.handle
: Texture handle.mip
: Mip level.access
: Image access. See Access.format
: Texture format. See: TextureFormat.
sourcepub fn dispatch(&self, id: ViewId, program: &Program, params: DispatchArgs)
pub fn dispatch(&self, id: ViewId, program: &Program, params: DispatchArgs)
id
: View id.program
: Compute program.num_x
: Number of groups X.num_y
: Number of groups Y.num_z
: Number of groups Z.flags
: Discard or preserve states. See DiscardFlags.
sourcepub fn dispatch_indirect(
&self,
id: ViewId,
program: &Program,
indirect_handle: &IndirectBuffer,
params: DispatchIndirectArgs
)
pub fn dispatch_indirect( &self, id: ViewId, program: &Program, indirect_handle: &IndirectBuffer, params: DispatchIndirectArgs )
id
: View id.program
: Compute program.indirect_handle
: Indirect buffer.start
: First element in indirect buffer.num
: Number of dispatches.flags
: Discard or preserve states. See DiscardFlags.
sourcepub fn discard(&self, flags: u8)
pub fn discard(&self, flags: u8)
flags
: Discard or preserve states. See DiscardFlags.
sourcepub fn blit(
&self,
id: ViewId,
dst: &Texture,
dst_mip: u8,
dst_x: u16,
dst_y: u16,
dst_z: u16,
src: &Texture,
params: BlitArgs
)
pub fn blit( &self, id: ViewId, dst: &Texture, dst_mip: u8, dst_x: u16, dst_y: u16, dst_z: u16, src: &Texture, params: BlitArgs )
id
: View id.dst
: Destination texture handle.dst_mip
: Destination texture mip level.dst_x
: Destination texture X position.dst_y
: Destination texture Y position.dst_z
: If texture is 2D this argument should be 0. If destination texture is cube this argument represents destination texture cube face. For 3D texture this argument represents destination texture Z position.src
: Source texture handle.src_mip
: Source texture mip level.src_x
: Source texture X position.src_y
: Source texture Y position.src_z
: If texture is 2D this argument should be 0. If source texture is cube this argument represents source texture cube face. For 3D texture this argument represents source texture Z position.width
: Width of region.height
: Height of region.depth
: If texture is 3D this argument represents depth of region, otherwise it’s unused.
Auto Trait Implementations§
impl Freeze for Encoder
impl RefUnwindSafe for Encoder
impl Send for Encoder
impl Sync for Encoder
impl Unpin for Encoder
impl UnwindSafe for Encoder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more