Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Private Member Functions | Friends | List of all members
skgpu::ganesh::PathTessellateOp Class Referencefinal

#include <PathTessellateOp.h>

Inheritance diagram for skgpu::ganesh::PathTessellateOp:
GrDrawOp GrOp SkNoncopyable

Private Member Functions

const char * name () const override
 
bool usesMSAA () const override
 
void visitProxies (const GrVisitProxyFunc &) const override
 
GrProcessorSet::Analysis finalize (const GrCaps &, const GrAppliedClip *, GrClampType) override
 
bool usesStencil () const override
 
CombineResult onCombineIfPossible (GrOp *, SkArenaAlloc *, const GrCaps &) override
 
void onPrePrepare (GrRecordingContext *, const GrSurfaceProxyView &, GrAppliedClip *, const GrDstProxyView &, GrXferBarrierFlags, GrLoadOp colorLoadOp) override
 
void onPrepare (GrOpFlushState *) override
 
void onExecute (GrOpFlushState *, const SkRect &chainBounds) override
 

Friends

class GrOp
 

Additional Inherited Members

- Public Types inherited from GrDrawOp
enum class  ClipResult { kFail , kClippedGeometrically , kClippedInShader , kClippedOut }
 
- Public Types inherited from GrOp
enum class  CombineResult { kMerged , kMayChain , kCannotCombine }
 
enum class  HasAABloat : bool { kNo = false , kYes = true }
 
enum class  IsHairline : bool { kNo = false , kYes = true }
 
using Owner = std::unique_ptr< GrOp >
 
- Public Member Functions inherited from GrDrawOp
 GrDrawOp (uint32_t classID)
 
virtual ClipResult clipToShape (skgpu::ganesh::SurfaceDrawContext *, SkClipOp, const SkMatrix &, const GrShape &, GrAA)
 
- Public Member Functions inherited from GrOp
virtual ~GrOp ()=default
 
CombineResult combineIfPossible (GrOp *that, SkArenaAlloc *alloc, const GrCaps &caps)
 
const SkRectbounds () const
 
void setClippedBounds (const SkRect &clippedBounds)
 
bool hasAABloat () const
 
bool hasZeroArea () const
 
void operator delete (void *p)
 
template<typename T >
const Tcast () const
 
template<typename T >
Tcast ()
 
uint32_t classID () const
 
uint32_t uniqueID () const
 
void prePrepare (GrRecordingContext *context, const GrSurfaceProxyView &dstView, GrAppliedClip *clip, const GrDstProxyView &dstProxyView, GrXferBarrierFlags renderPassXferBarriers, GrLoadOp colorLoadOp)
 
void prepare (GrOpFlushState *state)
 
void execute (GrOpFlushState *state, const SkRect &chainBounds)
 
void chainConcat (GrOp::Owner)
 
bool isChainHead () const
 
bool isChainTail () const
 
GrOpnextInChain () const
 
GrOpprevInChain () const
 
GrOp::Owner cutChain ()
 
void setBounds (const SkRect &newBounds, HasAABloat aabloat, IsHairline zeroArea)
 
void setTransformedBounds (const SkRect &srcBounds, const SkMatrix &m, HasAABloat aabloat, IsHairline zeroArea)
 
void makeFullScreen (GrSurfaceProxy *proxy)
 
- Static Public Member Functions inherited from GrOp
template<typename Op , typename... Args>
static Owner Make (GrRecordingContext *context, Args &&... args)
 
template<typename Op , typename... Args>
static Owner MakeWithProcessorSet (GrRecordingContext *context, const SkPMColor4f &color, GrPaint &&paint, Args &&... args)
 
template<typename Op , typename... Args>
static Owner MakeWithExtraMemory (GrRecordingContext *context, size_t extraSize, Args &&... args)
 
static uint32_t GenOpClassID ()
 
- Protected Types inherited from GrDrawOp
enum class  FixedFunctionFlags : uint32_t { kNone = 0x0 , kUsesHWAA = 0x1 , kUsesStencil = 0x2 }
 
- Protected Member Functions inherited from GrDrawOp
 GR_DECL_BITFIELD_CLASS_OPS_FRIENDS (FixedFunctionFlags)
 
virtual FixedFunctionFlags fixedFunctionFlags () const
 

Detailed Description

Definition at line 20 of file PathTessellateOp.h.

Member Function Documentation

◆ finalize()

GrProcessorSet::Analysis skgpu::ganesh::PathTessellateOp::finalize ( const GrCaps ,
const GrAppliedClip ,
GrClampType   
)
overrideprivatevirtual

This is called after the GrAppliedClip has been computed and just prior to recording the op or combining it with a previously recorded op. The op should convert any proxies or resources it owns to "pending io" status so that resource allocation can be more optimal. Additionally, at this time the op must report whether a copy of the destination (or destination texture itself) needs to be provided to the GrXferProcessor when this op executes.

Implements GrDrawOp.

Definition at line 26 of file PathTessellateOp.cpp.

28 {
29 auto analysis = fProcessors.finalize(this->headDraw().fColor,
31 clip,
32 nullptr,
33 caps,
34 clampType,
35 &this->headDraw().fColor);
36 if (!analysis.usesLocalCoords()) {
37 // Since we don't need local coords, we can transform on CPU instead of in the shader. This
38 // gives us better batching potential.
39 this->headDraw().fPathMatrix = fShaderMatrix;
40 fShaderMatrix = SkMatrix::I();
41 }
42 return analysis;
43}
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
Definition SkPath.cpp:3824
Analysis finalize(const GrProcessorAnalysisColor &, const GrProcessorAnalysisCoverage, const GrAppliedClip *, const GrUserStencilSettings *, const GrCaps &, GrClampType, SkPMColor4f *inputColorOverride)
static const SkMatrix & I()

◆ name()

const char * skgpu::ganesh::PathTessellateOp::name ( ) const
inlineoverrideprivatevirtual

Implements GrOp.

Definition at line 54 of file PathTessellateOp.h.

54{ return "PathTessellateOp"; }

◆ onCombineIfPossible()

GrDrawOp::CombineResult skgpu::ganesh::PathTessellateOp::onCombineIfPossible ( GrOp grOp,
SkArenaAlloc ,
const GrCaps  
)
overrideprivatevirtual

Reimplemented from GrOp.

Definition at line 45 of file PathTessellateOp.cpp.

47 {
48 auto* op = grOp->cast<PathTessellateOp>();
49 bool canMerge = fAAType == op->fAAType &&
50 fStencil == op->fStencil &&
51 fProcessors == op->fProcessors &&
52 fShaderMatrix == op->fShaderMatrix;
53 if (canMerge) {
54 fTotalCombinedPathVerbCnt += op->fTotalCombinedPathVerbCnt;
55 fPatchAttribs |= op->fPatchAttribs;
56
57 if (!(fPatchAttribs & PatchAttribs::kColor) &&
58 this->headDraw().fColor != op->headDraw().fColor) {
59 // Color is no longer uniform. Move it into patch attribs.
60 fPatchAttribs |= PatchAttribs::kColor;
61 }
62
63 *fPathDrawTail = op->fPathDrawList;
64 fPathDrawTail = op->fPathDrawTail;
66 }
67
69}
const T & cast() const
Definition GrOp.h:148

◆ onExecute()

void skgpu::ganesh::PathTessellateOp::onExecute ( GrOpFlushState flushState,
const SkRect chainBounds 
)
overrideprivatevirtual

Implements GrOp.

Definition at line 117 of file PathTessellateOp.cpp.

117 {
118 SkASSERT(fTessellator);
119 SkASSERT(fTessellationProgram);
120 flushState->bindPipelineAndScissorClip(*fTessellationProgram, this->bounds());
121 flushState->bindTextures(fTessellationProgram->geomProc(), nullptr,
122 fTessellationProgram->pipeline());
123 fTessellator->draw(flushState);
124}
#define SkASSERT(cond)
Definition SkAssert.h:116
void bindPipelineAndScissorClip(const GrProgramInfo &programInfo, const SkRect &drawBounds)
void bindTextures(const GrGeometryProcessor &geomProc, const GrSurfaceProxy &singleGeomProcTexture, const GrPipeline &pipeline)
const SkRect & bounds() const
Definition GrOp.h:122
const GrPipeline & pipeline() const
const GrGeometryProcessor & geomProc() const
virtual void draw(GrOpFlushState *flushState) const =0

◆ onPrepare()

void skgpu::ganesh::PathTessellateOp::onPrepare ( GrOpFlushState flushState)
overrideprivatevirtual

Implements GrOp.

Definition at line 103 of file PathTessellateOp.cpp.

103 {
104 if (!fTessellator) {
105 this->prepareTessellator({flushState->allocator(), flushState->writeView(),
106 flushState->usesMSAASurface(), &flushState->dstProxyView(),
107 flushState->renderPassBarriers(), flushState->colorLoadOp(),
108 &flushState->caps()}, flushState->detachAppliedClip());
109 SkASSERT(fTessellator);
110 }
111 fTessellator->prepare(flushState,
112 fShaderMatrix,
113 *fPathDrawList,
114 fTotalCombinedPathVerbCnt);
115}
GrLoadOp colorLoadOp() const final
const GrDstProxyView & dstProxyView() const final
GrXferBarrierFlags renderPassBarriers() const final
SkArenaAlloc * allocator() override
const GrSurfaceProxyView & writeView() const final
GrAppliedClip detachAppliedClip() final
const GrCaps & caps() const final
bool usesMSAASurface() const final
virtual void prepare(GrMeshDrawTarget *target, const SkMatrix &shaderMatrix, const PathDrawList &pathDrawList, int totalCombinedPathVerbCnt)=0

◆ onPrePrepare()

void skgpu::ganesh::PathTessellateOp::onPrePrepare ( GrRecordingContext context,
const GrSurfaceProxyView writeView,
GrAppliedClip clip,
const GrDstProxyView dstProxyView,
GrXferBarrierFlags  renderPassXferBarriers,
GrLoadOp  colorLoadOp 
)
overrideprivatevirtual

Implements GrOp.

Definition at line 88 of file PathTessellateOp.cpp.

92 {
93 // DMSAA is not supported on DDL.
94 bool usesMSAASurface = writeView.asRenderTargetProxy()->numSamples() > 1;
95 this->prepareTessellator({context->priv().recordTimeAllocator(), writeView, usesMSAASurface,
96 &dstProxyView, renderPassXferBarriers, colorLoadOp,
97 context->priv().caps()},
98 (clip) ? std::move(*clip) : GrAppliedClip::Disabled());
99 SkASSERT(fTessellationProgram);
100 context->priv().recordProgramInfo(fTessellationProgram);
101}
static GrAppliedClip Disabled()
const GrCaps * caps() const
void recordProgramInfo(const GrProgramInfo *programInfo)
GrRecordingContextPriv priv()
GrRenderTargetProxy * asRenderTargetProxy() const

◆ usesMSAA()

bool skgpu::ganesh::PathTessellateOp::usesMSAA ( ) const
inlineoverrideprivatevirtual

Called before setting up the GrAppliedClip and before finalize. This information is required to determine how to compute a GrAppliedClip from a GrClip for this op.

Reimplemented from GrDrawOp.

Definition at line 55 of file PathTessellateOp.h.

55{ return fAAType == GrAAType::kMSAA; }

◆ usesStencil()

bool skgpu::ganesh::PathTessellateOp::usesStencil ( ) const
inlineoverrideprivatevirtual

Called after finalize, at which point every op should know whether it will need stencil.

Reimplemented from GrDrawOp.

Definition at line 58 of file PathTessellateOp.h.

58{ return !fStencil->isUnused(); }

◆ visitProxies()

void skgpu::ganesh::PathTessellateOp::visitProxies ( const GrVisitProxyFunc func) const
overrideprivatevirtual

Reimplemented from GrOp.

Definition at line 18 of file PathTessellateOp.cpp.

18 {
19 if (fTessellationProgram) {
20 fTessellationProgram->pipeline().visitProxies(func);
21 } else {
22 fProcessors.visitProxies(func);
23 }
24}
void visitProxies(const GrVisitProxyFunc &) const
void visitProxies(const GrVisitProxyFunc &) const

Friends And Related Symbol Documentation

◆ GrOp

friend class GrOp
friend

Definition at line 78 of file PathTessellateOp.h.


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