Resolve issue with flush-time opsTask management
Despite what the bug says, I believe the only issue here was that
all the flush-time opsTasks weren't guaranteed to be in
'fOnFlushRenderTasks'. Since the users of flush-time opsTasks
use GrRenderTargetContext::addDrawOp, if the opsTask were to be
split, new ops would be added to the correct/new opsTask.
Bug: skia:9357
Change-Id: I90577bcc852419a9e0c31d858f71cda9f6f6b6a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/336435
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 3a54015..57e6c29 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -99,7 +99,7 @@
sk_sp<GrSurfaceProxy> proxy,
GrSurfaceOrigin origin,
const SkSurfaceProps* surfaceProps,
- bool managedOps) {
+ bool flushTimeOpsTask) {
if (!proxy) {
return nullptr;
}
@@ -116,7 +116,8 @@
return std::make_unique<GrRenderTargetContext>(context, std::move(readView),
std::move(writeView), colorType,
- std::move(colorSpace), surfaceProps, managedOps);
+ std::move(colorSpace), surfaceProps,
+ flushTimeOpsTask);
}
std::unique_ptr<GrRenderTargetContext> GrRenderTargetContext::Make(
@@ -148,7 +149,7 @@
}
auto rtc = GrRenderTargetContext::Make(context, colorType, std::move(colorSpace),
- std::move(proxy), origin, surfaceProps, true);
+ std::move(proxy), origin, surfaceProps);
if (!rtc) {
return nullptr;
}
@@ -301,12 +302,12 @@
GrColorType colorType,
sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps* surfaceProps,
- bool managedOpsTask)
+ bool flushTimeOpsTask)
: GrSurfaceContext(context, std::move(readView), colorType, kPremul_SkAlphaType,
std::move(colorSpace))
, fWriteView(std::move(writeView))
, fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps))
- , fManagedOpsTask(managedOpsTask)
+ , fFlushTimeOpsTask(flushTimeOpsTask)
, fGlyphPainter(*this) {
fOpsTask = sk_ref_sp(context->priv().drawingManager()->getLastOpsTask(this->asSurfaceProxy()));
SkASSERT(this->asSurfaceProxy() == fWriteView.proxy());
@@ -351,8 +352,8 @@
SkDEBUGCODE(this->validate();)
if (!fOpsTask || fOpsTask->isClosed()) {
- sk_sp<GrOpsTask> newOpsTask =
- this->drawingManager()->newOpsTask(this->writeSurfaceView(), fManagedOpsTask);
+ sk_sp<GrOpsTask> newOpsTask = this->drawingManager()->newOpsTask(this->writeSurfaceView(),
+ fFlushTimeOpsTask);
if (fOpsTask && fNumStencilSamples > 0) {
// Store the stencil values in memory upon completion of fOpsTask.
fOpsTask->setMustPreserveStencil();