Allow CCPR in DDL mode (take 2)
A lot of the changes to get this compiling on the
win_chromium_compile_dbg_ng bot (i.e., moving a lot of header files to
private) should be undone if that bot is ever "fixed".
Bug: skia:7988
Change-Id: I704ff793d80b18e7312048538874498824803580
Reviewed-on: https://skia-review.googlesource.com/130920
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ccpr/GrCoverageCountingPathRenderer.h b/src/gpu/ccpr/GrCoverageCountingPathRenderer.h
index d101866..4032bd5 100644
--- a/src/gpu/ccpr/GrCoverageCountingPathRenderer.h
+++ b/src/gpu/ccpr/GrCoverageCountingPathRenderer.h
@@ -8,38 +8,15 @@
#ifndef GrCoverageCountingPathRenderer_DEFINED
#define GrCoverageCountingPathRenderer_DEFINED
+#include "GrCCPerOpListPaths.h"
#include "GrPathRenderer.h"
#include "GrRenderTargetOpList.h"
-#include "SkArenaAlloc.h"
-#include "SkTInternalLList.h"
-#include "ccpr/GrCCClipPath.h"
#include "ccpr/GrCCPerFlushResources.h"
#include <map>
class GrCCDrawPathsOp;
/**
- * Tracks all the paths in a given opList that will be drawn when it flushes.
- */
-struct GrCCPerOpListPaths {
- ~GrCCPerOpListPaths() {
- // Ensure there are no surviving DrawPathsOps with a dangling pointer into this class.
- if (!fDrawOps.isEmpty()) {
- SK_ABORT("GrCCDrawPathsOp(s) not deleted during flush");
- }
- // Clip lazy proxies also reference this class from their callbacks, but those callbacks
- // are only invoked at flush time while we are still alive. (Unlike DrawPathsOps, that
- // unregister themselves upon destruction.) So it shouldn't matter if any clip proxies
- // are still around.
- }
-
- SkTInternalLList<GrCCDrawPathsOp> fDrawOps;
- std::map<uint32_t, GrCCClipPath> fClipPaths;
- SkSTArenaAlloc<10 * 1024> fAllocator{10 * 1024 * 2};
- sk_sp<const GrCCPerFlushResources> fFlushResources;
-};
-
-/**
* This is a path renderer that draws antialiased paths by counting coverage in an offscreen
* buffer. (See GrCCCoverageProcessor, GrCCPathProcessor.)
*
@@ -57,17 +34,23 @@
SkASSERT(!fFlushing);
}
- using PendingPathsMap = std::map<uint32_t, std::unique_ptr<GrCCPerOpListPaths>>;
+ using PendingPathsMap = std::map<uint32_t, sk_sp<GrCCPerOpListPaths>>;
// In DDL mode, Ganesh needs to be able to move the pending GrCCPerOpListPaths to the DDL object
// (detachPendingPaths) and then return them upon replay (mergePendingPaths).
PendingPathsMap detachPendingPaths() { return std::move(fPendingPaths); }
- void mergePendingPaths(PendingPathsMap&& paths) {
+ void mergePendingPaths(const PendingPathsMap& paths) {
+#ifdef SK_DEBUG
// Ensure there are no duplicate opList IDs between the incoming path map and ours.
- SkDEBUGCODE(for (const auto& it : paths) SkASSERT(!fPendingPaths.count(it.first)));
- fPendingPaths.insert(std::make_move_iterator(paths.begin()),
- std::make_move_iterator(paths.end()));
+ // This should always be true since opList IDs are globally unique and these are coming
+ // from different DDL recordings.
+ for (const auto& it : paths) {
+ SkASSERT(!fPendingPaths.count(it.first));
+ }
+#endif
+
+ fPendingPaths.insert(paths.begin(), paths.end());
}
// GrPathRenderer overrides.
@@ -101,7 +84,7 @@
// fFlushingPaths holds the GrCCPerOpListPaths objects that are currently being flushed.
// (It will only contain elements when fFlushing is true.)
- SkSTArray<4, std::unique_ptr<GrCCPerOpListPaths>> fFlushingPaths;
+ SkSTArray<4, sk_sp<GrCCPerOpListPaths>> fFlushingPaths;
SkDEBUGCODE(bool fFlushing = false);
const bool fDrawCachablePaths;