Restore code that sets preserve stencil when breaking up SDC into
multiple opstasks.
Accidentally removed in:
https://skia-review.googlesource.com/c/skia/+/341680
Change-Id: Ic526c4ab0043c91c0446df679bfff46c00e861af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/400536
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrSurfaceDrawContext.cpp b/src/gpu/GrSurfaceDrawContext.cpp
index 3363976..d8504cf 100644
--- a/src/gpu/GrSurfaceDrawContext.cpp
+++ b/src/gpu/GrSurfaceDrawContext.cpp
@@ -307,6 +307,17 @@
ASSERT_SINGLE_OWNER
}
+void GrSurfaceDrawContext::willReplaceOpsTask(GrOpsTask* prevTask, GrOpsTask* nextTask) {
+ if (prevTask && fNeedsStencil) {
+ // Store the stencil values in memory upon completion of fOpsTask.
+ prevTask->setMustPreserveStencil();
+ // Reload the stencil buffer content at the beginning of newOpsTask.
+ // FIXME: Could the topo sort insert a task between these two that modifies the stencil
+ // values?
+ nextTask->setInitialStencilContent(GrOpsTask::StencilContent::kPreserved);
+ }
+}
+
inline GrAAType GrSurfaceDrawContext::chooseAAType(GrAA aa) {
if (GrAA::kNo == aa) {
// On some devices we cannot disable MSAA if it is enabled so we make the AA type reflect