24static const bool c_DisplayVkPipelineCache{
false};
42GrVkResourceProvider::PipelineStateCache::PipelineStateCache(
GrVkGpu* gpu)
43 : fMap(gpu->getContext()->
priv().
options().fRuntimeProgramCacheSize)
47GrVkResourceProvider::PipelineStateCache::~PipelineStateCache() {
51 if (c_DisplayVkPipelineCache) {
54 int misses = fStats.numInlineProgramCacheResult(CacheResult::kMiss) +
55 fStats.numPreProgramCacheResult(CacheResult::kMiss);
57 int total = misses + fStats.numInlineProgramCacheResult(CacheResult::kHit) +
58 fStats.numPreProgramCacheResult(CacheResult::kHit);
60 SkDebugf(
"--- Pipeline State Cache ---\n");
61 SkDebugf(
"Total requests: %d\n", total);
62 SkDebugf(
"Cache misses: %d\n", misses);
63 SkDebugf(
"Cache miss %%: %f\n", (total > 0) ? 100.f * misses / total : 0.0f);
68void GrVkResourceProvider::PipelineStateCache::release() {
72GrVkPipelineState* GrVkResourceProvider::PipelineStateCache::findOrCreatePipelineState(
75 VkRenderPass compatibleRenderPass,
76 bool overrideSubpassForResolveLoad) {
86 auto flags = overrideSubpassForResolveLoad
91 if (!
desc.isValid()) {
92 GrCapsDebugf(fGpu->caps(),
"Failed to build vk program descriptor!\n");
97 auto tmp = this->findOrCreatePipelineStateImpl(
desc, programInfo, compatibleRenderPass,
98 overrideSubpassForResolveLoad, &stat);
108GrVkPipelineState* GrVkResourceProvider::PipelineStateCache::findOrCreatePipelineStateImpl(
111 VkRenderPass compatibleRenderPass,
112 bool overrideSubpassForResolveLoad,
115 *stat = Stats::ProgramCacheResult::kHit;
118 std::unique_ptr<Entry>* entry = fMap.find(
desc);
121 *stat = Stats::ProgramCacheResult::kMiss;
124 fGpu,
desc, programInfo, compatibleRenderPass, overrideSubpassForResolveLoad));
125 if (!pipelineState) {
128 entry = fMap.insert(
desc, std::make_unique<Entry>(fGpu, pipelineState));
129 return (*entry)->fPipelineState.get();
131 return (*entry)->fPipelineState.get();
#define GrCapsDebugf(caps,...)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
@ kVulkanHasResolveLoadSubpass
bool isStencilEnabled() const
GrAttachment * getStencilAttachment(bool useMSAASurface) const
int numStencilBits(bool useMSAASurface) const
void incNumInlineCompilationFailures()
void incNumInlineProgramCacheResult(ProgramCacheResult stat)
static GrVkPipelineState * CreatePipelineState(GrVkGpu *, const GrProgramDesc &, const GrProgramInfo &, VkRenderPass compatibleRenderPass, bool overrideSubpassForResolveLoad)
FlutterSemanticsFlag flags
FlPixelBufferTexturePrivate * priv
std::unique_ptr< GrVkPipelineState > fPipelineState
Entry(GrVkGpu *gpu, GrVkPipelineState *pipelineState)