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

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

Issue 1756493002: Use VkPipelineCaches during VkPipeline creation (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix mipmap issues Created 4 years, 10 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') | no next file » | 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 f4cfa27224d16e908244c72015698373f9e981f2..19bda4152514af6e38c3cd6788740cd52886c25d 100644
--- a/src/gpu/vk/GrVkResourceProvider.cpp
+++ b/src/gpu/vk/GrVkResourceProvider.cpp
@@ -17,11 +17,30 @@ SkTDynamicHash<GrVkResource, uint32_t> GrVkResource::fTrace;
SkRandom GrVkResource::fRandom;
#endif
-GrVkResourceProvider::GrVkResourceProvider(GrVkGpu* gpu) : fGpu(gpu) {
+GrVkResourceProvider::GrVkResourceProvider(GrVkGpu* gpu) : fGpu(gpu)
+ , fPipelineCache(VK_NULL_HANDLE) {
}
GrVkResourceProvider::~GrVkResourceProvider() {
SkASSERT(0 == fSimpleRenderPasses.count());
+ SkASSERT(VK_NULL_HANDLE == fPipelineCache);
+}
+
+void GrVkResourceProvider::init() {
+ VkPipelineCacheCreateInfo createInfo;
+ memset(&createInfo, 0, sizeof(VkPipelineCacheCreateInfo));
+ createInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO;
+ createInfo.pNext = nullptr;
+ createInfo.flags = 0;
+ createInfo.initialDataSize = 0;
+ createInfo.pInitialData = nullptr;
+ VkResult result = GR_VK_CALL(fGpu->vkInterface(),
+ CreatePipelineCache(fGpu->device(), &createInfo, nullptr,
+ &fPipelineCache));
+ SkASSERT(VK_SUCCESS == result);
+ if (VK_SUCCESS != result) {
+ fPipelineCache = VK_NULL_HANDLE;
+ }
}
GrVkPipeline* GrVkResourceProvider::createPipeline(const GrPipeline& pipeline,
@@ -33,7 +52,7 @@ GrVkPipeline* GrVkResourceProvider::createPipeline(const GrPipeline& pipeline,
VkPipelineLayout layout) {
return GrVkPipeline::Create(fGpu, pipeline, primProc, shaderStageInfo, shaderStageCount,
- primitiveType, renderPass, layout);
+ primitiveType, renderPass, layout, fPipelineCache);
}
@@ -97,6 +116,8 @@ void GrVkResourceProvider::destroyResources() {
SkASSERT(0 == GrVkResource::fTrace.count());
#endif
+ GR_VK_CALL(fGpu->vkInterface(), DestroyPipelineCache(fGpu->device(), fPipelineCache, nullptr));
+ fPipelineCache = VK_NULL_HANDLE;
}
void GrVkResourceProvider::abandonResources() {
@@ -115,4 +136,5 @@ void GrVkResourceProvider::abandonResources() {
#ifdef SK_TRACE_VK_RESOURCES
SkASSERT(0 == GrVkResource::fTrace.count());
#endif
-}
+ fPipelineCache = VK_NULL_HANDLE;
+}
« no previous file with comments | « src/gpu/vk/GrVkResourceProvider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698