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/vk/GrVkResourceProvider.cpp b/src/gpu/vk/GrVkResourceProvider.cpp
index bcf2768..75f1a25 100644
--- a/src/gpu/vk/GrVkResourceProvider.cpp
+++ b/src/gpu/vk/GrVkResourceProvider.cpp
@@ -22,7 +22,7 @@
GrVkResourceProvider::GrVkResourceProvider(GrVkGpu* gpu)
: fGpu(gpu)
, fPipelineCache(VK_NULL_HANDLE) {
- fPipelineStateCache = new PipelineStateCache(gpu);
+ fPipelineStateCache = sk_make_sp<PipelineStateCache>(gpu);
}
GrVkResourceProvider::~GrVkResourceProvider() {
@@ -30,7 +30,6 @@
SkASSERT(0 == fExternalRenderPasses.count());
SkASSERT(0 == fMSAALoadPipelines.count());
SkASSERT(VK_NULL_HANDLE == fPipelineCache);
- delete fPipelineStateCache;
}
VkPipelineCache GrVkResourceProvider::pipelineCache() {
@@ -266,14 +265,14 @@
const GrProgramDesc& desc,
const GrProgramInfo& programInfo,
VkRenderPass compatibleRenderPass,
- GrGpu::Stats::ProgramCacheResult* stat) {
+ GrThreadSafePipelineBuilder::Stats::ProgramCacheResult* stat) {
auto tmp = fPipelineStateCache->findOrCreatePipelineState(desc, programInfo,
compatibleRenderPass, stat);
if (!tmp) {
- fGpu->stats()->incNumPreCompilationFailures();
+ fPipelineStateCache->stats()->incNumPreCompilationFailures();
} else {
- fGpu->stats()->incNumPreProgramCacheResult(*stat);
+ fPipelineStateCache->stats()->incNumPreProgramCacheResult(*stat);
}
return tmp;