A thread-safe reference-counting pointer. ‘Arc’ stands for ‘Atomically
Reference Counted’.
A thread-safe container that does not require default initialization. The cell may be initialized
with set
and then retrieved as a reference with get
. Calling set
is thread-safe. The cell
will panic if the set
function is called more than once. The cell will only drop initialized elements.
A fixed-size array with capacity
determined at run-time. The elements of the array are uninitialized.
Elements may be initialized with set
and then retrieved as a reference with get
. Calling set
is
thread-safe. The array will panic if the capacity
is exceeded, or the index
is out of range, or the
set
function is called more than once on an index when T
is not zero-sized. The array will only drop
initialized elements.
A fixed-size stack with capacity
determined at run-time. The elements of the stack are uninitialized.
Elements may be initialized with push
and then retrieved as a reference with get
. push
returns the
index of the element in the stack. The caller may reserve space for multiple elements with reserve_uninit
.
Reserved elements must be initialized with set
. Calling push
, reserve_uninit
, or set
is thread-safe.
The stack will panic if the capacity
is exceeded, or the index
is out of range, or the set
function is
called more than once on an index when T
is not zero-sized, or if the set
function is called on an index
that was not reserved by a prior call to reserve_uninit
. The stack will only drop initialized elements.
A JobContext
is definable by each RenderFeature
. 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. The JobContext
will not be shared between threads.
Use DefaultJobContext
if the RenderFeature
does not need to acquire resources.
An ExtractJob
implements the RenderFeatureExtractJob
trait by wrapping an instance
of an ExtractJobEntryPoints
type defined at compile-time. The ExtractJob
contains
the frame packet and presents the correct context (like ExtractPerFrameContext
) to each
entry point defined in ExtractJobEntryPoints
.
Read documentation on FramePacketData
.
An opaque 64-bit handle used as a unique identifier for objects in the game world
that are visible or otherwise relevant to the renderer’s pipeline. Each VisibilityObject
is associated with a specific ObjectId
.
A PrepareJob
implements the RenderFeaturePrepareJob
trait by wrapping an instance
of an PrepareJobEntryPoints
type defined at compile-time. The PrepareJob
contains
the frame & submit packets and presents the correct context (like PreparePerFrameContext
)
to each entry point defined in RenderFeaturePrepareJob
.
The sorted SubmitNode
s for each RenderView
and RenderPhase
with all relevant RenderFeature
’s
RenderFeatureWriteJob
s.
A type-erased struct representing some RenderFeature
’s SubmitNode
. The PreparedRenderData
will iterate through the sorted slice of RenderFeatureSubmitNode
in a ViewPhaseSubmitNodeBlock
and call the functions on the RenderFeatureWriteJob
specified by the RenderFeatureIndex
.
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 the RenderJobExtractContext
during their new
function.
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 the RenderJobPrepareContext
during their new
function.
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 the RenderJobWriteContext
during their new
function.
A reference to a RenderObject
with a reference-counted pointer. When the last instance of
a RenderObjectHandle
is dropped, the referenced RenderObject
will be freed from the
RenderObjectSet
. This is returned by register_render_object
on the RenderObjectSet
and may be used to query or mutate the RenderObject
with the get
or get_mut
methods.
A weak RenderObjectHandle
. This is a reference to a RenderObject
that is not used in
reference-counting by the RenderObjectSet
. Create a RenderObjectId
with the as_id()
method on a RenderObjectHandle
. The RenderObject
can be queried with the get_id
method on
the RenderObjectSet
.
A specific Entity
and RenderObject
represented by the ObjectId
and RenderObjectId
. A
RenderObject
is associated with a particular RenderFeature
by the RenderFeatureIndex
.
The FramePacket
only contains unique RenderObjectInstance
s.
A specific RenderObjectInstance
as viewed by some RenderView
.
Use RenderObjectsJobContext
if the RenderFeature
only needs to lock a RenderObjectsMap
.
The Renderer
processes RenderView
s during the execution of the RenderGraph
. Each
RenderView
is associated with a specific ViewFrustum
in the game world. The RenderView
may be registered for specific RenderFeature
s by a RenderFeatureMask
or RenderPhase
s by
the RenderPhaseMask
. If a RenderView
is not registered for a RenderFeature
or RenderPhase
then it will not be processed by that feature or phase.
The RenderObject
s visible to a specific RenderView
for the current frame. Each RenderObject
is represented by a RenderViewObject
with the ObjectId
returned by the VisibilityObject
and a RenderObjectId
. If a VisibilityObject
has multiple RenderObject
s associated with it,
the results will be returned as 0 or more RenderViewObject
s. The visible RenderObject
s will
only contain RenderObject
s associated with a RenderFeature
included by the RenderView
’s
RenderFeatureMask
.
Each SubmitNode
contains the data needed for the RenderFeature
’s RenderFeatureWriteJob
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 the RenderPhase
after they are combined into
a ViewPhaseSubmitNodeBlock
.
The SubmitNodeBlock
is a collection of SubmitNode
associated with a particular RenderFeature
,
RenderView
, and RenderPhase
. There should be a 1:1 mapping between SubmitNode
s and draw calls
from the RenderFeature
’s WriteJob
. The Renderer
will combine all SubmitNodeBlock
s sharing the
same RenderView
and RenderPhase
into a sorted ViewPhaseSubmitNodeBlock
.
Read documentation on SubmitPacketData
.
A custom cell container that is a RefCell
with thread-safety.
Read documentation on FramePacketData
.
A combination of a particular RenderView
and RenderPhase
. The ViewPhaseSubmitNodeBlock
s
in the PreparedRenderData
are indexed by the ViewPhase
.
The ViewPhaseSubmitNodeBlock
is a collection of RenderFeatureSubmitNode
associated with
a particular RenderView
, and RenderPhase
. In other words, the ViewPhaseSubmitNodeBlock
is the combination of all the feature-specific RenderFeatureSubmitNodeBlock
s with the same
RenderView
and RenderPhase
.
Read documentation on SubmitPacketData
.
Determines the visible RenderObject
s in a given RenderView
and returns the results in the
RenderViewVisibilityQuery
. It is thread-safe to call query_visibility
on multiple RenderView
s
simultaneously.
ExtractJobEntryPoints
provides a generic set of callbacks for a RenderFeature
compatible with the ExtractJob
struct. This simplifies the work of implementing
the RenderFeatureExtractJob
trait.
The FramePacket
is the data that must be extracted from either the AssetManager
or the game’s
World
during the Extract
step. After the Extract
step has finished, there is no more access
allowed to either the AssetManager
or the game’s World
. The FramePacket
must be considered
immutable after the Extract
step has finished.
PrepareJobEntryPoints
provides a generic set of callbacks for a RenderFeature
compatible with the PrepareJob
struct. This simplifies the work of implementing
the RenderFeaturePrepareJob
trait.
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. See ExtractJob
and the
ExtractJobEntryPoints
for implementation details.
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. See FramePacket
and ViewPacket
for implementation details.
Provides as_concrete
method to downcast as a concrete type.
Provides into_concrete
method to downcast into a concrete type.
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. See PrepareJob
and the
PrepareJobEntryPoints
for implementation details.
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. See SubmitNodeBlock
for
implementation details.
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. See SubmitPacket
and ViewSubmitPacket
for implementation details.
Provides as_concrete
method to downcast as a concrete type.
Provides into_concrete
method to downcast into a concrete type.
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. See ViewPacket
for implementation
details.
Provides as_concrete
method to downcast as a concrete type.
Provides into_concrete
method to downcast into a concrete type.
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. See ViewSubmitPacket
for implementation details.
Provides as_concrete
method to downcast as a concrete type.
Provides into_concrete
method to downcast into a concrete type.
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.
The SubmitPacket
is the data that must be prepared from
in order for the RenderFeature
’s WriteJob
to create each
draw call. The draw calls may reference data in either the
FramePacket
or the SubmitPacket
. Each draw call is represented
by exactly 1 SubmitNode
. In order to allocate the SubmitPacket
,
the RenderFeature
is given a reference to the populated FramePacket
from that frame. The RenderFeature
must size the SubmitPacket
appropriately. The SubmitPacket
must be considered
immutable after the Prepare
step has finished.
A mutual exclusion primitive useful for protecting shared data
An RAII implementation of a “scoped lock” of a mutex. When this structure is
dropped (falls out of scope), the lock will be unlocked.
The ID
of a registered RenderFeature
.
The ID
of a RenderObjectInstance
in a specific FramePacket
for the current frame.
The ID
of a RenderObjectInstance
in a specific ViewPacket
for the current frame.
The ID
of a registered RenderPhase
.
The total number of submit nodes needed by each RenderView
. The RenderView
is represented by
the RenderViewIndex
key and the count of submit nodes are contained by a Vec<usize>
where
the count at each index I
corresponds to the RenderPhase
with RenderPhaseIndex
equal to I
.
A reader-writer lock
RAII structure used to release the shared read access of a lock when
dropped.
RAII structure used to release the exclusive write access of a lock when
dropped.
A collection containing all SubmitNode
s across all RenderFeature
s matching a RenderView
and RenderPhase
where the SubmitNode
s are sorted by the RenderPhase
’s sort function. The
RenderView
and RenderPhase
pair is represented by the ViewPhase
key and the SubmitNode
s
are contained by the ViewPhaseSubmitNodeBlock
.
The ID
of a SubmitNode
in a specific RenderFeature
in the current frame.
A generic key usable by the SubmitNodeSortFunction
for the purpose of sorting the collection of
RenderFeatureSubmitNode
in a particular ViewPhase
. 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.
The index of a RenderView
in this RenderFeature
’s FramePacket
for the current frame.