| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // Returns the compatible VkDescriptorSetLayout to use for uniform buffers.
The caller does not | 121 // Returns the compatible VkDescriptorSetLayout to use for uniform buffers.
The caller does not |
| 122 // own the VkDescriptorSetLayout and thus should not delete it. This functio
n should be used | 122 // own the VkDescriptorSetLayout and thus should not delete it. This functio
n should be used |
| 123 // when the caller needs the layout to create a VkPipelineLayout. | 123 // when the caller needs the layout to create a VkPipelineLayout. |
| 124 VkDescriptorSetLayout getUniDSLayout() const { return fUniformDescLayout; } | 124 VkDescriptorSetLayout getUniDSLayout() const { return fUniformDescLayout; } |
| 125 | 125 |
| 126 // Signals that the descriptor set passed it, which is compatible with the p
assed in handle, | 126 // Signals that the descriptor set passed it, which is compatible with the p
assed in handle, |
| 127 // can be reused by the next allocation request. | 127 // can be reused by the next allocation request. |
| 128 void recycleDescriptorSet(const GrVkDescriptorSet* descSet, | 128 void recycleDescriptorSet(const GrVkDescriptorSet* descSet, |
| 129 const GrVkDescriptorSetManager::Handle&); | 129 const GrVkDescriptorSetManager::Handle&); |
| 130 | 130 |
| 131 // Creates or finds free uniform buffer resources of size GrVkUniformBuffer:
:kStandardSize. |
| 132 // Anything larger will need to be created and released by the client. |
| 133 const GrVkResource* findOrCreateStandardUniformBufferResource(); |
| 134 |
| 135 // Signals that the resource passed to it (which should be a uniform buffer
resource) |
| 136 // can be reused by the next uniform buffer resource request. |
| 137 void recycleStandardUniformBufferResource(const GrVkResource*); |
| 138 |
| 131 // Destroy any cached resources. To be called before destroying the VkDevice
. | 139 // Destroy any cached resources. To be called before destroying the VkDevice
. |
| 132 // The assumption is that all queues are idle and all command buffers are fi
nished. | 140 // The assumption is that all queues are idle and all command buffers are fi
nished. |
| 133 // For resource tracing to work properly, this should be called after unrefi
ng all other | 141 // For resource tracing to work properly, this should be called after unrefi
ng all other |
| 134 // resource usages. | 142 // resource usages. |
| 135 void destroyResources(); | 143 void destroyResources(); |
| 136 | 144 |
| 137 // Abandon any cached resources. To be used when the context/VkDevice is los
t. | 145 // Abandon any cached resources. To be used when the context/VkDevice is los
t. |
| 138 // For resource tracing to work properly, this should be called after unrefi
ng all other | 146 // For resource tracing to work properly, this should be called after unrefi
ng all other |
| 139 // resource usages. | 147 // resource usages. |
| 140 void abandonResources(); | 148 void abandonResources(); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 SkSTArray<4, CompatibleRenderPassSet> fRenderPassArray; | 227 SkSTArray<4, CompatibleRenderPassSet> fRenderPassArray; |
| 220 | 228 |
| 221 // Array of PrimaryCommandBuffers that are currently in flight | 229 // Array of PrimaryCommandBuffers that are currently in flight |
| 222 SkSTArray<4, GrVkPrimaryCommandBuffer*> fActiveCommandBuffers; | 230 SkSTArray<4, GrVkPrimaryCommandBuffer*> fActiveCommandBuffers; |
| 223 // Array of available primary command buffers that are not in flight | 231 // Array of available primary command buffers that are not in flight |
| 224 SkSTArray<4, GrVkPrimaryCommandBuffer*> fAvailableCommandBuffers; | 232 SkSTArray<4, GrVkPrimaryCommandBuffer*> fAvailableCommandBuffers; |
| 225 | 233 |
| 226 // Array of available secondary command buffers | 234 // Array of available secondary command buffers |
| 227 SkSTArray<16, GrVkSecondaryCommandBuffer*> fAvailableSecondaryCommandBuffers
; | 235 SkSTArray<16, GrVkSecondaryCommandBuffer*> fAvailableSecondaryCommandBuffers
; |
| 228 | 236 |
| 237 // Array of available uniform buffer resources |
| 238 SkSTArray<16, const GrVkResource*> fAvailableUniformBufferResources; |
| 239 |
| 229 // Stores GrVkSampler objects that we've already created so we can reuse the
m across multiple | 240 // Stores GrVkSampler objects that we've already created so we can reuse the
m across multiple |
| 230 // GrVkPipelineStates | 241 // GrVkPipelineStates |
| 231 SkTDynamicHash<GrVkSampler, uint16_t> fSamplers; | 242 SkTDynamicHash<GrVkSampler, uint16_t> fSamplers; |
| 232 | 243 |
| 233 // Cache of GrVkPipelineStates | 244 // Cache of GrVkPipelineStates |
| 234 PipelineStateCache* fPipelineStateCache; | 245 PipelineStateCache* fPipelineStateCache; |
| 235 | 246 |
| 236 SkSTArray<4, GrVkDescriptorSetManager> fDescriptorSetManagers; | 247 SkSTArray<4, GrVkDescriptorSetManager> fDescriptorSetManagers; |
| 237 | 248 |
| 238 GrVkDescriptorSetManager::Handle fUniformDSHandle; | 249 GrVkDescriptorSetManager::Handle fUniformDSHandle; |
| 239 | 250 |
| 240 // Current pool to allocate uniform descriptor sets from | 251 // Current pool to allocate uniform descriptor sets from |
| 241 VkDescriptorSetLayout fUniformDescLayout; | 252 VkDescriptorSetLayout fUniformDescLayout; |
| 242 //Curent number of uniform descriptors allocated from the pool | 253 //Curent number of uniform descriptors allocated from the pool |
| 243 int fCurrentUniformDescCount; | 254 int fCurrentUniformDescCount; |
| 244 int fCurrMaxUniDescriptors; | 255 int fCurrMaxUniDescriptors; |
| 245 | 256 |
| 246 enum { | 257 enum { |
| 247 kMaxUniformDescriptors = 1024, | 258 kMaxUniformDescriptors = 1024, |
| 248 kNumUniformDescPerSet = 2, | 259 kNumUniformDescPerSet = 2, |
| 249 kStartNumUniformDescriptors = 16, // must be less than kMaxUniformDescri
ptors | 260 kStartNumUniformDescriptors = 16, // must be less than kMaxUniformDescri
ptors |
| 250 }; | 261 }; |
| 251 }; | 262 }; |
| 252 | 263 |
| 253 #endif | 264 #endif |
| OLD | NEW |