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/GrDirectContextPriv.cpp b/src/gpu/GrDirectContextPriv.cpp
index 9d03432..cf96536 100644
--- a/src/gpu/GrDirectContextPriv.cpp
+++ b/src/gpu/GrDirectContextPriv.cpp
@@ -17,6 +17,7 @@
#include "src/gpu/GrSurfaceContext.h"
#include "src/gpu/GrSurfaceDrawContext.h"
#include "src/gpu/GrTexture.h"
+#include "src/gpu/GrThreadSafePipelineBuilder.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/effects/GrSkSLFP.h"
#include "src/gpu/effects/generated/GrConfigConversionEffect.h"
@@ -112,14 +113,20 @@
void GrDirectContextPriv::dumpGpuStats(SkString* out) const {
#if GR_GPU_STATS
- return fContext->fGpu->stats()->dump(out);
+ fContext->fGpu->stats()->dump(out);
+ if (auto builder = fContext->fGpu->pipelineBuilder()) {
+ builder->stats()->dump(out);
+ }
#endif
}
void GrDirectContextPriv::dumpGpuStatsKeyValuePairs(SkTArray<SkString>* keys,
SkTArray<double>* values) const {
#if GR_GPU_STATS
- return fContext->fGpu->stats()->dumpKeyValuePairs(keys, values);
+ fContext->fGpu->stats()->dumpKeyValuePairs(keys, values);
+ if (auto builder = fContext->fGpu->pipelineBuilder()) {
+ builder->stats()->dumpKeyValuePairs(keys, values);
+ }
#endif
}