#include <DrawListContext.h>
Public Member Functions | |
AZ_DISABLE_COPY_MOVE (DrawListContext) | |
Copies and moves are disabled to enforce thread safety. | |
bool | IsInitialized () const |
void | Init (DrawListMask drawListMask) |
Must be called prior to adding draw items. Defines the set of draw list tags to filter into. | |
void | Shutdown () |
void | AddDrawPacket (const DrawPacket *drawPacket, float depth=0.0f) |
void | AddDrawItem (DrawListTag drawListTag, DrawItemProperties drawItemProperties) |
void | FinalizeLists () |
DrawListView | GetList (DrawListTag drawListTag) const |
Returns the draw list associated with the provided tag. | |
DrawListsByTag & | GetMergedDrawListsByTag () |
This class is a context for filling and accessing draw lists. It is designed to be thread-safe and low-contention. To use it, initialize with the a bit-mask of draw list tags. This mask acts as a filter. The API is partitioned into two phases: append and consume.
In the append phase, draw packets (or singular draw items) are added to the context. These are filtered into the table of draw lists. This is thread-safe and low contention.
Call FinalizeLists to transition to the consume phase. This performs sorting and coalescing of draw lists.
Finally, in the consume phase, the context is immutable and lists are accessible via GetList.
void AZ::RHI::DrawListContext::AddDrawItem | ( | DrawListTag | drawListTag, |
DrawItemProperties | drawItemProperties | ||
) |
Adds an individual draw item to the draw list associated with the provided tag. This will no-op if the tag is not present in the internal draw list mask.
void AZ::RHI::DrawListContext::AddDrawPacket | ( | const DrawPacket * | drawPacket, |
float | depth = 0.0f |
||
) |
Filters the draw items in the draw packet into draw lists. Only draw lists specified at init time are appended. The depth value here is the depth of the object from the perspective of the view.
void AZ::RHI::DrawListContext::FinalizeLists | ( | ) |
Coalesces the draw lists in preparation for access via GetList. This should be called from a single thread as a sync point between the append / consume phases.
DrawListsByTag & AZ::RHI::DrawListContext::GetMergedDrawListsByTag | ( | ) |
Returns the collection of merged draw lists. This is only so that the View can sort the merged draw lists and isn't intended for use outside that case.