Simplify GrResourceAllocator API
There's really only one failure at this point, and it's a failed
instantiation. The original intention of the allocation failure
system was to only drop the ops that referred to the uninstantiated
proxies, but somewhere along the way that was lost and
we started dropping arbitrarily large chunks of ops. Lets just
bail and not crash instead.
Bug: skia:10877
Change-Id: I675358e8a1fbd2d75ea29b72ccfc50c7df90343e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371337
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 628d0fe..3bc1b7d 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -211,29 +211,9 @@
task->gatherProxyIntervals(&alloc);
}
- GrResourceAllocator::AssignError error = GrResourceAllocator::AssignError::kNoError;
- alloc.assign(&error);
- if (GrResourceAllocator::AssignError::kFailedProxyInstantiation == error) {
- for (const auto& renderTask : fDAG) {
- SkASSERT(renderTask);
- if (!renderTask->isInstantiated()) {
- // No need to call the renderTask's handleInternalAllocationFailure
- // since we will already skip executing the renderTask since it is not
- // instantiated.
- continue;
- }
- // TODO: If we're going to remove all the render tasks do we really need this call?
- renderTask->handleInternalAllocationFailure();
- }
- this->removeRenderTasks();
- }
-
- if (this->executeRenderTasks(&flushState)) {
- flushed = true;
- }
+ flushed = alloc.assign() && this->executeRenderTasks(&flushState);
}
-
- SkASSERT(fDAG.empty());
+ this->removeRenderTasks();
#ifdef SK_DEBUG
// In non-DDL mode this checks that all the flushed ops have been freed from the memory pool.
@@ -351,8 +331,6 @@
// resources are the last to be purged by the resource cache.
flushState->reset();
- this->removeRenderTasks();
-
return anyRenderTasksExecuted;
}