Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Unified Diff: src/gpu/vk/GrVkGpu.cpp

Issue 1836863002: Change VkPipelineStateCahce to use Hash and LRU LList. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update macro name Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/vk/GrVkGpu.h ('k') | src/gpu/vk/GrVkPipelineStateCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkGpu.cpp
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index c4c32d12ff644a8ee265e9a192660ea5bc42e67a..ec3fe2f4eaf6e6c7f7fb0c037bbc8f110189ee18 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -1293,26 +1293,26 @@ bool GrVkGpu::onReadPixels(GrSurface* surface,
return true;
}
-bool GrVkGpu::prepareDrawState(const GrPipeline& pipeline,
- const GrPrimitiveProcessor& primProc,
- GrPrimitiveType primitiveType,
- const GrVkRenderPass& renderPass,
- GrVkPipelineState** pipelineState) {
- *pipelineState = fResourceProvider.findOrCreateCompatiblePipelineState(pipeline,
- primProc,
- primitiveType,
- renderPass);
+sk_sp<GrVkPipelineState> GrVkGpu::prepareDrawState(const GrPipeline& pipeline,
+ const GrPrimitiveProcessor& primProc,
+ GrPrimitiveType primitiveType,
+ const GrVkRenderPass& renderPass) {
+ sk_sp<GrVkPipelineState> pipelineState =
+ fResourceProvider.findOrCreateCompatiblePipelineState(pipeline,
+ primProc,
+ primitiveType,
+ renderPass);
if (!pipelineState) {
- return false;
+ return pipelineState;
}
- (*pipelineState)->setData(this, primProc, pipeline);
+ pipelineState->setData(this, primProc, pipeline);
- (*pipelineState)->bind(this, fCurrentCmdBuffer);
+ pipelineState->bind(this, fCurrentCmdBuffer);
GrVkPipeline::SetDynamicState(this, fCurrentCmdBuffer, pipeline);
- return true;
+ return pipelineState;
}
void GrVkGpu::onDraw(const GrPipeline& pipeline,
@@ -1329,9 +1329,12 @@ void GrVkGpu::onDraw(const GrPipeline& pipeline,
fCurrentCmdBuffer->beginRenderPass(this, renderPass, *vkRT);
- GrVkPipelineState* pipelineState = nullptr;
GrPrimitiveType primitiveType = meshes[0].primitiveType();
- if (!this->prepareDrawState(pipeline, primProc, primitiveType, *renderPass, &pipelineState)) {
+ sk_sp<GrVkPipelineState> pipelineState = this->prepareDrawState(pipeline,
+ primProc,
+ primitiveType,
+ *renderPass);
+ if (!pipelineState) {
return;
}
@@ -1386,11 +1389,13 @@ void GrVkGpu::onDraw(const GrPipeline& pipeline,
// pipelineState:setData but this will allow for quicker freeing of resources if the
// pipelineState sits in a cache for a while.
pipelineState->freeTempResources(this);
- pipelineState->unref();
SkDEBUGCODE(pipelineState = nullptr);
primitiveType = nonIdxMesh->primitiveType();
- if (!this->prepareDrawState(pipeline, primProc, primitiveType, *renderPass,
- &pipelineState)) {
+ pipelineState = this->prepareDrawState(pipeline,
+ primProc,
+ primitiveType,
+ *renderPass);
+ if (!pipelineState) {
return;
}
}
@@ -1422,7 +1427,6 @@ void GrVkGpu::onDraw(const GrPipeline& pipeline,
// pipelineState:setData but this will allow for quicker freeing of resources if the
// pipelineState sits in a cache for a while.
pipelineState->freeTempResources(this);
- pipelineState->unref();
#if SWAP_PER_DRAW
glFlush();
« no previous file with comments | « src/gpu/vk/GrVkGpu.h ('k') | src/gpu/vk/GrVkPipelineStateCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698