16uint32_t GrRenderTask::CreateUniqueID() {
17 static std::atomic<uint32_t> nextID{1};
20 id = nextID.fetch_add(1, std::memory_order_relaxed);
26 : fUniqueID(CreateUniqueID())
31 SkASSERT(!fDrawingMgr || drawingMgr == fDrawingMgr);
55GrRenderTask::~GrRenderTask() {
59bool GrRenderTask::deferredProxiesAreInstantiated()
const {
88 if (fTextureResolveTask) {
90 fTextureResolveTask->makeClosed(rContext);
91 fTextureResolveTask =
nullptr;
111 dependedOn->addDependent(
this);
138 if (dependedOnTask ==
this) {
149 bool alreadyDependent =
false;
150 if (dependedOnTask) {
151 if (this->
dependsOn(dependedOnTask) || fTextureResolveTask == dependedOnTask) {
152 alreadyDependent =
true;
153 dependedOnTask =
nullptr;
158 dependedOnTask->makeClosed(drawingMgr->
getContext());
167 if (renderTargetProxy->isMSAADirty()) {
186 if (!fTextureResolveTask) {
189 fTextureResolveTask->
addProxy(drawingMgr,
sk_ref_sp(dependedOn), resolveFlags, caps);
198 if (dependedOnTask) {
209 SkASSERT(!renderTargetProxy->isMSAADirty());
221 if (alreadyDependent) {
229 if (dependedOnTask) {
235 for (
auto&
target : fDependencies) {
236 if (
target == toReplace) {
238 replaceWith->fDependents.
push_back(
this);
245 for (
auto&
target : fDependents) {
246 if (
target == toReplace) {
248 replaceWith->fDependencies.
push_back(
this);
255 for (
int i = 0;
i < fDependencies.
size(); ++
i) {
256 if (fDependencies[
i] == dependedOn) {
265void GrRenderTask::addDependent(
GrRenderTask* dependent) {
270bool GrRenderTask::isDependent(
const GrRenderTask* dependent)
const {
271 for (
int i = 0;
i < fDependents.
size(); ++
i) {
272 if (fDependents[
i] == dependent) {
280void GrRenderTask::validate()
const {
283 for (
int i = 0;
i < fDependencies.
size(); ++
i) {
284 SkASSERT(fDependencies[
i]->isDependent(
this));
308 SkASSERT(!fDrawingMgr || drawingMgr == fDrawingMgr);
315#if defined(GR_TEST_UTILS)
318 bool printDependencies,
320 SkDebugf(
"%s%s --------------------------------------------------------------\n",
323 SkDebugf(
"%s%s task - renderTaskID: %u\n", indent.
c_str(), this->name(), fUniqueID);
334 if (printDependencies) {
336 for (
int i = 0;
i < fDependencies.
size(); ++
i) {
337 SkDebugf(
"%u, ", fDependencies[
i]->fUniqueID);
342 for (
int i = 0;
i < fDependents.
size(); ++
i) {
343 SkDebugf(
"%u, ", fDependents[
i]->fUniqueID);
349 SkDebugf(
"%s--------------------------------------------------------------\n\n",
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
sk_sp< T > sk_ref_sp(T *obj)
static constexpr uint32_t SK_InvalidUniqueID
static void dump(const float m[20], SkYUVColorSpace cs, bool rgb2yuv)
int find(T *array, int N, T item)
GrRecordingContext * getContext()
GrRenderTask * getLastRenderTask(const GrSurfaceProxy *) const
void setLastRenderTask(const GrSurfaceProxy *, GrRenderTask *)
void markMSAADirty(SkIRect dirtyRect)
GrSurfaceProxy * target(int i) const
virtual void onPrepare(GrOpFlushState *)
void addDependenciesFromOtherTask(GrRenderTask *otherTask)
void prepare(GrOpFlushState *flushState)
bool isSetFlag(uint32_t flag) const
virtual ExpectedOutcome onMakeClosed(GrRecordingContext *, SkIRect *targetUpdateBounds)=0
void setFlag(uint32_t flag)
bool isInstantiated() const
bool dependsOn(const GrRenderTask *dependedOn) const
void addDependency(GrDrawingManager *, GrSurfaceProxy *dependedOn, skgpu::Mipmapped, GrTextureResolveManager, const GrCaps &caps)
virtual void onMakeSkippable()
skia_private::STArray< 1, sk_sp< GrSurfaceProxy > > fTargets
void replaceDependency(const GrRenderTask *toReplace, GrRenderTask *replaceWith)
void addTarget(GrDrawingManager *dm, const GrSurfaceProxyView &view)
void replaceDependent(const GrRenderTask *toReplace, GrRenderTask *replaceWith)
SkDEBUGCODE(~GrRenderTask() override;) void makeClosed(GrRecordingContext *)
virtual void disown(GrDrawingManager *)
skia_private::TArray< GrTextureProxy *, true > fDeferredProxies
@ kAtlas_Flag
This task is atlas.
@ kSkippable_Flag
This task is skippable.
@ kClosed_Flag
This task can't accept any more dependencies.
@ kDisowned_Flag
This task is disowned by its GrDrawingManager.
virtual GrRenderTargetProxy * asRenderTargetProxy()
bool requiresManualMSAAResolve() const
virtual GrTextureProxy * asTextureProxy()
GrSurface * peekSurface() const
bool isInstantiated() const
void isUsedAsTaskTarget()
GrTextureProxyPriv texPriv()
skgpu::Mipmapped mipmapped() const
bool mipmapsAreDirty() const
GrTextureResolveRenderTask * newTextureResolveRenderTask(const GrCaps &caps) const
void addProxy(GrDrawingManager *, sk_sp< GrSurfaceProxy > proxy, GrSurfaceProxy::ResolveFlags, const GrCaps &)
const char * c_str() const
T & emplace_back(Args &&... args)