Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
skgpu::graphite::AnalyticBlurRenderStep Class Referencefinal

#include <AnalyticBlurRenderStep.h>

Inheritance diagram for skgpu::graphite::AnalyticBlurRenderStep:
skgpu::graphite::RenderStep

Public Member Functions

 AnalyticBlurRenderStep ()
 
 ~AnalyticBlurRenderStep () override=default
 
std::string vertexSkSL () const override
 
std::string texturesAndSamplersSkSL (const ResourceBindingRequirements &, int *nextBindingIndex) const override
 
const char * fragmentCoverageSkSL () const override
 
void writeVertices (DrawWriter *, const DrawParams &, skvx::ushort2 ssboIndices) const override
 
void writeUniformsAndTextures (const DrawParams &, PipelineDataGatherer *) const override
 
- Public Member Functions inherited from skgpu::graphite::RenderStep
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
 

Additional Inherited Members

- Static Public Member Functions inherited from skgpu::graphite::RenderStep
static const char * ssboIndicesAttribute ()
 
static const char * ssboIndicesVarying ()
 
- Protected Types inherited from skgpu::graphite::RenderStep
enum class  Flags : unsigned {
  kNone = 0b0000000 , kRequiresMSAA = 0b0000001 , kPerformsShading = 0b0000010 , kHasTextures = 0b0000100 ,
  kEmitsCoverage = 0b0001000 , kLCDCoverage = 0b0010000 , kEmitsPrimitiveColor = 0b0100000 , kOutsetBoundsForAA = 0b1000000
}
 
- Protected Member Functions inherited from 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={})
 

Detailed Description

Definition at line 15 of file AnalyticBlurRenderStep.h.

Constructor & Destructor Documentation

◆ AnalyticBlurRenderStep()

skgpu::graphite::AnalyticBlurRenderStep::AnalyticBlurRenderStep ( )

Definition at line 18 of file AnalyticBlurRenderStep.cpp.

19 : RenderStep("AnalyticBlurRenderStep",
20 "",
22 /*uniforms=*/
23 {{"localToDevice", SkSLType::kFloat4x4},
24 {"deviceToScaledShape", SkSLType::kFloat3x3},
25 {"shapeData", SkSLType::kFloat4},
26 {"blurData", SkSLType::kHalf2},
27 {"shapeType", SkSLType::kInt},
28 {"depth", SkSLType::kFloat}},
31 /*vertexAttrs=*/
34 /*instanceAttrs=*/{},
35 /*varyings=*/
36 // scaledShapeCoords are the fragment coordinates in local shape space, where
37 // the shape has been scaled to device space but not translated or rotated.
38 {{"scaledShapeCoords", SkSLType::kFloat2}}) {}
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={})
Definition: Renderer.cpp:19
static constexpr DepthStencilSettings kDirectDepthGreaterPass

◆ ~AnalyticBlurRenderStep()

skgpu::graphite::AnalyticBlurRenderStep::~AnalyticBlurRenderStep ( )
overridedefault

Member Function Documentation

◆ fragmentCoverageSkSL()

const char * skgpu::graphite::AnalyticBlurRenderStep::fragmentCoverageSkSL ( ) const
overridevirtual

Reimplemented from skgpu::graphite::RenderStep.

Definition at line 53 of file AnalyticBlurRenderStep.cpp.

53 {
54 return "outputCoverage = blur_coverage_fn(scaledShapeCoords, "
55 "shapeData, "
56 "blurData, "
57 "shapeType, "
58 "s);";
59}

◆ texturesAndSamplersSkSL()

std::string skgpu::graphite::AnalyticBlurRenderStep::texturesAndSamplersSkSL ( const ResourceBindingRequirements bindingReqs,
int nextBindingIndex 
) const
overridevirtual

Reimplemented from skgpu::graphite::RenderStep.

Definition at line 48 of file AnalyticBlurRenderStep.cpp.

49 {
50 return EmitSamplerLayout(bindingReqs, nextBindingIndex) + " sampler2D s;";
51}
std::string EmitSamplerLayout(const ResourceBindingRequirements &bindingReqs, int *binding)

◆ vertexSkSL()

std::string skgpu::graphite::AnalyticBlurRenderStep::vertexSkSL ( ) const
overridevirtual

Implements skgpu::graphite::RenderStep.

Definition at line 40 of file AnalyticBlurRenderStep.cpp.

40 {
41 return R"(
42 float4 devPosition = localToDevice * float4(position, depth, 1.0);
43 stepLocalCoords = position;
44 scaledShapeCoords = (deviceToScaledShape * devPosition.xy1).xy;
45 )";
46}

◆ writeUniformsAndTextures()

void skgpu::graphite::AnalyticBlurRenderStep::writeUniformsAndTextures ( const DrawParams params,
PipelineDataGatherer gatherer 
) const
overridevirtual

Implements skgpu::graphite::RenderStep.

Definition at line 74 of file AnalyticBlurRenderStep.cpp.

75 {
76 SkDEBUGCODE(UniformExpectationsValidator uev(gatherer, this->uniforms());)
77
78 gatherer->write(params.transform().matrix());
79
80 const AnalyticBlurMask& blur = params.geometry().analyticBlurMask();
81 gatherer->write(blur.deviceToScaledShape().asM33());
82 gatherer->write(blur.shapeData().asSkRect());
83 gatherer->writeHalf(blur.blurData());
84 gatherer->write(static_cast<int>(blur.shapeType()));
85 gatherer->write(params.order().depthAsFloat());
86
87 SkSamplingOptions samplingOptions = blur.shapeType() == AnalyticBlurMask::ShapeType::kRect
90 constexpr SkTileMode kTileModes[2] = {SkTileMode::kClamp, SkTileMode::kClamp};
91 gatherer->add(blur.refProxy(), {samplingOptions, kTileModes});
92}
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
SkTileMode
Definition: SkTileMode.h:13
SkSpan< const Uniform > uniforms() const
Definition: Renderer.h:143
const EmbeddedViewParams * params

◆ writeVertices()

void skgpu::graphite::AnalyticBlurRenderStep::writeVertices ( DrawWriter writer,
const DrawParams params,
skvx::ushort2  ssboIndices 
) const
overridevirtual

Implements skgpu::graphite::RenderStep.

Definition at line 61 of file AnalyticBlurRenderStep.cpp.

63 {
64 const Rect& r = params.geometry().analyticBlurMask().drawBounds();
65 DrawWriter::Vertices verts{*writer};
66 verts.append(6) << skvx::float2(r.left(), r.top()) << ssboIndices
67 << skvx::float2(r.right(), r.top()) << ssboIndices
68 << skvx::float2(r.left(), r.bot()) << ssboIndices
69 << skvx::float2(r.right(), r.top()) << ssboIndices
70 << skvx::float2(r.right(), r.bot()) << ssboIndices
71 << skvx::float2(r.left(), r.bot()) << ssboIndices;
72}
TRect< Scalar > Rect
Definition: rect.h:769
Vec< 2, float > float2
Definition: SkVx.h:1145

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