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

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: 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
Index: src/gpu/vk/GrVkResourceProvider.h
diff --git a/src/gpu/vk/GrVkResourceProvider.h b/src/gpu/vk/GrVkResourceProvider.h
index 4853bf160c9ad4ab62b6775d7ef520d9376368ce..812146dab11a97f2659c0391c1ff5fe4bd3ece63 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,15 @@ 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;
+ static const int kMaxUniformDescriptors = 1024;
jvanverth1 2016/04/28 20:34:30 I believe that Chrome would prefer that these be e
+ static const int kNumUniformDescPerSet = 2;
};
#endif

Powered by Google App Engine
This is Rietveld 408576698