Move auditTrail and opMemoryPool from GrContext to GrRecordingContext
Any context that records ops (i.e., direct and/or DDL) will need these two objects.
Change-Id: Ifd3527c23a4015f7d469ad2222563508cccbd339
Reviewed-on: https://skia-review.googlesource.com/c/190307
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrRecordingContext.cpp b/src/gpu/GrRecordingContext.cpp
index 1067950..6edfd65 100644
--- a/src/gpu/GrRecordingContext.cpp
+++ b/src/gpu/GrRecordingContext.cpp
@@ -8,6 +8,7 @@
#include "GrRecordingContext.h"
#include "GrCaps.h"
+#include "GrMemoryPool.h"
#include "GrRecordingContextPriv.h"
#include "GrSkSLFPFactoryCache.h"
@@ -19,6 +20,23 @@
GrRecordingContext::~GrRecordingContext() { }
+sk_sp<GrOpMemoryPool> GrRecordingContext::refOpMemoryPool() {
+ if (!fOpMemoryPool) {
+ // DDL TODO: should the size of the memory pool be decreased in DDL mode? CPU-side memory
+ // consumed in DDL mode vs. normal mode for a single skp might be a good metric of wasted
+ // memory.
+ fOpMemoryPool = sk_sp<GrOpMemoryPool>(new GrOpMemoryPool(16384, 16384));
+ }
+
+ SkASSERT(fOpMemoryPool);
+ return fOpMemoryPool;
+}
+
+GrOpMemoryPool* GrRecordingContext::opMemoryPool() {
+ return this->refOpMemoryPool().get();
+}
+
+
///////////////////////////////////////////////////////////////////////////////////////////////////
sk_sp<const GrCaps> GrRecordingContextPriv::refCaps() const {
return fContext->refCaps();
@@ -27,3 +45,7 @@
sk_sp<GrSkSLFPFactoryCache> GrRecordingContextPriv::fpFactoryCache() {
return fContext->fpFactoryCache();
}
+
+sk_sp<GrOpMemoryPool> GrRecordingContextPriv::refOpMemoryPool() {
+ return fContext->refOpMemoryPool();
+}