Flutter Engine
The Flutter Engine
GrDDLTask.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2020 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
9
14
18 : fDDL(std::move(ddl))
19 , fDDLTarget(std::move(ddlTarget)) {
20
21 for (auto& task : fDDL->priv().renderTasks()) {
22 SkASSERT(task->isClosed());
23
24 for (int i = 0; i < task->numTargets(); ++i) {
25 drawingMgr->setLastRenderTask(task->target(i), task.get());
26 }
27 }
28
29 // The DDL task never accepts additional tasks
30 this->setFlag(kClosed_Flag);
31}
32
34
36 for (auto& task : fDDL->priv().renderTasks()) {
37 task->endFlush(drawingManager);
38 }
39
40 INHERITED::endFlush(drawingManager);
41}
42
43void GrDDLTask::disown(GrDrawingManager* drawingManager) {
44 for (auto& task : fDDL->priv().renderTasks()) {
45 task->disown(drawingManager);
46 }
47
48 INHERITED::disown(drawingManager);
49}
50
51bool GrDDLTask::onIsUsed(GrSurfaceProxy* proxy) const {
52 if (proxy == fDDLTarget.get()) {
53 return true;
54 }
55
56 for (auto& task : fDDL->priv().renderTasks()) {
57 if (task->isUsed(proxy)) {
58 return true;
59 }
60 }
61
62 return false;
63}
64
65void GrDDLTask::gatherProxyIntervals(GrResourceAllocator* alloc) const {
66 // We don't have any proxies, but the resource allocator will still bark
67 // if a task doesn't claim any op indices, so we oblige it.
68 alloc->incOps();
69
70 for (auto& task : fDDL->priv().renderTasks()) {
71 task->gatherProxyIntervals(alloc);
72 }
73}
74
76 SkIRect* targetUpdateBounds) {
77 SkASSERT(0);
79}
80
81void GrDDLTask::onPrepare(GrOpFlushState* flushState) {
82 for (auto& task : fDDL->priv().renderTasks()) {
83 task->prepare(flushState);
84 }
85}
86
87bool GrDDLTask::onExecute(GrOpFlushState* flushState) {
88 bool anyCommandsIssued = false;
89 for (auto& task : fDDL->priv().renderTasks()) {
90 if (task->execute(flushState)) {
91 anyCommandsIssued = true;
92 }
93 }
94
95 return anyCommandsIssued;
96}
97
98#if defined(GR_TEST_UTILS)
99void GrDDLTask::dump(const SkString& label,
100 SkString indent,
101 bool printDependencies,
102 bool close) const {
103 INHERITED::dump(label, indent, printDependencies, false);
104
105 SkDebugf("%sDDL Target: ", indent.c_str());
106 if (fDDLTarget) {
107 SkString proxyStr = fDDLTarget->dump();
108 SkDebugf("%s", proxyStr.c_str());
109 }
110 SkDebugf("\n");
111
112 SkDebugf("%s%d sub-tasks\n", indent.c_str(), fDDL->priv().numRenderTasks());
113
114 SkString subIndent(indent);
115 subIndent.append(" ");
116
117 int index = 0;
118 for (auto& task : fDDL->priv().renderTasks()) {
119 SkString subLabel;
120 subLabel.printf("sub-task %d/%d", index++, fDDL->priv().numRenderTasks());
121 task->dump(subLabel, subIndent, printDependencies, true);
122 }
123
124 if (close) {
125 SkDebugf("%s--------------------------------------------------------------\n\n",
126 indent.c_str());
127 }
128}
129#endif
#define SkASSERT(cond)
Definition: SkAssert.h:116
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static void dump(const float m[20], SkYUVColorSpace cs, bool rgb2yuv)
Definition: SkYUVMath.cpp:629
GrDDLTask(GrDrawingManager *, sk_sp< GrRenderTargetProxy > ddlTarget, sk_sp< const GrDeferredDisplayList >)
Definition: GrDDLTask.cpp:15
~GrDDLTask() override
Definition: GrDDLTask.cpp:33
void disown(GrDrawingManager *) override
Definition: GrDDLTask.cpp:43
void endFlush(GrDrawingManager *) override
Definition: GrDDLTask.cpp:35
const skia_private::TArray< sk_sp< GrRenderTask > > & renderTasks() const
GrDeferredDisplayListPriv priv()
void setLastRenderTask(const GrSurfaceProxy *, GrRenderTask *)
void setFlag(uint32_t flag)
Definition: GrRenderTask.h:200
virtual void disown(GrDrawingManager *)
virtual void endFlush(GrDrawingManager *)
Definition: GrRenderTask.h:49
@ kClosed_Flag
This task can't accept any more dependencies.
Definition: GrRenderTask.h:190
void printf(const char format[],...) SK_PRINTF_LIKE(2
Definition: SkString.cpp:534
const char * c_str() const
Definition: SkString.h:133
T * get() const
Definition: SkRefCnt.h:303
Definition: ref_ptr.h:256
Definition: SkRect.h:32