pub trait RenderFeatureWriteJob<'write>: Sync + Send {
// Required methods
fn render_submit_node(
&self,
_write_context: &mut RenderJobCommandBufferContext<'_, '_>,
args: RenderSubmitNodeArgs
) -> RafxResult<()>;
fn feature_debug_constants(&self) -> &'static RenderFeatureDebugConstants;
fn feature_index(&self) -> RenderFeatureIndex;
// Provided methods
fn on_begin_execute_graph(
&self,
_begin_execute_graph_context: &mut RenderJobBeginExecuteGraphContext
) -> RafxResult<()> { ... }
fn begin_submit_node_batch(
&self,
_write_context: &mut RenderJobCommandBufferContext<'_, '_>,
_args: BeginSubmitNodeBatchArgs
) -> RafxResult<()> { ... }
}
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
) -> RafxResult<()>
fn render_submit_node( &self, _write_context: &mut RenderJobCommandBufferContext<'_, '_>, args: RenderSubmitNodeArgs ) -> RafxResult<()>
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) -> RenderFeatureIndex
Provided Methods§
sourcefn on_begin_execute_graph(
&self,
_begin_execute_graph_context: &mut RenderJobBeginExecuteGraphContext
) -> RafxResult<()>
fn on_begin_execute_graph( &self, _begin_execute_graph_context: &mut RenderJobBeginExecuteGraphContext ) -> RafxResult<()>
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
) -> RafxResult<()>
fn begin_submit_node_batch( &self, _write_context: &mut RenderJobCommandBufferContext<'_, '_>, _args: BeginSubmitNodeBatchArgs ) -> RafxResult<()>
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.