90 {
92
93 if (fFlushing || this->wasAbandoned()) {
94 if (
info.fSubmittedProc) {
95 info.fSubmittedProc(
info.fSubmittedContext,
false);
96 }
97 if (
info.fFinishedProc) {
98 info.fFinishedProc(
info.fFinishedContext);
99 }
100 return false;
101 }
102
103 SkDEBUGCODE(this->validate());
104
105
106 if (!proxies.
empty() && !
info.fNumSemaphores && !
info.fFinishedProc &&
109 bool used = std::any_of(fDAG.begin(), fDAG.end(), [&](auto& task) {
110 return task && task->isUsed(proxy);
111 });
112 return !used;
113 });
114 if (allUnused) {
115 if (
info.fSubmittedProc) {
116 info.fSubmittedProc(
info.fSubmittedContext,
true);
117 }
118 return false;
119 }
120 }
121
124 dContext->priv().clientMappedBufferManager()->process();
125
126 GrGpu* gpu = dContext->priv().getGpu();
127
129
130 fFlushing = true;
131
132 auto resourceProvider = dContext->priv().resourceProvider();
133 auto resourceCache = dContext->priv().getResourceCache();
134
135
136
137
138
139 this->closeAllTasks();
140 fActiveOpsTask = nullptr;
141
142 this->sortTasks();
143
144 if (!fCpuBufferCache) {
145
146
147
150 }
151
152 GrOpFlushState flushState(gpu, resourceProvider, &fTokenTracker, fCpuBufferCache);
153
155
156
157 bool preFlushSuccessful = true;
159 preFlushSuccessful &= onFlushCBObject->preFlush(&onFlushProvider);
160 }
161
162 bool cachePurgeNeeded = false;
163
164 if (preFlushSuccessful) {
165 bool usingReorderedDAG = false;
167 if (fReduceOpsTaskSplitting) {
168 usingReorderedDAG = this->reorderTasks(&resourceAllocator);
169 if (!usingReorderedDAG) {
170 resourceAllocator.reset();
171 }
172 }
173
174#if 0
175
176 SkDEBUGCODE(
SkDebugf(
"RenderTasks (%d):\n", fDAG.count()));
177 for (const auto& task : fDAG) {
178 SkDEBUGCODE(task->dump( true);)
179 }
180#endif
181
182 if (!resourceAllocator.failedInstantiation()) {
183 if (!usingReorderedDAG) {
184 for (const auto& task : fDAG) {
186 task->gatherProxyIntervals(&resourceAllocator);
187 }
188 resourceAllocator.planAssignment();
189 }
190 resourceAllocator.assign();
191 }
192
193 cachePurgeNeeded = !resourceAllocator.failedInstantiation() &&
194 this->executeRenderTasks(&flushState);
195 }
196 this->removeRenderTasks();
197
199
200
201 if (cachePurgeNeeded) {
202 resourceCache->purgeAsNeeded();
203 cachePurgeNeeded = false;
204 }
207 cachePurgeNeeded = true;
208 }
209 if (cachePurgeNeeded) {
210 resourceCache->purgeAsNeeded();
211 }
212 fFlushing = false;
213
214 return true;
215}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
#define GR_CREATE_TRACE_MARKER_CONTEXT(classname, op, context)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
const GrCaps * caps() const
static sk_sp< CpuBufferCache > Make(int maxBuffersToCache)
bool preferClientSideDynamicBuffers() const
virtual GrDirectContext * asDirectContext()
void executeFlushInfo(SkSpan< GrSurfaceProxy * >, SkSurfaces::BackendSurfaceAccess access, const GrFlushInfo &, const skgpu::MutableTextureState *newState)
GrRecordingContextPriv priv()
constexpr T * begin() const
constexpr T * end() const
constexpr bool empty() const
AtlasToken nextFlushToken() const
@ kNoAccess
back-end surface will not be used by client