Remove drop-work-before-color-clear while we fix a bug
The current way that we handle merging-with-color-clear ops
tasks has a bug. For the time being, just leave them in and
accept the wasted work. A real fix is on the way.
Bug: skia:11903
Change-Id: I0e2b60a3f9a10be1010b41f905a879b65e9172a5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/400620
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
diff --git a/src/gpu/GrOpsTask.cpp b/src/gpu/GrOpsTask.cpp
index 2fa88c2..7faa401 100644
--- a/src/gpu/GrOpsTask.cpp
+++ b/src/gpu/GrOpsTask.cpp
@@ -683,8 +683,6 @@
}
int GrOpsTask::mergeFrom(SkSpan<const sk_sp<GrRenderTask>> tasks) {
- // Find the index of the last color-clearing task. -1 indicates this or "there are none."
- int indexOfLastColorClear = -1;
int mergedCount = 0;
for (const sk_sp<GrRenderTask>& task : tasks) {
auto opsTask = task->asOpsTask();
@@ -695,7 +693,9 @@
SkASSERT(fTargetSwizzle == opsTask->fTargetSwizzle);
SkASSERT(fTargetOrigin == opsTask->fTargetOrigin);
if (GrLoadOp::kClear == opsTask->fColorLoadOp) {
- indexOfLastColorClear = &task - tasks.begin();
+ // TODO(11903): Go back to actually dropping ops tasks when we are merged with
+ // color clear.
+ return 0;
}
mergedCount += 1;
}
@@ -705,24 +705,6 @@
SkSpan<const sk_sp<GrOpsTask>> opsTasks(
reinterpret_cast<const sk_sp<GrOpsTask>*>(tasks.data()), SkToSizeT(mergedCount));
- if (indexOfLastColorClear >= 0) {
- // If any dropped task needs to preserve stencil, for now just bail on the merge.
- // Could keep the merge and insert a clear op, but might be tricky due to closed task.
- if (fMustPreserveStencil) {
- return 0;
- }
- for (const auto& opsTask : opsTasks.first(indexOfLastColorClear)) {
- if (opsTask->fMustPreserveStencil) {
- return 0;
- }
- }
- // Clear `this` and forget about the tasks pre-color-clear.
- this->reset();
- opsTasks = opsTasks.last(opsTasks.count() - indexOfLastColorClear);
- // Copy the color-clear into `this`.
- fColorLoadOp = GrLoadOp::kClear;
- fLoadClearColor = opsTasks.front()->fLoadClearColor;
- }
int addlDeferredProxyCount = 0;
int addlProxyCount = 0;
int addlOpChainCount = 0;