Trait rafx::render_features::RenderFeatureWriteJob
source · pub trait RenderFeatureWriteJob<'write>: Sync + Send {
// Required methods
fn render_submit_node(
&self,
_write_context: &mut RenderJobCommandBufferContext<'_, '_>,
args: RenderSubmitNodeArgs
) -> Result<(), RafxError>;
fn feature_debug_constants(&self) -> &'static RenderFeatureDebugConstants;
fn feature_index(&self) -> u32;
// Provided methods
fn on_begin_execute_graph(
&self,
_begin_execute_graph_context: &mut RenderJobBeginExecuteGraphContext
) -> Result<(), RafxError> { ... }
fn begin_submit_node_batch(
&self,
_write_context: &mut RenderJobCommandBufferContext<'_, '_>,
_args: BeginSubmitNodeBatchArgs
) -> Result<(), RafxError> { ... }
}
Expand description
A type-erased trait used by the Renderer
, RenderFrameJob
, and RendererThreadPool
to control the workload of the rendering process without identifying specific types
used in each RenderFeature
’s frame packet or workload.
Required Methods§
sourcefn render_submit_node(
&self,
_write_context: &mut RenderJobCommandBufferContext<'_, '_>,
args: RenderSubmitNodeArgs
) -> Result<(), RafxError>
fn render_submit_node( &self, _write_context: &mut RenderJobCommandBufferContext<'_, '_>, args: RenderSubmitNodeArgs ) -> Result<(), RafxError>
Called by PreparedRenderData
in write_view_phase
for each RenderFeatureSubmitNode
associated
with this RenderFeature
. This is normally where the actual GPU draw commands are implemented for
the RenderFeature
. Each series of calls to render_submit_node
will be preceded by a single call to
begin_submit_node_batch
.
fn feature_debug_constants(&self) -> &'static RenderFeatureDebugConstants
fn feature_index(&self) -> u32
Provided Methods§
sourcefn on_begin_execute_graph(
&self,
_begin_execute_graph_context: &mut RenderJobBeginExecuteGraphContext
) -> Result<(), RafxError>
fn on_begin_execute_graph( &self, _begin_execute_graph_context: &mut RenderJobBeginExecuteGraphContext ) -> Result<(), RafxError>
Called once at the start of executing the PreparedRenderData
in PreparedRenderGraph::execute_graph
.
This can be used to start GPU transfers or other work prior to drawing any submit nodes related to
this RenderFeature
.
sourcefn begin_submit_node_batch(
&self,
_write_context: &mut RenderJobCommandBufferContext<'_, '_>,
_args: BeginSubmitNodeBatchArgs
) -> Result<(), RafxError>
fn begin_submit_node_batch( &self, _write_context: &mut RenderJobCommandBufferContext<'_, '_>, _args: BeginSubmitNodeBatchArgs ) -> Result<(), RafxError>
Called by PreparedRenderData
in write_view_phase
whenever the current RenderFeatureIndex
changes into this RenderFeature
OR when the sort_key
changes. This can be used to
setup pipelines or other expensive state changes that can remain constant for subsequent
render_submit_node
calls.