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/GrVkPipelineStateCache.cpp b/src/gpu/vk/GrVkPipelineStateCache.cpp
index 7aa080e..3d3fb23 100644
--- a/src/gpu/vk/GrVkPipelineStateCache.cpp
+++ b/src/gpu/vk/GrVkPipelineStateCache.cpp
@@ -50,13 +50,13 @@
// dump stats
#ifdef SK_DEBUG
if (c_DisplayVkPipelineCache) {
- using CacheResult = GrGpu::Stats::ProgramCacheResult;
+ using CacheResult = Stats::ProgramCacheResult;
- int misses = fGpu->stats()->numInlineProgramCacheResult(CacheResult::kMiss) +
- fGpu->stats()->numPreProgramCacheResult(CacheResult::kMiss);
+ int misses = fStats.numInlineProgramCacheResult(CacheResult::kMiss) +
+ fStats.numPreProgramCacheResult(CacheResult::kMiss);
- int total = misses + fGpu->stats()->numInlineProgramCacheResult(CacheResult::kHit) +
- fGpu->stats()->numPreProgramCacheResult(CacheResult::kHit);
+ int total = misses + fStats.numInlineProgramCacheResult(CacheResult::kHit) +
+ fStats.numPreProgramCacheResult(CacheResult::kHit);
SkDebugf("--- Pipeline State Cache ---\n");
SkDebugf("Total requests: %d\n", total);
@@ -94,14 +94,14 @@
return nullptr;
}
- GrGpu::Stats::ProgramCacheResult stat;
+ Stats::ProgramCacheResult stat;
auto tmp = this->findOrCreatePipelineState(renderTarget, desc, programInfo,
compatibleRenderPass, overrideSubpassForResolveLoad,
&stat);
if (!tmp) {
- fGpu->stats()->incNumInlineCompilationFailures();
+ fStats.incNumInlineCompilationFailures();
} else {
- fGpu->stats()->incNumInlineProgramCacheResult(stat);
+ fStats.incNumInlineProgramCacheResult(stat);
}
return tmp;
@@ -113,15 +113,15 @@
const GrProgramInfo& programInfo,
VkRenderPass compatibleRenderPass,
bool overrideSubpassForResolveLoad,
- GrGpu::Stats::ProgramCacheResult* stat) {
+ Stats::ProgramCacheResult* stat) {
if (stat) {
- *stat = GrGpu::Stats::ProgramCacheResult::kHit;
+ *stat = Stats::ProgramCacheResult::kHit;
}
std::unique_ptr<Entry>* entry = fMap.find(desc);
if (!entry) {
if (stat) {
- *stat = GrGpu::Stats::ProgramCacheResult::kMiss;
+ *stat = Stats::ProgramCacheResult::kMiss;
}
GrVkPipelineState* pipelineState(GrVkPipelineStateBuilder::CreatePipelineState(
fGpu, renderTarget, desc, programInfo, compatibleRenderPass,