Expand description
Part of rafx-framework
. Handles extracting, preparing, and writing draw calls
Modules§
Structs§
- Begin
Submit Node Batch Args - Default
JobContext - A
JobContext
is definable by eachRenderFeature
. It is used to bundle any expensive work, like acquiring locks or other resources, into fewer call-sites for any work occurring on the same thread. TheJobContext
will not be shared between threads. UseDefaultJobContext
if theRenderFeature
does not need to acquire resources. - Extract
Job - An
ExtractJob
implements theRenderFeatureExtractJob
trait by wrapping an instance of anExtractJobEntryPoints
type defined at compile-time. TheExtractJob
contains the frame packet and presents the correct context (likeExtractPerFrameContext
) to each entry point defined inExtractJobEntryPoints
. - Extract
PerFrame Context - Extract
PerView Context - Extract
Render Object Instance Context - Extract
Render Object Instance PerView Context - Frame
Packet - Read documentation on
FramePacketData
. - Frame
Packet Metadata - Frame
Packet Size - Prepare
Job - A
PrepareJob
implements theRenderFeaturePrepareJob
trait by wrapping an instance of anPrepareJobEntryPoints
type defined at compile-time. ThePrepareJob
contains the frame & submit packets and presents the correct context (likePreparePerFrameContext
) to each entry point defined inRenderFeaturePrepareJob
. - Prepare
PerFrame Context - Prepare
PerView Context - Prepare
Render Object Instance Context - Prepare
Render Object Instance PerView Context - Prepared
Render Data - The sorted
SubmitNode
s for eachRenderView
andRenderPhase
with all relevantRenderFeature
’sRenderFeatureWriteJob
s. - Render
Feature Debug Constants - Render
Feature Flag Mask - Render
Feature Flag Mask Builder - Render
Feature Mask - Render
Feature Mask Builder - Render
Feature Submit Node - A type-erased struct representing some
RenderFeature
’sSubmitNode
. ThePreparedRenderData
will iterate through the sorted slice ofRenderFeatureSubmitNode
in aViewPhaseSubmitNodeBlock
and call the functions on theRenderFeatureWriteJob
specified by theRenderFeatureIndex
. - Render
JobBegin Execute Graph Context - Render
JobCommand Buffer Context - Render
JobExtract Allocation Context - Render
JobExtract Context - Holds references to resources valid for the entirety of the
extract
step as represented by the'extract
lifetime.RenderFeatureExtractJob
s should cache any resources needed from theRenderJobExtractContext
during theirnew
function. - Render
JobPrepare Context - Holds references to resources valid for the entirety of the
prepare
step as represented by the'prepare
lifetime.RenderFeaturePrepareJob
s should cache any resources needed from theRenderJobPrepareContext
during theirnew
function. - Render
JobWrite Context - Holds references to resources valid for the entirety of the
write
step as represented by the'write
lifetime.RenderFeatureWriteJob
s should cache any resources needed from theRenderJobWriteContext
during theirnew
function. - Render
Object Handle - A reference to a
RenderObject
with a reference-counted pointer. When the last instance of aRenderObjectHandle
is dropped, the referencedRenderObject
will be freed from theRenderObjectSet
. This is returned byregister_render_object
on theRenderObjectSet
and may be used to query or mutate theRenderObject
with theget
orget_mut
methods. - Render
Object Id - A weak
RenderObjectHandle
. This is a reference to aRenderObject
that is not used in reference-counting by theRenderObjectSet
. Create aRenderObjectId
with theas_id()
method on aRenderObjectHandle
. TheRenderObject
can be queried with theget_id
method on theRenderObjectSet
. - Render
Object Instance - A specific
Entity
andRenderObject
represented by theObjectId
andRenderObjectId
. ARenderObject
is associated with a particularRenderFeature
by theRenderFeatureIndex
. TheFramePacket
only contains uniqueRenderObjectInstance
s. - Render
Object Instance PerView - A specific
RenderObjectInstance
as viewed by someRenderView
. - Render
Object Set - Render
Objects JobContext - Use
RenderObjectsJobContext
if theRenderFeature
only needs to lock aRenderObjectsMap
. - Render
Phase Mask - Render
Phase Mask Builder - Render
Registry - Render
Registry Builder - Render
Submit Node Args - Render
View - The
Renderer
processesRenderView
s during the execution of theRenderGraph
. EachRenderView
is associated with a specificViewFrustum
in the game world. TheRenderView
may be registered for specificRenderFeature
s by aRenderFeatureMask
orRenderPhase
s by theRenderPhaseMask
. If aRenderView
is not registered for aRenderFeature
orRenderPhase
then it will not be processed by that feature or phase. - Render
View Depth Range - Render
View Set - Render
View Visibility Query - The
RenderObject
s visible to a specificRenderView
for the current frame. EachRenderObject
is represented by aRenderViewObject
with theObjectId
returned by theVisibilityObject
and aRenderObjectId
. If aVisibilityObject
has multipleRenderObject
s associated with it, the results will be returned as 0 or moreRenderViewObject
s. The visibleRenderObject
s will only containRenderObject
s associated with aRenderFeature
included by theRenderView
’sRenderFeatureMask
. - Submit
Node - Each
SubmitNode
contains the data needed for theRenderFeature
’sRenderFeatureWriteJob
to render a draw call by referencing data in the frame packet, submit packet, render objects set, or some other storage.SubmitNode
s will be sorted by theRenderPhase
after they are combined into aViewPhaseSubmitNodeBlock
. - Submit
Node Block - The
SubmitNodeBlock
is a collection ofSubmitNode
associated with a particularRenderFeature
,RenderView
, andRenderPhase
. There should be a 1:1 mapping betweenSubmitNode
s and draw calls from theRenderFeature
’sWriteJob
. TheRenderer
will combine allSubmitNodeBlock
s sharing the sameRenderView
andRenderPhase
into a sortedViewPhaseSubmitNodeBlock
. - Submit
Packet - Read documentation on
SubmitPacketData
. - View
Packet - Read documentation on
FramePacketData
. - View
Packet Size - View
Phase - A combination of a particular
RenderView
andRenderPhase
. TheViewPhaseSubmitNodeBlock
s in thePreparedRenderData
are indexed by theViewPhase
. - View
Phase Submit Node Block - The
ViewPhaseSubmitNodeBlock
is a collection ofRenderFeatureSubmitNode
associated with a particularRenderView
, andRenderPhase
. In other words, theViewPhaseSubmitNodeBlock
is the combination of all the feature-specificRenderFeatureSubmitNodeBlock
s with the sameRenderView
andRenderPhase
. - View
Submit Packet - Read documentation on
SubmitPacketData
. - View
Visibility Job - Determines the visible
RenderObject
s in a givenRenderView
and returns the results in theRenderViewVisibilityQuery
. It is thread-safe to callquery_visibility
on multipleRenderView
s simultaneously.
Constants§
Traits§
- Extract
JobEntry Points ExtractJobEntryPoints
provides a generic set of callbacks for aRenderFeature
compatible with theExtractJob
struct. This simplifies the work of implementing theRenderFeatureExtractJob
trait.- Frame
Packet Data - The
FramePacket
is the data that must be extracted from either theAssetManager
or the game’sWorld
during theExtract
step. After theExtract
step has finished, there is no more access allowed to either theAssetManager
or the game’sWorld
. TheFramePacket
must be considered immutable after theExtract
step has finished. - Prepare
JobEntry Points PrepareJobEntryPoints
provides a generic set of callbacks for aRenderFeature
compatible with thePrepareJob
struct. This simplifies the work of implementing theRenderFeaturePrepareJob
trait.- Render
Feature - Render
Feature Extract Job - A type-erased trait used by the
Renderer
,RenderFrameJob
, andRendererThreadPool
to control the workload of the rendering process without identifying specific types used in eachRenderFeature
’s frame packet or workload. SeeExtractJob
and theExtractJobEntryPoints
for implementation details. - Render
Feature Flag - Render
Feature Frame Packet - A type-erased trait used by the
Renderer
,RenderFrameJob
, andRendererThreadPool
to control the workload of the rendering process without identifying specific types used in eachRenderFeature
’s frame packet or workload. SeeFramePacket
andViewPacket
for implementation details. - Render
Feature Frame Packet AsConcrete - Provides
as_concrete
method to downcast as a concrete type. - Render
Feature Frame Packet Into Concrete - Provides
into_concrete
method to downcast into a concrete type. - Render
Feature Prepare Job - A type-erased trait used by the
Renderer
,RenderFrameJob
, andRendererThreadPool
to control the workload of the rendering process without identifying specific types used in eachRenderFeature
’s frame packet or workload. SeePrepareJob
and thePrepareJobEntryPoints
for implementation details. - Render
Feature Submit Node Block - A type-erased trait used by the
Renderer
,RenderFrameJob
, andRendererThreadPool
to control the workload of the rendering process without identifying specific types used in eachRenderFeature
’s frame packet or workload. SeeSubmitNodeBlock
for implementation details. - Render
Feature Submit Packet - A type-erased trait used by the
Renderer
,RenderFrameJob
, andRendererThreadPool
to control the workload of the rendering process without identifying specific types used in eachRenderFeature
’s frame packet or workload. SeeSubmitPacket
andViewSubmitPacket
for implementation details. - Render
Feature Submit Packet AsConcrete - Provides
as_concrete
method to downcast as a concrete type. - Render
Feature Submit Packet Into Concrete - Provides
into_concrete
method to downcast into a concrete type. - Render
Feature View Packet - A type-erased trait used by the
Renderer
,RenderFrameJob
, andRendererThreadPool
to control the workload of the rendering process without identifying specific types used in eachRenderFeature
’s frame packet or workload. SeeViewPacket
for implementation details. - Render
Feature View Packet AsConcrete - Provides
as_concrete
method to downcast as a concrete type. - Render
Feature View Packet Into Concrete - Provides
into_concrete
method to downcast into a concrete type. - Render
Feature View Submit Packet - A type-erased trait used by the
Renderer
,RenderFrameJob
, andRendererThreadPool
to control the workload of the rendering process without identifying specific types used in eachRenderFeature
’s frame packet or workload. SeeViewSubmitPacket
for implementation details. - Render
Feature View Submit Packet AsConcrete - Provides
as_concrete
method to downcast as a concrete type. - Render
Feature View Submit Packet Into Concrete - Provides
into_concrete
method to downcast into a concrete type. - Render
Feature Write Job - A type-erased trait used by the
Renderer
,RenderFrameJob
, andRendererThreadPool
to control the workload of the rendering process without identifying specific types used in eachRenderFeature
’s frame packet or workload. - Render
Phase - Submit
Packet Data - The
SubmitPacket
is the data that must be prepared from in order for theRenderFeature
’sWriteJob
to create each draw call. The draw calls may reference data in either theFramePacket
or theSubmitPacket
. Each draw call is represented by exactly 1SubmitNode
. In order to allocate theSubmitPacket
, theRenderFeature
is given a reference to the populatedFramePacket
from that frame. TheRenderFeature
must size theSubmitPacket
appropriately. TheSubmitPacket
must be considered immutable after thePrepare
step has finished.
Type Aliases§
- Extract
Resources - Render
Feature Flag Index - The
ID
of a registeredRenderFeatureFlag
. - Render
Feature Index - The
ID
of a registeredRenderFeature
. - Render
Object Count - Render
Object Instance Id - The
ID
of aRenderObjectInstance
in a specificFramePacket
for the current frame. - Render
Object Instance Object Ids - Render
Object Instance PerView Id - The
ID
of aRenderObjectInstance
in a specificViewPacket
for the current frame. - Render
Objects Map - Render
Phase Index - The
ID
of a registeredRenderPhase
. - Render
View Count - Render
View Index - Render
View Submit Node Count - The total number of submit nodes needed by each
RenderView
. TheRenderView
is represented by theRenderViewIndex
key and the count of submit nodes are contained by aVec<usize>
where the count at each indexI
corresponds to theRenderPhase
withRenderPhaseIndex
equal toI
. - Submit
Node Blocks - A collection containing all
SubmitNode
s across allRenderFeature
s matching aRenderView
andRenderPhase
where theSubmitNode
s are sorted by theRenderPhase
’s sort function. TheRenderView
andRenderPhase
pair is represented by theViewPhase
key and theSubmitNode
s are contained by theViewPhaseSubmitNodeBlock
. - Submit
Node Id - The
ID
of aSubmitNode
in a specificRenderFeature
in the current frame. - Submit
Node Sort Function - The sort function used by a particular
RenderPhase
. This is usually one of the following: - Submit
Node Sort Key - A generic key usable by the
SubmitNodeSortFunction
for the purpose of sorting the collection ofRenderFeatureSubmitNode
in a particularViewPhase
. This can be used to minimize state changes in the rendering pipeline, e.g. by setting the bits of the key so that higher bits represent more expensive state changes like shaders and lower bits represent cheaper state changes like uniforms. - View
Frame Index - The index of a
RenderView
in thisRenderFeature
’sFramePacket
for the current frame. - Visibility
Vecs - Visible
Render Objects