Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Member Functions | List of all members
GrTextureResolveRenderTask Class Referencefinal

#include <GrTextureResolveRenderTask.h>

Inheritance diagram for GrTextureResolveRenderTask:
GrRenderTask SkRefCnt SkRefCntBase

Public Member Functions

 GrTextureResolveRenderTask ()
 
void addProxy (GrDrawingManager *, sk_sp< GrSurfaceProxy > proxy, GrSurfaceProxy::ResolveFlags, const GrCaps &)
 
- Public Member Functions inherited from GrRenderTask
 GrRenderTask ()
 
 SkDEBUGCODE (~GrRenderTask() override;) void makeClosed(GrRecordingContext *)
 
void prePrepare (GrRecordingContext *context)
 
void prepare (GrOpFlushState *flushState)
 
bool execute (GrOpFlushState *flushState)
 
virtual bool requiresExplicitCleanup () const
 
virtual void endFlush (GrDrawingManager *)
 
virtual void disown (GrDrawingManager *)
 
bool isClosed () const
 
void makeSkippable ()
 
bool isSkippable () const
 
bool blocksReordering () const
 
void addDependency (GrDrawingManager *, GrSurfaceProxy *dependedOn, skgpu::Mipmapped, GrTextureResolveManager, const GrCaps &caps)
 
void addDependenciesFromOtherTask (GrRenderTask *otherTask)
 
SkSpan< GrRenderTask * > dependencies ()
 
SkSpan< GrRenderTask * > dependents ()
 
void replaceDependency (const GrRenderTask *toReplace, GrRenderTask *replaceWith)
 
void replaceDependent (const GrRenderTask *toReplace, GrRenderTask *replaceWith)
 
bool dependsOn (const GrRenderTask *dependedOn) const
 
uint32_t uniqueID () const
 
int numTargets () const
 
GrSurfaceProxytarget (int i) const
 
virtual skgpu::ganesh::OpsTaskasOpsTask ()
 
bool isUsed (GrSurfaceProxy *proxy) const
 
bool isInstantiated () const
 
 SK_DECLARE_INTERNAL_LLIST_INTERFACE (GrRenderTask)
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Private Member Functions

bool onIsUsed (GrSurfaceProxy *proxy) const override
 
void gatherProxyIntervals (GrResourceAllocator *) const override
 
ExpectedOutcome onMakeClosed (GrRecordingContext *, SkIRect *) override
 
bool onExecute (GrOpFlushState *) override
 

Additional Inherited Members

- Protected Types inherited from GrRenderTask
enum class  ExpectedOutcome : bool { kTargetUnchanged , kTargetDirty }
 
enum  Flags {
  kClosed_Flag = 0x01 , kDisowned_Flag = 0x02 , kSkippable_Flag = 0x04 , kAtlas_Flag = 0x08 ,
  kBlocksReordering_Flag = 0x10 , kWasOutput_Flag = 0x20 , kTempMark_Flag = 0x40
}
 
- Protected Member Functions inherited from GrRenderTask
 SkDEBUGCODE (bool deferredProxiesAreInstantiated() const ;) void addTarget(GrDrawingManager *
 
void addTarget (GrDrawingManager *dm, const GrSurfaceProxyView &view)
 
void setFlag (uint32_t flag)
 
void resetFlag (uint32_t flag)
 
bool isSetFlag (uint32_t flag) const
 
void setIndex (uint32_t index)
 
uint32_t getIndex () const
 
- Protected Attributes inherited from GrRenderTask
 sk_sp< GrSurfaceProxy >
 
skia_private::STArray< 1, sk_sp< GrSurfaceProxy > > fTargets
 
skia_private::TArray< GrTextureProxy *, true > fDeferredProxies
 

Detailed Description

Definition at line 24 of file GrTextureResolveRenderTask.h.

Constructor & Destructor Documentation

◆ GrTextureResolveRenderTask()

GrTextureResolveRenderTask::GrTextureResolveRenderTask ( )
inline

Definition at line 26 of file GrTextureResolveRenderTask.h.

Member Function Documentation

◆ addProxy()

void GrTextureResolveRenderTask::addProxy ( GrDrawingManager drawingMgr,
sk_sp< GrSurfaceProxy proxy,
GrSurfaceProxy::ResolveFlags  flags,
const GrCaps caps 
)

Definition at line 28 of file GrTextureResolveRenderTask.cpp.

31 {
33 GrSurfaceProxy* proxy = proxyRef.get();
34 Resolve* resolve;
35 bool newProxy = false;
36
37 // We might just need to update the flags for an existing dependency.
38 if (auto found = std::find(fTargets.begin(), fTargets.end(), proxyRef);
39 found != fTargets.end()) {
40 size_t index = found - fTargets.begin();
41 resolve = &fResolves[index];
42 newFlags = ~resolve->fFlags & flags;
43 resolve->fFlags |= flags;
44 } else {
45 // Ensure the last render task that operated on the proxy is closed. That's where msaa and
46 // mipmaps should have been marked dirty.
47 SkASSERT(!drawingMgr->getLastRenderTask(proxy)
48 || drawingMgr->getLastRenderTask(proxy)->isClosed());
50 resolve = &fResolves.emplace_back(flags);
51 newProxy = true;
52 }
53
55 GrRenderTargetProxy* renderTargetProxy = proxy->asRenderTargetProxy();
56 SkASSERT(renderTargetProxy);
57 SkASSERT(renderTargetProxy->isMSAADirty());
58 resolve->fMSAAResolveRect = renderTargetProxy->msaaDirtyRect();
59 renderTargetProxy->markMSAAResolved();
60 }
61
63 GrTextureProxy* textureProxy = proxy->asTextureProxy();
64 SkASSERT(skgpu::Mipmapped::kYes == textureProxy->mipmapped());
65 SkASSERT(textureProxy->mipmapsAreDirty());
66 textureProxy->markMipmapsClean();
67 }
68
69 // We must do this after updating the proxy state because of assertions that the proxy isn't
70 // dirty.
71 if (newProxy) {
72 // Add the proxy as a dependency: We will read the existing contents of this texture while
73 // generating mipmap levels and/or resolving MSAA.
74 this->addDependency(
75 drawingMgr, proxy, skgpu::Mipmapped::kNo, GrTextureResolveManager(nullptr), caps);
76 this->addTarget(drawingMgr, GrSurfaceProxyView(std::move(proxyRef)));
77 }
78}
#define SkASSERT(cond)
Definition SkAssert.h:116
GrRenderTask * getLastRenderTask(const GrSurfaceProxy *) const
const SkIRect & msaaDirtyRect() const
bool isClosed() const
void addDependency(GrDrawingManager *, GrSurfaceProxy *dependedOn, skgpu::Mipmapped, GrTextureResolveManager, const GrCaps &caps)
skia_private::STArray< 1, sk_sp< GrSurfaceProxy > > fTargets
void addTarget(GrDrawingManager *dm, const GrSurfaceProxyView &view)
virtual GrRenderTargetProxy * asRenderTargetProxy()
virtual GrTextureProxy * asTextureProxy()
void markMipmapsClean()
skgpu::Mipmapped mipmapped() const
bool mipmapsAreDirty() const
T * get() const
Definition SkRefCnt.h:303
T & emplace_back(Args &&... args)
Definition SkTArray.h:243
FlutterSemanticsFlag flags

◆ gatherProxyIntervals()

void GrTextureResolveRenderTask::gatherProxyIntervals ( GrResourceAllocator alloc) const
overrideprivatevirtual

Implements GrRenderTask.

Definition at line 80 of file GrTextureResolveRenderTask.cpp.

80 {
81 // This renderTask doesn't have "normal" ops, however we still need to add intervals so
82 // fEndOfOpsTaskOpIndices will remain in sync. We create fake op#'s to capture the fact that we
83 // manipulate the resolve proxies.
84 auto fakeOp = alloc->curOp();
85 SkASSERT(fResolves.size() == this->numTargets());
87 alloc->addInterval(target.get(), fakeOp, fakeOp, GrResourceAllocator::ActualUse::kYes,
89 }
90 alloc->incOps();
91}
void addInterval(GrSurfaceProxy *, unsigned int start, unsigned int end, ActualUse actualUse, AllowRecycling SkDEBUGCODE(, bool isDirectDstRead=false))
unsigned int curOp() const
int size() const
Definition SkTArray.h:416
uint32_t * target

◆ onExecute()

bool GrTextureResolveRenderTask::onExecute ( GrOpFlushState flushState)
overrideprivatevirtual

Implements GrRenderTask.

Definition at line 93 of file GrTextureResolveRenderTask.cpp.

93 {
94 // Resolve all msaa back-to-back, before regenerating mipmaps.
95 SkASSERT(fResolves.size() == this->numTargets());
96 for (int i = 0; i < fResolves.size(); ++i) {
97 const Resolve& resolve = fResolves[i];
98 if (GrSurfaceProxy::ResolveFlags::kMSAA & resolve.fFlags) {
99 GrSurfaceProxy* proxy = this->target(i);
100 // peekRenderTarget might be null if there was an instantiation error.
101 if (GrRenderTarget* renderTarget = proxy->peekRenderTarget()) {
102 flushState->gpu()->resolveRenderTarget(renderTarget, resolve.fMSAAResolveRect);
103 }
104 }
105 }
106 // Regenerate all mipmaps back-to-back.
107 for (int i = 0; i < fResolves.size(); ++i) {
108 const Resolve& resolve = fResolves[i];
109 if (GrSurfaceProxy::ResolveFlags::kMipMaps & resolve.fFlags) {
110 // peekTexture might be null if there was an instantiation error.
111 GrTexture* texture = this->target(i)->peekTexture();
112 if (texture && texture->mipmapsAreDirty()) {
113 flushState->gpu()->regenerateMipMapLevels(texture);
114 SkASSERT(!texture->mipmapsAreDirty());
115 }
116 }
117 }
118
119 return true;
120}
bool regenerateMipMapLevels(GrTexture *)
Definition GrGpu.cpp:632
void resolveRenderTarget(GrRenderTarget *, const SkIRect &resolveRect)
Definition GrGpu.cpp:659
GrRenderTarget * peekRenderTarget() const
FlTexture * texture

◆ onIsUsed()

bool GrTextureResolveRenderTask::onIsUsed ( GrSurfaceProxy proxy) const
inlineoverrideprivatevirtual

Implements GrRenderTask.

Definition at line 35 of file GrTextureResolveRenderTask.h.

35 {
36 return false;
37 }

◆ onMakeClosed()

ExpectedOutcome GrTextureResolveRenderTask::onMakeClosed ( GrRecordingContext ,
SkIRect  
)
inlineoverrideprivatevirtual

Implements GrRenderTask.

Definition at line 40 of file GrTextureResolveRenderTask.h.


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