Fix bug in GrClearOp combining and remove some asserts (take 2)
The buffer combining code path was combining the ops but never
telling the external system that the second op could be removed.
Bug: skia:10963
Change-Id: I887ebda91673d37139ebc7fc427e80a55b9d9bd1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340101
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ops/GrClearOp.cpp b/src/gpu/ops/GrClearOp.cpp
index 946ae31..94ccff6 100644
--- a/src/gpu/ops/GrClearOp.cpp
+++ b/src/gpu/ops/GrClearOp.cpp
@@ -66,14 +66,13 @@
// When the scissors are the exact same but the buffers are different, we can combine and
// clear both stencil and clear together in onExecute().
if (other->fBuffer & Buffer::kColor) {
- SkASSERT((fBuffer & Buffer::kStencilClip) && !(fBuffer & Buffer::kColor));
fColor = other->fColor;
}
if (other->fBuffer & Buffer::kStencilClip) {
- SkASSERT(!(fBuffer & Buffer::kStencilClip) && (fBuffer & Buffer::kColor));
fStencilInsideMask = other->fStencilInsideMask;
}
fBuffer = Buffer::kBoth;
+ return CombineResult::kMerged;
}
return CombineResult::kCannotCombine;
}
diff --git a/src/gpu/ops/GrClearOp.h b/src/gpu/ops/GrClearOp.h
index 5856e8a..4f3a13e 100644
--- a/src/gpu/ops/GrClearOp.h
+++ b/src/gpu/ops/GrClearOp.h
@@ -30,6 +30,8 @@
const char* name() const override { return "Clear"; }
+ const std::array<float, 4>& color() const { return fColor; }
+ bool stencilInsideMask() const { return fStencilInsideMask; }
private:
friend class GrOp; // for ctors