Add GrTextBlobAllocator to GrRecordingContext
Change-Id: I284d13b0ac9a7a11296ce06b5812ee1fb3a9075d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/383757 Reviewed-by: Herb Derby <herb@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
parent
43e73df990
commit
6679eb9786
@ -21,6 +21,7 @@ class GrProgramDesc;
|
||||
class GrProgramInfo;
|
||||
class GrProxyProvider;
|
||||
class GrRecordingContextPriv;
|
||||
class GrSubRunAllocator;
|
||||
class GrSurfaceContext;
|
||||
class GrSurfaceProxy;
|
||||
class GrTextBlobCache;
|
||||
@ -95,7 +96,7 @@ public:
|
||||
// GrRecordingContext. Arenas does not maintain ownership of the pools it groups together.
|
||||
class Arenas {
|
||||
public:
|
||||
Arenas(GrMemoryPool*, SkArenaAlloc*);
|
||||
Arenas(GrMemoryPool*, SkArenaAlloc*, GrSubRunAllocator*);
|
||||
|
||||
// For storing GrOp-derived classes recorded by a GrRecordingContext
|
||||
GrMemoryPool* opMemoryPool() { return fOpMemoryPool; }
|
||||
@ -103,9 +104,13 @@ public:
|
||||
// For storing pipelines and other complex data as-needed by ops
|
||||
SkArenaAlloc* recordTimeAllocator() { return fRecordTimeAllocator; }
|
||||
|
||||
// For storing GrTextBlob SubRuns
|
||||
GrSubRunAllocator* recordTimeSubRunAllocator() { return fRecordTimeSubRunAllocator; }
|
||||
|
||||
private:
|
||||
GrMemoryPool* fOpMemoryPool;
|
||||
SkArenaAlloc* fRecordTimeAllocator;
|
||||
GrSubRunAllocator* fRecordTimeSubRunAllocator;
|
||||
};
|
||||
|
||||
protected:
|
||||
@ -126,6 +131,7 @@ protected:
|
||||
private:
|
||||
std::unique_ptr<GrMemoryPool> fOpMemoryPool;
|
||||
std::unique_ptr<SkArenaAlloc> fRecordTimeAllocator;
|
||||
std::unique_ptr<GrSubRunAllocator> fRecordTimeSubRunAllocator;
|
||||
};
|
||||
|
||||
GrRecordingContext(sk_sp<GrContextThreadSafeProxy>);
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "src/gpu/SkGr.h"
|
||||
#include "src/gpu/effects/GrSkSLFP.h"
|
||||
#include "src/gpu/ops/GrAtlasTextOp.h"
|
||||
#include "src/gpu/text/GrTextBlob.h"
|
||||
#include "src/gpu/text/GrTextBlobCache.h"
|
||||
|
||||
GrRecordingContext::ProgramData::ProgramData(std::unique_ptr<const GrProgramDesc> desc,
|
||||
@ -95,12 +96,16 @@ void GrRecordingContext::destroyDrawingManager() {
|
||||
fDrawingManager.reset();
|
||||
}
|
||||
|
||||
GrRecordingContext::Arenas::Arenas(GrMemoryPool* opMemoryPool, SkArenaAlloc* recordTimeAllocator)
|
||||
GrRecordingContext::Arenas::Arenas(GrMemoryPool* opMemoryPool,
|
||||
SkArenaAlloc* recordTimeAllocator,
|
||||
GrSubRunAllocator* subRunAllocator)
|
||||
: fOpMemoryPool(opMemoryPool)
|
||||
, fRecordTimeAllocator(recordTimeAllocator) {
|
||||
, fRecordTimeAllocator(recordTimeAllocator)
|
||||
, fRecordTimeSubRunAllocator(subRunAllocator) {
|
||||
// OwnedArenas should instantiate these before passing the bare pointer off to this struct.
|
||||
SkASSERT(opMemoryPool);
|
||||
SkASSERT(recordTimeAllocator);
|
||||
SkASSERT(subRunAllocator);
|
||||
}
|
||||
|
||||
// Must be defined here so that std::unique_ptr can see the sizes of the various pools, otherwise
|
||||
@ -127,7 +132,11 @@ GrRecordingContext::Arenas GrRecordingContext::OwnedArenas::get() {
|
||||
fRecordTimeAllocator = std::make_unique<SkArenaAlloc>(sizeof(GrPipeline) * 100);
|
||||
}
|
||||
|
||||
return {fOpMemoryPool.get(), fRecordTimeAllocator.get()};
|
||||
if (!fRecordTimeSubRunAllocator) {
|
||||
fRecordTimeSubRunAllocator = std::make_unique<GrSubRunAllocator>();
|
||||
}
|
||||
|
||||
return {fOpMemoryPool.get(), fRecordTimeAllocator.get(), fRecordTimeSubRunAllocator.get()};
|
||||
}
|
||||
|
||||
GrRecordingContext::OwnedArenas&& GrRecordingContext::detachArenas() {
|
||||
|
@ -43,6 +43,9 @@ public:
|
||||
|
||||
GrMemoryPool* opMemoryPool() { return fContext->arenas().opMemoryPool(); }
|
||||
SkArenaAlloc* recordTimeAllocator() { return fContext->arenas().recordTimeAllocator(); }
|
||||
GrSubRunAllocator* recordTimeSubRunAllocator() {
|
||||
return fContext->arenas().recordTimeSubRunAllocator();
|
||||
}
|
||||
GrRecordingContext::Arenas arenas() { return fContext->arenas(); }
|
||||
|
||||
GrRecordingContext::OwnedArenas&& detachArenas() { return fContext->detachArenas(); }
|
||||
|
Loading…
Reference in New Issue
Block a user