Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
skgpu::graphite::DrawOrder Class Reference

#include <DrawOrder.h>

Public Member Functions

 DrawOrder (PaintersDepth originalOrder)
 
 DrawOrder (PaintersDepth originalOrder, CompressedPaintersOrder compressedOrder)
 
CompressedPaintersOrder paintOrder () const
 
DisjointStencilIndex stencilIndex () const
 
PaintersDepth depth () const
 
float depthAsFloat () const
 
DrawOrderdependsOnPaintersOrder (CompressedPaintersOrder prevDraw)
 
DrawOrderdependsOnStencil (DisjointStencilIndex disjointSet)
 

Static Public Attributes

static constexpr PaintersDepth kClearDepth = PaintersDepth::First()
 
static constexpr CompressedPaintersOrder kNoIntersection = CompressedPaintersOrder::First()
 
static constexpr DisjointStencilIndex kUnassigned = DisjointStencilIndex::First()
 

Detailed Description

DrawOrder aggregates the three separate sequences that Graphite uses to re-order draws and their substeps as much as possible while preserving the painter's order semantics of the Skia API.

To build the full DrawOrder for a draw, start with its assigned PaintersDepth (i.e. the original painter's order of the draw call). From there, the DrawOrder can be updated to reflect dependencies on previous draws, either from depth-only clip draws or because the draw is transparent and must blend with the previous color values. Lastly, once the CompressedPaintersOrder is finalized, the DrawOrder can be updated to reflect whether or not the draw will involve the stencil buffer–and if so, specify the disjoint stencil set it belongs to.

The original and effective order that draws are executed in is defined by the PaintersDepth. However, the actual execution order is defined by first the CompressedPaintersOrder and then the DisjointStencilIndex. This means that draws with much higher depths can be executed earlier if painter's order compression allows for it.

Definition at line 105 of file DrawOrder.h.

Constructor & Destructor Documentation

◆ DrawOrder() [1/2]

skgpu::graphite::DrawOrder::DrawOrder ( PaintersDepth  originalOrder)
inlineexplicit

Definition at line 117 of file DrawOrder.h.

118 : fPaintOrder(kNoIntersection)
119 , fStencilIndex(kUnassigned)
120 , fDepth(originalOrder) {}
static constexpr DisjointStencilIndex kUnassigned
Definition DrawOrder.h:115
static constexpr CompressedPaintersOrder kNoIntersection
Definition DrawOrder.h:113

◆ DrawOrder() [2/2]

skgpu::graphite::DrawOrder::DrawOrder ( PaintersDepth  originalOrder,
CompressedPaintersOrder  compressedOrder 
)
inline

Definition at line 122 of file DrawOrder.h.

123 : fPaintOrder(compressedOrder)
124 , fStencilIndex(kUnassigned)
125 , fDepth(originalOrder) {}

Member Function Documentation

◆ dependsOnPaintersOrder()

DrawOrder & skgpu::graphite::DrawOrder::dependsOnPaintersOrder ( CompressedPaintersOrder  prevDraw)
inline

Definition at line 133 of file DrawOrder.h.

133 {
134 // A draw must be ordered after all previous draws that it depends on
135 CompressedPaintersOrder next = prevDraw.next();
136 if (fPaintOrder < next) {
137 fPaintOrder = next;
138 }
139 return *this;
140 }
static float next(float f)
MonotonicValue next() const
Definition DrawOrder.h:42
MonotonicValue< CompressedPaintersOrderSequence > CompressedPaintersOrder
Definition DrawOrder.h:58

◆ dependsOnStencil()

DrawOrder & skgpu::graphite::DrawOrder::dependsOnStencil ( DisjointStencilIndex  disjointSet)
inline

Definition at line 142 of file DrawOrder.h.

142 {
143 // Stencil usage should only be set once
144 SkASSERT(fStencilIndex == kUnassigned);
145 fStencilIndex = disjointSet;
146 return *this;
147 }
#define SkASSERT(cond)
Definition SkAssert.h:116

◆ depth()

PaintersDepth skgpu::graphite::DrawOrder::depth ( ) const
inline

Definition at line 129 of file DrawOrder.h.

129{ return fDepth; }

◆ depthAsFloat()

float skgpu::graphite::DrawOrder::depthAsFloat ( ) const
inline

Definition at line 131 of file DrawOrder.h.

131{ return fDepth.bits() / (float) PaintersDepth::Last().bits(); }

◆ paintOrder()

CompressedPaintersOrder skgpu::graphite::DrawOrder::paintOrder ( ) const
inline

Definition at line 127 of file DrawOrder.h.

127{ return fPaintOrder; }

◆ stencilIndex()

DisjointStencilIndex skgpu::graphite::DrawOrder::stencilIndex ( ) const
inline

Definition at line 128 of file DrawOrder.h.

128{ return fStencilIndex; }

Member Data Documentation

◆ kClearDepth

constexpr PaintersDepth skgpu::graphite::DrawOrder::kClearDepth = PaintersDepth::First()
inlinestaticconstexpr

Definition at line 109 of file DrawOrder.h.

◆ kNoIntersection

constexpr CompressedPaintersOrder skgpu::graphite::DrawOrder::kNoIntersection = CompressedPaintersOrder::First()
inlinestaticconstexpr

Definition at line 113 of file DrawOrder.h.

◆ kUnassigned

constexpr DisjointStencilIndex skgpu::graphite::DrawOrder::kUnassigned = DisjointStencilIndex::First()
inlinestaticconstexpr

Definition at line 115 of file DrawOrder.h.


The documentation for this class was generated from the following file: