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 |