Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Friends | List of all members
skgpu::graphite::RenderStep Class Referenceabstract

#include <Renderer.h>

Inheritance diagram for skgpu::graphite::RenderStep:
skgpu::graphite::AnalyticBlurRenderStep skgpu::graphite::AnalyticRRectRenderStep skgpu::graphite::BitmapTextRenderStep skgpu::graphite::CoverBoundsRenderStep skgpu::graphite::CoverageMaskRenderStep skgpu::graphite::MiddleOutFanRenderStep skgpu::graphite::PerEdgeAAQuadRenderStep skgpu::graphite::SDFTextLCDRenderStep skgpu::graphite::SDFTextRenderStep skgpu::graphite::TessellateCurvesRenderStep skgpu::graphite::TessellateStrokesRenderStep skgpu::graphite::TessellateWedgesRenderStep skgpu::graphite::VerticesRenderStep

Public Member Functions

virtual ~RenderStep ()=default
 
virtual void writeVertices (DrawWriter *, const DrawParams &, skvx::ushort2 ssboIndices) const =0
 
virtual void writeUniformsAndTextures (const DrawParams &, PipelineDataGatherer *) const =0
 
virtual std::string vertexSkSL () const =0
 
virtual std::string texturesAndSamplersSkSL (const ResourceBindingRequirements &, int *nextBindingIndex) const
 
virtual const char * fragmentCoverageSkSL () const
 
virtual const char * fragmentColorSkSL () const
 
uint32_t uniqueID () const
 
const char * name () const
 
bool requiresMSAA () const
 
bool performsShading () const
 
bool hasTextures () const
 
bool emitsPrimitiveColor () const
 
bool outsetBoundsForAA () const
 
Coverage coverage () const
 
PrimitiveType primitiveType () const
 
size_t vertexStride () const
 
size_t instanceStride () const
 
size_t numUniforms () const
 
size_t numVertexAttributes () const
 
size_t numInstanceAttributes () const
 
SkSpan< const Uniformuniforms () const
 
SkSpan< const AttributevertexAttributes () const
 
SkSpan< const AttributeinstanceAttributes () const
 
SkSpan< const Varyingvaryings () const
 
const DepthStencilSettingsdepthStencilSettings () const
 
SkEnumBitMask< DepthStencilFlagsdepthStencilFlags () const
 

Static Public Member Functions

static const char * ssboIndicesAttribute ()
 
static const char * ssboIndicesVarying ()
 

Protected Types

enum class  Flags : unsigned {
  kNone = 0b0000000 , kRequiresMSAA = 0b0000001 , kPerformsShading = 0b0000010 , kHasTextures = 0b0000100 ,
  kEmitsCoverage = 0b0001000 , kLCDCoverage = 0b0010000 , kEmitsPrimitiveColor = 0b0100000 , kOutsetBoundsForAA = 0b1000000
}
 

Protected Member Functions

 RenderStep (std::string_view className, std::string_view variantName, SkEnumBitMask< Flags > flags, std::initializer_list< Uniform > uniforms, PrimitiveType primitiveType, DepthStencilSettings depthStencilSettings, SkSpan< const Attribute > vertexAttrs, SkSpan< const Attribute > instanceAttrs, SkSpan< const Varying > varyings={})
 

Friends

class Renderer
 

Detailed Description

The actual technique for rasterizing a high-level draw recorded in a DrawList is handled by a specific Renderer. Each technique has an associated singleton Renderer that decomposes the technique into a series of RenderSteps that must be executed in the specified order for the draw. However, the RenderStep executions for multiple draws can be re-arranged so batches of each step can be performed in a larger GPU operation. This re-arranging relies on accurate determination of the DisjointStencilIndex for each draw so that stencil steps are not corrupted by another draw before its cover step is executed. It also relies on the CompressedPaintersOrder for each draw to ensure steps are not re-arranged in a way that violates the original draw order.

Renderer itself is non-virtual since it simply has to point to a list of RenderSteps. RenderSteps on the other hand are virtual implement the technique specific functionality. It is entirely possible for certain types of steps, e.g. a bounding box cover, to be re-used across different Renderers even if the preceeding steps were different.

All Renderers are accessed through the SharedContext's RendererProvider.

Definition at line 68 of file Renderer.h.

Member Enumeration Documentation

◆ Flags

enum class skgpu::graphite::RenderStep::Flags : unsigned
strongprotected
Enumerator
kNone 
kRequiresMSAA 
kPerformsShading 
kHasTextures 
kEmitsCoverage 
kLCDCoverage 
kEmitsPrimitiveColor 
kOutsetBoundsForAA 

Definition at line 165 of file Renderer.h.

165 : unsigned {
166 kNone = 0b0000000,
167 kRequiresMSAA = 0b0000001,
168 kPerformsShading = 0b0000010,
169 kHasTextures = 0b0000100,
170 kEmitsCoverage = 0b0001000,
171 kLCDCoverage = 0b0010000,
172 kEmitsPrimitiveColor = 0b0100000,
173 kOutsetBoundsForAA = 0b1000000,
174 };
@ kNone
Definition: layer.h:53

Constructor & Destructor Documentation

◆ ~RenderStep()

virtual skgpu::graphite::RenderStep::~RenderStep ( )
virtualdefault

◆ RenderStep()

skgpu::graphite::RenderStep::RenderStep ( std::string_view  className,
std::string_view  variantName,
SkEnumBitMask< Flags flags,
std::initializer_list< Uniform uniforms,
PrimitiveType  primitiveType,
DepthStencilSettings  depthStencilSettings,
SkSpan< const Attribute vertexAttrs,
SkSpan< const Attribute instanceAttrs,
SkSpan< const Varying varyings = {} 
)
protected

Definition at line 19 of file Renderer.cpp.

28 : fUniqueID(next_id())
29 , fFlags(flags)
30 , fPrimitiveType(primitiveType)
31 , fDepthStencilSettings(depthStencilSettings)
32 , fUniforms(uniforms)
33 , fVertexAttrs(vertexAttrs.begin(), vertexAttrs.end())
34 , fInstanceAttrs(instanceAttrs.begin(), instanceAttrs.end())
35 , fVaryings(varyings.begin(), varyings.end())
36 , fVertexStride(0)
37 , fInstanceStride(0)
38 , fName(className) {
39 for (auto v : this->vertexAttributes()) {
40 fVertexStride += v.sizeAlign4();
41 }
42 for (auto i : this->instanceAttributes()) {
43 fInstanceStride += i.sizeAlign4();
44 }
45 if (variantName.size() > 0) {
46 fName += "[";
47 fName += variantName;
48 fName += "]";
49 }
50}
constexpr T * begin() const
Definition: SkSpan_impl.h:90
constexpr T * end() const
Definition: SkSpan_impl.h:91
SkSpan< const Attribute > instanceAttributes() const
Definition: Renderer.h:145
PrimitiveType primitiveType() const
Definition: Renderer.h:126
SkSpan< const Attribute > vertexAttributes() const
Definition: Renderer.h:144
SkSpan< const Varying > varyings() const
Definition: Renderer.h:146
SkSpan< const Uniform > uniforms() const
Definition: Renderer.h:143
const DepthStencilSettings & depthStencilSettings() const
Definition: Renderer.h:148
FlutterSemanticsFlag flags
static uint32_t next_id()
Definition: DrawAtlas.cpp:70

Member Function Documentation

◆ coverage()

Coverage skgpu::graphite::RenderStep::coverage ( ) const
inline

Definition at line 124 of file Renderer.h.

124{ return RenderStep::GetCoverage(fFlags); }

◆ depthStencilFlags()

SkEnumBitMask< DepthStencilFlags > skgpu::graphite::RenderStep::depthStencilFlags ( ) const
inline

◆ depthStencilSettings()

const DepthStencilSettings & skgpu::graphite::RenderStep::depthStencilSettings ( ) const
inline

Definition at line 148 of file Renderer.h.

148{ return fDepthStencilSettings; }

◆ emitsPrimitiveColor()

bool skgpu::graphite::RenderStep::emitsPrimitiveColor ( ) const
inline

Definition at line 121 of file Renderer.h.

121{ return SkToBool(fFlags & Flags::kEmitsPrimitiveColor); }
static constexpr bool SkToBool(const T &x)
Definition: SkTo.h:35

◆ fragmentColorSkSL()

virtual const char * skgpu::graphite::RenderStep::fragmentColorSkSL ( ) const
inlinevirtual

Reimplemented in skgpu::graphite::VerticesRenderStep.

Definition at line 110 of file Renderer.h.

110{ return R"()"; }

◆ fragmentCoverageSkSL()

virtual const char * skgpu::graphite::RenderStep::fragmentCoverageSkSL ( ) const
inlinevirtual

◆ hasTextures()

bool skgpu::graphite::RenderStep::hasTextures ( ) const
inline

Definition at line 120 of file Renderer.h.

◆ instanceAttributes()

SkSpan< const Attribute > skgpu::graphite::RenderStep::instanceAttributes ( ) const
inline

Definition at line 145 of file Renderer.h.

145{ return SkSpan(fInstanceAttrs); }
SkSpan(Container &&) -> SkSpan< std::remove_pointer_t< decltype(std::data(std::declval< Container >()))> >

◆ instanceStride()

size_t skgpu::graphite::RenderStep::instanceStride ( ) const
inline

Definition at line 128 of file Renderer.h.

128{ return fInstanceStride; }

◆ name()

const char * skgpu::graphite::RenderStep::name ( ) const
inline

Definition at line 116 of file Renderer.h.

116{ return fName.c_str(); }

◆ numInstanceAttributes()

size_t skgpu::graphite::RenderStep::numInstanceAttributes ( ) const
inline

Definition at line 132 of file Renderer.h.

132{ return fInstanceAttrs.size(); }

◆ numUniforms()

size_t skgpu::graphite::RenderStep::numUniforms ( ) const
inline

Definition at line 130 of file Renderer.h.

130{ return fUniforms.size(); }

◆ numVertexAttributes()

size_t skgpu::graphite::RenderStep::numVertexAttributes ( ) const
inline

Definition at line 131 of file Renderer.h.

131{ return fVertexAttrs.size(); }

◆ outsetBoundsForAA()

bool skgpu::graphite::RenderStep::outsetBoundsForAA ( ) const
inline

Definition at line 122 of file Renderer.h.

◆ performsShading()

bool skgpu::graphite::RenderStep::performsShading ( ) const
inline

Definition at line 119 of file Renderer.h.

◆ primitiveType()

PrimitiveType skgpu::graphite::RenderStep::primitiveType ( ) const
inline

Definition at line 126 of file Renderer.h.

126{ return fPrimitiveType; }

◆ requiresMSAA()

bool skgpu::graphite::RenderStep::requiresMSAA ( ) const
inline

Definition at line 118 of file Renderer.h.

◆ ssboIndicesAttribute()

static const char * skgpu::graphite::RenderStep::ssboIndicesAttribute ( )
inlinestatic

Definition at line 135 of file Renderer.h.

135{ return "ssboIndices"; }

◆ ssboIndicesVarying()

static const char * skgpu::graphite::RenderStep::ssboIndicesVarying ( )
inlinestatic

Definition at line 139 of file Renderer.h.

139{ return "ssboIndicesVar"; }

◆ texturesAndSamplersSkSL()

virtual std::string skgpu::graphite::RenderStep::texturesAndSamplersSkSL ( const ResourceBindingRequirements ,
int nextBindingIndex 
) const
inlinevirtual

◆ uniforms()

SkSpan< const Uniform > skgpu::graphite::RenderStep::uniforms ( ) const
inline

Definition at line 143 of file Renderer.h.

143{ return SkSpan(fUniforms); }

◆ uniqueID()

uint32_t skgpu::graphite::RenderStep::uniqueID ( ) const
inline

Definition at line 112 of file Renderer.h.

112{ return fUniqueID; }

◆ varyings()

SkSpan< const Varying > skgpu::graphite::RenderStep::varyings ( ) const
inline

Definition at line 146 of file Renderer.h.

146{ return SkSpan(fVaryings); }

◆ vertexAttributes()

SkSpan< const Attribute > skgpu::graphite::RenderStep::vertexAttributes ( ) const
inline

Definition at line 144 of file Renderer.h.

144{ return SkSpan(fVertexAttrs); }

◆ vertexSkSL()

virtual std::string skgpu::graphite::RenderStep::vertexSkSL ( ) const
pure virtual

◆ vertexStride()

size_t skgpu::graphite::RenderStep::vertexStride ( ) const
inline

Definition at line 127 of file Renderer.h.

127{ return fVertexStride; }

◆ writeUniformsAndTextures()

virtual void skgpu::graphite::RenderStep::writeUniformsAndTextures ( const DrawParams ,
PipelineDataGatherer  
) const
pure virtual

◆ writeVertices()

virtual void skgpu::graphite::RenderStep::writeVertices ( DrawWriter ,
const DrawParams ,
skvx::ushort2  ssboIndices 
) const
pure virtual

Friends And Related Function Documentation

◆ Renderer

friend class Renderer
friend

Definition at line 191 of file Renderer.h.


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