Module render_features

Source
Expand description

Part of rafx-framework. Handles extracting, preparing, and writing draw calls

Modules§

render_features_prelude

Structs§

BeginSubmitNodeBatchArgs
DefaultJobContext
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.
ExtractJob
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.
ExtractPerFrameContext
ExtractPerViewContext
ExtractRenderObjectInstanceContext
ExtractRenderObjectInstancePerViewContext
FramePacket
Read documentation on FramePacketData.
FramePacketMetadata
FramePacketSize
PrepareJob
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.
PreparePerFrameContext
PreparePerViewContext
PrepareRenderObjectInstanceContext
PrepareRenderObjectInstancePerViewContext
PreparedRenderData
The sorted SubmitNodes for each RenderView and RenderPhase with all relevant RenderFeature’s RenderFeatureWriteJobs.
RenderFeatureDebugConstants
RenderFeatureFlagMask
RenderFeatureFlagMaskBuilder
RenderFeatureMask
RenderFeatureMaskBuilder
RenderFeatureSubmitNode
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.
RenderJobBeginExecuteGraphContext
RenderJobCommandBufferContext
RenderJobExtractAllocationContext
RenderJobExtractContext
Holds references to resources valid for the entirety of the extract step as represented by the 'extract lifetime. RenderFeatureExtractJobs should cache any resources needed from the RenderJobExtractContext during their new function.
RenderJobPrepareContext
Holds references to resources valid for the entirety of the prepare step as represented by the 'prepare lifetime. RenderFeaturePrepareJobs should cache any resources needed from the RenderJobPrepareContext during their new function.
RenderJobWriteContext
Holds references to resources valid for the entirety of the write step as represented by the 'write lifetime. RenderFeatureWriteJobs should cache any resources needed from the RenderJobWriteContext during their new function.
RenderObjectHandle
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.
RenderObjectId
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.
RenderObjectInstance
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 RenderObjectInstances.
RenderObjectInstancePerView
A specific RenderObjectInstance as viewed by some RenderView.
RenderObjectSet
RenderObjectsJobContext
Use RenderObjectsJobContext if the RenderFeature only needs to lock a RenderObjectsMap.
RenderPhaseMask
RenderPhaseMaskBuilder
RenderRegistry
RenderRegistryBuilder
RenderSubmitNodeArgs
RenderView
The Renderer processes RenderViews 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 RenderFeatures by a RenderFeatureMask or RenderPhases 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.
RenderViewDepthRange
RenderViewSet
RenderViewVisibilityQuery
The RenderObjects 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 RenderObjects associated with it, the results will be returned as 0 or more RenderViewObjects. The visible RenderObjects will only contain RenderObjects associated with a RenderFeature included by the RenderView’s RenderFeatureMask.
SubmitNode
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. SubmitNodes will be sorted by the RenderPhase after they are combined into a ViewPhaseSubmitNodeBlock.
SubmitNodeBlock
The SubmitNodeBlock is a collection of SubmitNode associated with a particular RenderFeature, RenderView, and RenderPhase. There should be a 1:1 mapping between SubmitNodes and draw calls from the RenderFeature’s WriteJob. The Renderer will combine all SubmitNodeBlocks sharing the same RenderView and RenderPhase into a sorted ViewPhaseSubmitNodeBlock.
SubmitPacket
Read documentation on SubmitPacketData.
ViewPacket
Read documentation on FramePacketData.
ViewPacketSize
ViewPhase
A combination of a particular RenderView and RenderPhase. The ViewPhaseSubmitNodeBlocks in the PreparedRenderData are indexed by the ViewPhase.
ViewPhaseSubmitNodeBlock
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 RenderFeatureSubmitNodeBlocks with the same RenderView and RenderPhase.
ViewSubmitPacket
Read documentation on SubmitPacketData.
ViewVisibilityJob
Determines the visible RenderObjects in a given RenderView and returns the results in the RenderViewVisibilityQuery. It is thread-safe to call query_visibility on multiple RenderViews simultaneously.

Constants§

MAX_RENDER_PHASE_COUNT

Traits§

ExtractJobEntryPoints
ExtractJobEntryPoints provides a generic set of callbacks for a RenderFeature compatible with the ExtractJob struct. This simplifies the work of implementing the RenderFeatureExtractJob trait.
FramePacketData
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
PrepareJobEntryPoints provides a generic set of callbacks for a RenderFeature compatible with the PrepareJob struct. This simplifies the work of implementing the RenderFeaturePrepareJob trait.
RenderFeature
RenderFeatureExtractJob
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.
RenderFeatureFlag
RenderFeatureFramePacket
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.
RenderFeatureFramePacketAsConcrete
Provides as_concrete method to downcast as a concrete type.
RenderFeatureFramePacketIntoConcrete
Provides into_concrete method to downcast into a concrete type.
RenderFeaturePrepareJob
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.
RenderFeatureSubmitNodeBlock
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.
RenderFeatureSubmitPacket
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.
RenderFeatureSubmitPacketAsConcrete
Provides as_concrete method to downcast as a concrete type.
RenderFeatureSubmitPacketIntoConcrete
Provides into_concrete method to downcast into a concrete type.
RenderFeatureViewPacket
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.
RenderFeatureViewPacketAsConcrete
Provides as_concrete method to downcast as a concrete type.
RenderFeatureViewPacketIntoConcrete
Provides into_concrete method to downcast into a concrete type.
RenderFeatureViewSubmitPacket
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.
RenderFeatureViewSubmitPacketAsConcrete
Provides as_concrete method to downcast as a concrete type.
RenderFeatureViewSubmitPacketIntoConcrete
Provides into_concrete method to downcast into a concrete type.
RenderFeatureWriteJob
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.
RenderPhase
SubmitPacketData
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.

Type Aliases§

ExtractResources
RenderFeatureFlagIndex
The ID of a registered RenderFeatureFlag.
RenderFeatureIndex
The ID of a registered RenderFeature.
RenderObjectCount
RenderObjectInstanceId
The ID of a RenderObjectInstance in a specific FramePacket for the current frame.
RenderObjectInstanceObjectIds
RenderObjectInstancePerViewId
The ID of a RenderObjectInstance in a specific ViewPacket for the current frame.
RenderObjectsMap
RenderPhaseIndex
The ID of a registered RenderPhase.
RenderViewCount
RenderViewIndex
RenderViewSubmitNodeCount
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.
SubmitNodeBlocks
A collection containing all SubmitNodes across all RenderFeatures matching a RenderView and RenderPhase where the SubmitNodes are sorted by the RenderPhase’s sort function. The RenderView and RenderPhase pair is represented by the ViewPhase key and the SubmitNodes are contained by the ViewPhaseSubmitNodeBlock.
SubmitNodeId
The ID of a SubmitNode in a specific RenderFeature in the current frame.
SubmitNodeSortFunction
The sort function used by a particular RenderPhase. This is usually one of the following:
SubmitNodeSortKey
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.
ViewFrameIndex
The index of a RenderView in this RenderFeature’s FramePacket for the current frame.
VisibilityVecs
VisibleRenderObjects