aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/gpu/GrDrawingManager.cpp18
-rw-r--r--src/gpu/GrDrawingManager.h5
-rw-r--r--src/gpu/GrOnFlushResourceProvider.h4
-rw-r--r--src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp3
-rw-r--r--src/gpu/ccpr/GrCoverageCountingPathRenderer.h2
-rw-r--r--src/gpu/ops/GrSmallPathRenderer.h3
-rw-r--r--src/gpu/text/GrAtlasGlyphCache.h3
7 files changed, 23 insertions, 15 deletions
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index e42b5f48e4..d95a2c5c70 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -140,16 +140,14 @@ GrSemaphoresSubmitted GrDrawingManager::internalFlush(GrSurfaceProxy*,
// Prepare any onFlush op lists (e.g. atlases).
if (!fOnFlushCBObjects.empty()) {
- // MDB TODO: pre-MDB '1' is the correct pre-allocated size. Post-MDB it will need
- // to be larger.
- SkAutoSTArray<1, uint32_t> opListIds(fOpLists.count());
+ fFlushingOpListIDs.reset(fOpLists.count());
for (int i = 0; i < fOpLists.count(); ++i) {
- opListIds[i] = fOpLists[i]->uniqueID();
+ fFlushingOpListIDs[i] = fOpLists[i]->uniqueID();
}
SkSTArray<4, sk_sp<GrRenderTargetContext>> renderTargetContexts;
for (GrOnFlushCallbackObject* onFlushCBObject : fOnFlushCBObjects) {
onFlushCBObject->preFlush(&onFlushProvider,
- opListIds.get(), opListIds.count(),
+ fFlushingOpListIDs.begin(), fFlushingOpListIDs.count(),
&renderTargetContexts);
for (const sk_sp<GrRenderTargetContext>& rtc : renderTargetContexts) {
sk_sp<GrOpList> onFlushOpList = sk_ref_sp(rtc->getOpList());
@@ -158,7 +156,7 @@ GrSemaphoresSubmitted GrDrawingManager::internalFlush(GrSurfaceProxy*,
}
onFlushOpList->makeClosed(*fContext->caps());
onFlushOpList->prepare(&fFlushState);
- fOnFlushOpLists.push_back(std::move(onFlushOpList));
+ fOnFlushCBOpLists.push_back(std::move(onFlushOpList));
}
renderTargetContexts.reset();
}
@@ -204,8 +202,10 @@ GrSemaphoresSubmitted GrDrawingManager::internalFlush(GrSurfaceProxy*,
fContext->getResourceCache()->notifyFlushOccurred(type);
}
for (GrOnFlushCallbackObject* onFlushCBObject : fOnFlushCBObjects) {
- onFlushCBObject->postFlush(fFlushState.nextTokenToFlush());
+ onFlushCBObject->postFlush(fFlushState.nextTokenToFlush(), fFlushingOpListIDs.begin(),
+ fFlushingOpListIDs.count());
}
+ fFlushingOpListIDs.reset();
fFlushing = false;
return result;
@@ -241,14 +241,14 @@ bool GrDrawingManager::executeOpLists(int startIndex, int stopIndex, GrOpFlushSt
flushState->preExecuteDraws();
// Execute the onFlush op lists first, if any.
- for (sk_sp<GrOpList>& onFlushOpList : fOnFlushOpLists) {
+ for (sk_sp<GrOpList>& onFlushOpList : fOnFlushCBOpLists) {
if (!onFlushOpList->execute(flushState)) {
SkDebugf("WARNING: onFlushOpList failed to execute.\n");
}
SkASSERT(onFlushOpList->unique());
onFlushOpList = nullptr;
}
- fOnFlushOpLists.reset();
+ fOnFlushCBOpLists.reset();
// Execute the normal op lists.
for (int i = startIndex; i < stopIndex; ++i) {
diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h
index cc70d93e0d..fc17c69d3e 100644
--- a/src/gpu/GrDrawingManager.h
+++ b/src/gpu/GrDrawingManager.h
@@ -131,7 +131,10 @@ private:
bool fAbandoned;
SkTArray<sk_sp<GrOpList>> fOpLists;
- SkSTArray<8, sk_sp<GrOpList>> fOnFlushOpLists;
+ // These are the IDs of the opLists currently being flushed (in internalFlush)
+ SkSTArray<8, uint32_t, true> fFlushingOpListIDs;
+ // These are the new opLists generated by the onFlush CBs
+ SkSTArray<8, sk_sp<GrOpList>> fOnFlushCBOpLists;
std::unique_ptr<GrAtlasTextContext> fAtlasTextContext;
diff --git a/src/gpu/GrOnFlushResourceProvider.h b/src/gpu/GrOnFlushResourceProvider.h
index cfd527e7f2..e16bb57aef 100644
--- a/src/gpu/GrOnFlushResourceProvider.h
+++ b/src/gpu/GrOnFlushResourceProvider.h
@@ -9,6 +9,7 @@
#define GrOnFlushResourceProvider_DEFINED
#include "GrTypes.h"
+#include "GrDeferredUpload.h"
#include "GrOpFlushState.h"
#include "GrResourceProvider.h"
#include "SkRefCnt.h"
@@ -46,7 +47,8 @@ public:
* Called once flushing is complete and all ops indicated by preFlush have been executed and
* released. startTokenForNextFlush can be used to track resources used in the current flush.
*/
- virtual void postFlush(GrDeferredUploadToken startTokenForNextFlush) {}
+ virtual void postFlush(GrDeferredUploadToken startTokenForNextFlush,
+ const uint32_t* opListIDs, int numOpListIDs) {}
/**
* Tells the callback owner to hold onto this object when freeing GPU resources
diff --git a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
index b4eb89a1a3..40fb5a9cbd 100644
--- a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
+++ b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
@@ -419,7 +419,8 @@ void DrawPathsOp::onExecute(GrOpFlushState* flushState) {
SkASSERT(baseInstance == fBaseInstance + fDebugInstanceCount - fDebugSkippedInstances);
}
-void GrCoverageCountingPathRenderer::postFlush(GrDeferredUploadToken) {
+void GrCoverageCountingPathRenderer::postFlush(GrDeferredUploadToken, const uint32_t* opListIDs,
+ int numOpListIDs) {
SkASSERT(fFlushing);
fPerFlushAtlases.reset();
fPerFlushInstanceBuffer.reset();
diff --git a/src/gpu/ccpr/GrCoverageCountingPathRenderer.h b/src/gpu/ccpr/GrCoverageCountingPathRenderer.h
index a6295a5a7c..08b27a3edb 100644
--- a/src/gpu/ccpr/GrCoverageCountingPathRenderer.h
+++ b/src/gpu/ccpr/GrCoverageCountingPathRenderer.h
@@ -51,7 +51,7 @@ public:
// GrOnFlushCallbackObject overrides.
void preFlush(GrOnFlushResourceProvider*, const uint32_t* opListIDs, int numOpListIDs,
SkTArray<sk_sp<GrRenderTargetContext>>* results) override;
- void postFlush(GrDeferredUploadToken) override;
+ void postFlush(GrDeferredUploadToken, const uint32_t* opListIDs, int numOpListIDs) override;
// This is the Op that ultimately draws a path into its final destination, using the atlas we
// generate at flush time.
diff --git a/src/gpu/ops/GrSmallPathRenderer.h b/src/gpu/ops/GrSmallPathRenderer.h
index 8794f1b42c..b4fba10943 100644
--- a/src/gpu/ops/GrSmallPathRenderer.h
+++ b/src/gpu/ops/GrSmallPathRenderer.h
@@ -36,7 +36,8 @@ public:
void preFlush(GrOnFlushResourceProvider*, const uint32_t*, int,
SkTArray<sk_sp<GrRenderTargetContext>>*) override {}
- void postFlush(GrDeferredUploadToken startTokenForNextFlush) override {
+ void postFlush(GrDeferredUploadToken startTokenForNextFlush,
+ const uint32_t* opListIDs, int numOpListIDs) override {
if (fAtlas) {
fAtlas->compact(startTokenForNextFlush);
}
diff --git a/src/gpu/text/GrAtlasGlyphCache.h b/src/gpu/text/GrAtlasGlyphCache.h
index a75ef53b09..223ed6e69f 100644
--- a/src/gpu/text/GrAtlasGlyphCache.h
+++ b/src/gpu/text/GrAtlasGlyphCache.h
@@ -187,7 +187,8 @@ public:
void preFlush(GrOnFlushResourceProvider*, const uint32_t*, int,
SkTArray<sk_sp<GrRenderTargetContext>>*) override {}
- void postFlush(GrDeferredUploadToken startTokenForNextFlush) override {
+ void postFlush(GrDeferredUploadToken startTokenForNextFlush,
+ const uint32_t* opListIDs, int numOpListIDs) override {
for (int i = 0; i < kMaskFormatCount; ++i) {
if (fAtlases[i]) {
fAtlases[i]->compact(startTokenForNextFlush);