| 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 | 8 |
| 9 #ifndef GrVkPipelineState_DEFINED | 9 #ifndef GrVkPipelineState_DEFINED |
| 10 #define GrVkPipelineState_DEFINED | 10 #define GrVkPipelineState_DEFINED |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 161 |
| 162 // Each pool will manage one type of descriptor. Thus each descriptor set we
use will all be of | 162 // Each pool will manage one type of descriptor. Thus each descriptor set we
use will all be of |
| 163 // one VkDescriptorType. | 163 // one VkDescriptorType. |
| 164 struct DescriptorPoolManager { | 164 struct DescriptorPoolManager { |
| 165 DescriptorPoolManager(VkDescriptorSetLayout layout, VkDescriptorType typ
e, | 165 DescriptorPoolManager(VkDescriptorSetLayout layout, VkDescriptorType typ
e, |
| 166 uint32_t descCount, GrVkGpu* gpu) | 166 uint32_t descCount, GrVkGpu* gpu) |
| 167 : fDescLayout(layout) | 167 : fDescLayout(layout) |
| 168 , fDescType(type) | 168 , fDescType(type) |
| 169 , fCurrentDescriptorSet(0) | 169 , fCurrentDescriptorSet(0) |
| 170 , fPool(nullptr) { | 170 , fPool(nullptr) { |
| 171 SkASSERT(descCount < (SK_MaxU32 >> 2)); | 171 SkASSERT(descCount < (kMaxDescSetLimit >> 2)); |
| 172 fMaxDescriptorSets = descCount << 2; | 172 fMaxDescriptorSets = descCount << 2; |
| 173 this->getNewPool(gpu); | 173 this->getNewPool(gpu); |
| 174 } | 174 } |
| 175 | 175 |
| 176 ~DescriptorPoolManager() { | 176 ~DescriptorPoolManager() { |
| 177 SkASSERT(!fDescLayout); | 177 SkASSERT(!fDescLayout); |
| 178 SkASSERT(!fPool); | 178 SkASSERT(!fPool); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void getNewDescriptorSet(GrVkGpu* gpu, VkDescriptorSet* ds); | 181 void getNewDescriptorSet(GrVkGpu* gpu, VkDescriptorSet* ds); |
| 182 | 182 |
| 183 void freeGPUResources(const GrVkGpu* gpu); | 183 void freeGPUResources(const GrVkGpu* gpu); |
| 184 void abandonGPUResources(); | 184 void abandonGPUResources(); |
| 185 | 185 |
| 186 VkDescriptorSetLayout fDescLayout; | 186 VkDescriptorSetLayout fDescLayout; |
| 187 VkDescriptorType fDescType; | 187 VkDescriptorType fDescType; |
| 188 uint32_t fMaxDescriptorSets; | 188 uint32_t fMaxDescriptorSets; |
| 189 uint32_t fCurrentDescriptorSet; | 189 uint32_t fCurrentDescriptorSet; |
| 190 GrVkDescriptorPool* fPool; | 190 GrVkDescriptorPool* fPool; |
| 191 | 191 |
| 192 private: | 192 private: |
| 193 static const uint32_t kMaxDescSetLimit = 1 << 10; |
| 194 |
| 193 void getNewPool(GrVkGpu* gpu); | 195 void getNewPool(GrVkGpu* gpu); |
| 194 }; | 196 }; |
| 195 | 197 |
| 196 void writeUniformBuffers(const GrVkGpu* gpu); | 198 void writeUniformBuffers(const GrVkGpu* gpu); |
| 197 | 199 |
| 198 void writeSamplers(GrVkGpu* gpu, const SkTArray<const GrTextureAccess*>& tex
tureBindings); | 200 void writeSamplers(GrVkGpu* gpu, const SkTArray<const GrTextureAccess*>& tex
tureBindings); |
| 199 | 201 |
| 200 /** | 202 /** |
| 201 * We use the RT's size and origin to adjust from Skia device space to vulkan
normalized device | 203 * We use the RT's size and origin to adjust from Skia device space to vulkan
normalized device |
| 202 * space and to make device space positions have the correct origin for proce
ssors that require | 204 * space and to make device space positions have the correct origin for proce
ssors that require |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 279 |
| 278 DescriptorPoolManager fSamplerPoolManager; | 280 DescriptorPoolManager fSamplerPoolManager; |
| 279 DescriptorPoolManager fUniformPoolManager; | 281 DescriptorPoolManager fUniformPoolManager; |
| 280 | 282 |
| 281 int fNumSamplers; | 283 int fNumSamplers; |
| 282 | 284 |
| 283 friend class GrVkPipelineStateBuilder; | 285 friend class GrVkPipelineStateBuilder; |
| 284 }; | 286 }; |
| 285 | 287 |
| 286 #endif | 288 #endif |
| OLD | NEW |