Expand description

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

Modules§

Structs§

  • 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.
  • 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 SubmitNodes for each RenderView and RenderPhase with all relevant RenderFeature’s RenderFeatureWriteJobs.
  • 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. RenderFeatureExtractJobs 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. RenderFeaturePrepareJobs 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. RenderFeatureWriteJobs 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 RenderObjectInstances.
  • A specific RenderObjectInstance as viewed by some RenderView.
  • Use RenderObjectsJobContext if the RenderFeature only needs to lock a RenderObjectsMap.
  • 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.
  • 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.
  • 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.
  • 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.
  • Read documentation on SubmitPacketData.
  • Read documentation on FramePacketData.
  • A combination of a particular RenderView and RenderPhase. The ViewPhaseSubmitNodeBlocks 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 RenderFeatureSubmitNodeBlocks with the same RenderView and RenderPhase.
  • Read documentation on SubmitPacketData.
  • 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§

Traits§

  • 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.

Type Aliases§

  • The ID of a registered RenderFeatureFlag.
  • 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 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.
  • The ID of a SubmitNode in a specific RenderFeature in the current frame.
  • The sort function used by a particular RenderPhase. This is usually one of the following:
  • 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.