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

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

Issue 1816153002: Set up cache in vulkan to reuse GrVkPrograms (aka VkPipelines) (Closed) Base URL: https://skia.googlesource.com/skia.git@progSamplers
Patch Set: rebase 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/GrVkResourceProvider.h ('k') | src/gpu/vk/GrVkUniformHandler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/gpu/vk/GrVkResourceProvider.h ('k') | src/gpu/vk/GrVkUniformHandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698