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

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: 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
Index: src/gpu/vk/GrVkGpu.cpp
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index c4c32d12ff644a8ee265e9a192660ea5bc42e67a..cbd233f3b1d6b07f9d74b796b5b3ff936bef560f 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -1297,12 +1297,12 @@ bool GrVkGpu::prepareDrawState(const GrPipeline& pipeline,
const GrPrimitiveProcessor& primProc,
GrPrimitiveType primitiveType,
const GrVkRenderPass& renderPass,
- GrVkPipelineState** pipelineState) {
+ sk_sp<GrVkPipelineState>* pipelineState) {
*pipelineState = fResourceProvider.findOrCreateCompatiblePipelineState(pipeline,
primProc,
primitiveType,
renderPass);
- if (!pipelineState) {
+ if (!*pipelineState) {
return false;
}
@@ -1329,7 +1329,7 @@ void GrVkGpu::onDraw(const GrPipeline& pipeline,
fCurrentCmdBuffer->beginRenderPass(this, renderPass, *vkRT);
- GrVkPipelineState* pipelineState = nullptr;
+ sk_sp<GrVkPipelineState> pipelineState = nullptr;
GrPrimitiveType primitiveType = meshes[0].primitiveType();
if (!this->prepareDrawState(pipeline, primProc, primitiveType, *renderPass, &pipelineState)) {
return;
@@ -1386,7 +1386,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();
SkDEBUGCODE(pipelineState = nullptr);
primitiveType = nonIdxMesh->primitiveType();
if (!this->prepareDrawState(pipeline, primProc, primitiveType, *renderPass,
@@ -1422,7 +1421,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();

Powered by Google App Engine
This is Rietveld 408576698