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

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

Issue 1927943002: Unify DescriptorPools for vulkan uniform descriptor sets (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use enum Created 4 years, 8 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/GrVkPipelineStateBuilder.cpp ('k') | src/gpu/vk/GrVkResourceProvider.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkResourceProvider.h
diff --git a/src/gpu/vk/GrVkResourceProvider.h b/src/gpu/vk/GrVkResourceProvider.h
index 4853bf160c9ad4ab62b6775d7ef520d9376368ce..e88456960c298f8a3bc654b411d5475757ee8dbf 100644
--- a/src/gpu/vk/GrVkResourceProvider.h
+++ b/src/gpu/vk/GrVkResourceProvider.h
@@ -70,6 +70,18 @@ public:
GrPrimitiveType,
const GrVkRenderPass& renderPass);
+ // For all our GrVkPipelineState objects, we require a layout where the first set contains two
+ // uniform buffers, one for the vertex shader and one for the fragment shader. Thus it is
+ // possible for us to use a shadered descriptor pool to allocate all these similar descriptor
+ // sets. The caller is responsible for reffing the outPool for as long as the returned
+ // VkDescriptor set is in use.
+ void getUniformDescriptorSet(VkDescriptorSet*, const GrVkDescriptorPool** outPool);
+
+ // Returns the compatible VkDescriptorSetLayout to use for uniform buffers. The caller does not
+ // own the VkDescriptorSetLayout and thus should not delete it. This function should be used
+ // when the caller needs the layout to create a VkPipelineLayout.
+ VkDescriptorSetLayout getUniDSLayout() const { return fUniformDescLayout; }
+
// Destroy any cached resources. To be called before destroying the VkDevice.
// The assumption is that all queues are idle and all command buffers are finished.
// For resource tracing to work properly, this should be called after unrefing all other
@@ -122,6 +134,9 @@ private:
#endif
};
+ // Initialiaze the vkDescriptorSetLayout used for allocating new uniform buffer descritpor sets.
+ void initUniformDescObjects();
+
GrVkGpu* fGpu;
// Central cache for creating pipelines
@@ -140,6 +155,19 @@ private:
// Cache of GrVkPipelineStates
PipelineStateCache* fPipelineStateCache;
+
+ // Current pool to allocate uniform descriptor sets from
+ const GrVkDescriptorPool* fUniformDescPool;
+ VkDescriptorSetLayout fUniformDescLayout;
+ //Curent number of uniform descriptors allocated from the pool
+ int fCurrentUniformDescCount;
+ int fCurrMaxUniDescriptors;
+
+ enum {
+ kMaxUniformDescriptors = 1024,
+ kNumUniformDescPerSet = 2,
+ kStartNumUniformDescriptors = 16, // must be less than kMaxUniformDescriptors
+ };
};
#endif
« no previous file with comments | « src/gpu/vk/GrVkPipelineStateBuilder.cpp ('k') | src/gpu/vk/GrVkResourceProvider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698