Add GrThreadSafePipelineBuilder
GrThreadSafePipelineBuilder is the generic, base object the
GrContextThreadSafeProxy will hold. Each backend will create a
backend-specific version that is shared between the direct context
and the (possibly many) utility contexts.
Right now GrThreadSafePipelineBuilder just holds the pipeline
creation stats. Relatedly only GrGLGpu::ProgramCache and
GrVkResourceProvider::PipelineStateCache currently derive from
the new class (since they are the only backends that generate
pipeline stats).
Change-Id: I58f441c5c2b870bb5970c29cba19d1775864d52e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378320
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrContextThreadSafeProxy.cpp b/src/gpu/GrContextThreadSafeProxy.cpp
index 16b1847..2c3a221 100644
--- a/src/gpu/GrContextThreadSafeProxy.cpp
+++ b/src/gpu/GrContextThreadSafeProxy.cpp
@@ -14,6 +14,7 @@
#include "src/gpu/GrBaseContextPriv.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrThreadSafeCache.h"
+#include "src/gpu/GrThreadSafePipelineBuilder.h"
#include "src/gpu/effects/GrSkSLFP.h"
#include "src/image/SkSurface_Gpu.h"
@@ -37,10 +38,12 @@
GrContextThreadSafeProxy::~GrContextThreadSafeProxy() = default;
-void GrContextThreadSafeProxy::init(sk_sp<const GrCaps> caps) {
+void GrContextThreadSafeProxy::init(sk_sp<const GrCaps> caps,
+ sk_sp<GrThreadSafePipelineBuilder> pipelineBuilder) {
fCaps = std::move(caps);
fTextBlobCache = std::make_unique<GrTextBlobCache>(fContextID);
fThreadSafeCache = std::make_unique<GrThreadSafeCache>();
+ fPipelineBuilder = std::move(pipelineBuilder);
}
SkSurfaceCharacterization GrContextThreadSafeProxy::createCharacterization(
@@ -167,3 +170,8 @@
return sk_sp<GrContextThreadSafeProxy>(new GrContextThreadSafeProxy(backend, options));
}
+void GrContextThreadSafeProxyPriv::init(sk_sp<const GrCaps> caps,
+ sk_sp<GrThreadSafePipelineBuilder> builder) const {
+ fProxy->init(std::move(caps), std::move(builder));
+}
+