Index: src/gpu/vk/GrVkResourceProvider.cpp |
diff --git a/src/gpu/vk/GrVkResourceProvider.cpp b/src/gpu/vk/GrVkResourceProvider.cpp |
index 3e0dfa028d4c01b45aa23ae1a30f971324b7ffa1..8bdb946cb8c1b4194486f2865436deed139a5cc0 100644 |
--- a/src/gpu/vk/GrVkResourceProvider.cpp |
+++ b/src/gpu/vk/GrVkResourceProvider.cpp |
@@ -21,11 +21,13 @@ SkRandom GrVkResource::fRandom; |
GrVkResourceProvider::GrVkResourceProvider(GrVkGpu* gpu) : fGpu(gpu) |
, fPipelineCache(VK_NULL_HANDLE) { |
+ fPipelineStateCache = new PipelineStateCache(gpu); |
} |
GrVkResourceProvider::~GrVkResourceProvider() { |
SkASSERT(0 == fSimpleRenderPasses.count()); |
SkASSERT(VK_NULL_HANDLE == fPipelineCache); |
+ delete fPipelineStateCache; |
} |
void GrVkResourceProvider::init() { |
@@ -94,6 +96,14 @@ GrVkSampler* GrVkResourceProvider::findOrCreateCompatibleSampler(const GrTexture |
return sampler; |
} |
+GrVkPipelineState* GrVkResourceProvider::findOrCreateCompatiblePipelineState( |
+ const GrPipeline& pipeline, |
+ const GrPrimitiveProcessor& proc, |
+ GrPrimitiveType primitiveType, |
+ const GrVkRenderPass& renderPass) { |
+ return fPipelineStateCache->refPipelineState(pipeline, proc, primitiveType, renderPass); |
+} |
+ |
GrVkCommandBuffer* GrVkResourceProvider::createCommandBuffer() { |
GrVkCommandBuffer* cmdBuffer = GrVkCommandBuffer::Create(fGpu, fGpu->cmdPool()); |
fActiveCommandBuffers.push_back(cmdBuffer); |
@@ -132,6 +142,8 @@ void GrVkResourceProvider::destroyResources() { |
} |
fSamplers.reset(); |
+ fPipelineStateCache->release(); |
+ |
#ifdef SK_TRACE_VK_RESOURCES |
SkASSERT(0 == GrVkResource::fTrace.count()); |
#endif |
@@ -160,6 +172,8 @@ void GrVkResourceProvider::abandonResources() { |
} |
fSamplers.reset(); |
+ fPipelineStateCache->abandon(); |
+ |
#ifdef SK_TRACE_VK_RESOURCES |
SkASSERT(0 == GrVkResource::fTrace.count()); |
#endif |