OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrVkResourceProvider_DEFINED | 8 #ifndef GrVkResourceProvider_DEFINED |
9 #define GrVkResourceProvider_DEFINED | 9 #define GrVkResourceProvider_DEFINED |
10 | 10 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 // possible for us to use a shadered descriptor pool to allocate all these s imilar descriptor | 105 // possible for us to use a shadered descriptor pool to allocate all these s imilar descriptor |
106 // sets. The caller is responsible for reffing the outPool for as long as th e returned | 106 // sets. The caller is responsible for reffing the outPool for as long as th e returned |
107 // VkDescriptor set is in use. | 107 // VkDescriptor set is in use. |
108 void getUniformDescriptorSet(VkDescriptorSet*, const GrVkDescriptorPool** ou tPool); | 108 void getUniformDescriptorSet(VkDescriptorSet*, const GrVkDescriptorPool** ou tPool); |
109 | 109 |
110 // Returns the compatible VkDescriptorSetLayout to use for uniform buffers. The caller does not | 110 // Returns the compatible VkDescriptorSetLayout to use for uniform buffers. The caller does not |
111 // own the VkDescriptorSetLayout and thus should not delete it. This functio n should be used | 111 // own the VkDescriptorSetLayout and thus should not delete it. This functio n should be used |
112 // when the caller needs the layout to create a VkPipelineLayout. | 112 // when the caller needs the layout to create a VkPipelineLayout. |
113 VkDescriptorSetLayout getUniDSLayout() const { return fUniformDescLayout; } | 113 VkDescriptorSetLayout getUniDSLayout() const { return fUniformDescLayout; } |
114 | 114 |
115 // Creates or finds uniform buffer resources of size GrVkUniformBuffer::kSta ndardSize | |
116 // Anything larger will need to be created and released by the client | |
117 const GrVkResource* findOrCreateStandardUniformBufferResource(); | |
118 void recycleStandardUniformBufferResource(const GrVkResource*); | |
egdaniel
2016/07/19 20:48:38
comment for recycle function
| |
119 | |
115 // Destroy any cached resources. To be called before destroying the VkDevice . | 120 // Destroy any cached resources. To be called before destroying the VkDevice . |
116 // The assumption is that all queues are idle and all command buffers are fi nished. | 121 // The assumption is that all queues are idle and all command buffers are fi nished. |
117 // For resource tracing to work properly, this should be called after unrefi ng all other | 122 // For resource tracing to work properly, this should be called after unrefi ng all other |
118 // resource usages. | 123 // resource usages. |
119 void destroyResources(); | 124 void destroyResources(); |
120 | 125 |
121 // Abandon any cached resources. To be used when the context/VkDevice is los t. | 126 // Abandon any cached resources. To be used when the context/VkDevice is los t. |
122 // For resource tracing to work properly, this should be called after unrefi ng all other | 127 // For resource tracing to work properly, this should be called after unrefi ng all other |
123 // resource usages. | 128 // resource usages. |
124 void abandonResources(); | 129 void abandonResources(); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
204 SkSTArray<4, CompatibleRenderPassSet> fRenderPassArray; | 209 SkSTArray<4, CompatibleRenderPassSet> fRenderPassArray; |
205 | 210 |
206 // Array of PrimaryCommandBuffers that are currently in flight | 211 // Array of PrimaryCommandBuffers that are currently in flight |
207 SkSTArray<4, GrVkPrimaryCommandBuffer*> fActiveCommandBuffers; | 212 SkSTArray<4, GrVkPrimaryCommandBuffer*> fActiveCommandBuffers; |
208 // Array of available primary command buffers that are not in flight | 213 // Array of available primary command buffers that are not in flight |
209 SkSTArray<4, GrVkPrimaryCommandBuffer*> fAvailableCommandBuffers; | 214 SkSTArray<4, GrVkPrimaryCommandBuffer*> fAvailableCommandBuffers; |
210 | 215 |
211 // Array of available secondary command buffers | 216 // Array of available secondary command buffers |
212 SkSTArray<16, GrVkSecondaryCommandBuffer*> fAvailableSecondaryCommandBuffers ; | 217 SkSTArray<16, GrVkSecondaryCommandBuffer*> fAvailableSecondaryCommandBuffers ; |
213 | 218 |
219 // Array of available uniform buffer resources | |
220 SkSTArray<16, const GrVkResource*> fAvailableUniformBufferResources; | |
221 | |
214 // Stores GrVkSampler objects that we've already created so we can reuse the m across multiple | 222 // Stores GrVkSampler objects that we've already created so we can reuse the m across multiple |
215 // GrVkPipelineStates | 223 // GrVkPipelineStates |
216 SkTDynamicHash<GrVkSampler, uint16_t> fSamplers; | 224 SkTDynamicHash<GrVkSampler, uint16_t> fSamplers; |
217 | 225 |
218 // Cache of GrVkPipelineStates | 226 // Cache of GrVkPipelineStates |
219 PipelineStateCache* fPipelineStateCache; | 227 PipelineStateCache* fPipelineStateCache; |
220 | 228 |
221 // Current pool to allocate uniform descriptor sets from | 229 // Current pool to allocate uniform descriptor sets from |
222 const GrVkDescriptorPool* fUniformDescPool; | 230 const GrVkDescriptorPool* fUniformDescPool; |
223 VkDescriptorSetLayout fUniformDescLayout; | 231 VkDescriptorSetLayout fUniformDescLayout; |
224 //Curent number of uniform descriptors allocated from the pool | 232 //Curent number of uniform descriptors allocated from the pool |
225 int fCurrentUniformDescCount; | 233 int fCurrentUniformDescCount; |
226 int fCurrMaxUniDescriptors; | 234 int fCurrMaxUniDescriptors; |
227 | 235 |
228 enum { | 236 enum { |
229 kMaxUniformDescriptors = 1024, | 237 kMaxUniformDescriptors = 1024, |
230 kNumUniformDescPerSet = 2, | 238 kNumUniformDescPerSet = 2, |
231 kStartNumUniformDescriptors = 16, // must be less than kMaxUniformDescri ptors | 239 kStartNumUniformDescriptors = 16, // must be less than kMaxUniformDescri ptors |
232 }; | 240 }; |
233 }; | 241 }; |
234 | 242 |
235 #endif | 243 #endif |
OLD | NEW |