Expand description
The modular rendering abstraction responsible for queuing, preparing, sorting and drawing entities as part of separate render phases.
In Bevy each view (camera, or shadow-casting light, etc.) has one or multiple render phases (e.g. opaque, transparent, shadow, etc). They are used to queue entities for rendering. Multiple phases might be required due to different sorting/batching behaviors (e.g. opaque: front to back, transparent: back to front) or because one phase depends on the rendered texture of the previous phase (e.g. for screen-space reflections).
To draw an entity, a corresponding PhaseItem
has to be added to one or multiple of these
render phases for each view that it is visible in.
This must be done in the RenderSet::Queue
.
After that the render phase sorts them in the RenderSet::PhaseSort
.
Finally the items are rendered using a single TrackedRenderPass
, during
the RenderSet::Render
.
Therefore each phase item is assigned a Draw
function.
These set up the state of the TrackedRenderPass
(i.e. select the
RenderPipeline
, configure the
BindGroup
s, etc.) and then issue a draw call,
for the corresponding item.
The Draw
function trait can either be implemented directly or such a function can be
created by composing multiple RenderCommand
s.
Structs§
- Binned
Render Phase - A collection of all rendering instructions, that will be executed by the GPU, for a single render phase for a single view.
- Binned
Render Phase Batch - Information about a single batch of entities rendered using binned phase items.
- Binned
Render Phase Plugin - A convenient abstraction for adding all the systems necessary for a binned render phase to the render app.
- Draw
Function Id - An identifier for a
Draw
function stored inDrawFunctions
. - Draw
Functions - Stores all draw functions for the
PhaseItem
type hidden behind a reader-writer lock. - Draw
Functions Internal - Stores all
Draw
functions for thePhaseItem
type. - Phase
Item Extra Index - The “extra index” associated with some
PhaseItem
s, alongside the indirect instance index. - Render
Command State - Wraps a
RenderCommand
into a state so that it can be used as aDraw
function. - SetItem
Pipeline - A
RenderCommand
that sets the pipeline for theCachedRenderPipelinePhaseItem
. - Sorted
Render Phase - A collection of all items to be rendered that will be encoded to GPU commands for a single render phase for a single view.
- Sorted
Render Phase Plugin - A convenient abstraction for adding all the systems necessary for a sorted render phase to the render app.
- Tracked
Render Pass - A
RenderPass
, which tracks the current pipeline state to skip redundant operations. - Unbatchable
Binned Entities - Information about the unbatchable entities in a bin.
- View
Binned Render Phases - Stores the rendering instructions for a single phase that uses bins in all views.
- View
Rangefinder3d - A distance calculator for the draw order of
PhaseItem
s. - View
Sorted Render Phases - Stores the rendering instructions for a single phase that sorts items in all views.
Enums§
- Binned
Render Phase Type - Identifies the list within
BinnedRenderPhase
that a phase item is to be placed in. - Draw
Error - Render
Command Result - The result of a
RenderCommand
.
Traits§
- AddRender
Command - Registers a
RenderCommand
as aDraw
function. They are stored inside theDrawFunctions
resource of the app. - Binned
Phase Item - Represents phase items that are placed into bins. The
BinKey
specifies which bin they’re to be placed in. Bin keys are sorted, and items within the same bin are eligible to be batched together. The elements within the bins aren’t themselves sorted. - Cached
Render Pipeline Phase Item - A
PhaseItem
item, that automatically sets the appropriate render pipeline, cached in thePipelineCache
. - Draw
- A draw function used to draw
PhaseItem
s. - Phase
Item - An item (entity of the render world) which will be drawn to a texture or the screen, as part of a render phase.
- Render
Command RenderCommand
s are modular standardized pieces of render logic that can be composed intoDraw
functions.- Sorted
Phase Item - Represents phase items that must be sorted. The
SortKey
specifies the order that these items are drawn in. These are placed into a single array, and the array as a whole is then sorted.
Functions§
- sort_
phase_ system - This system sorts the
PhaseItem
s of allSortedRenderPhase
s of this type.