| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 GrGLSLXferProcessor* xferProcessor, | 159 GrGLSLXferProcessor* xferProcessor, |
| 160 const GrGLSLFragProcs& fragmentProcessors); | 160 const GrGLSLFragProcs& fragmentProcessors); |
| 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 , fDescCountPerSet(descCount) |
| 170 , fCurrentDescriptorCount(0) |
| 170 , fPool(nullptr) { | 171 , fPool(nullptr) { |
| 171 SkASSERT(descCount < (kMaxDescSetLimit >> 2)); | 172 SkASSERT(descCount < kMaxDescLimit >> 2); |
| 172 fMaxDescriptorSets = descCount << 2; | 173 fMaxDescriptors = fDescCountPerSet << 2; |
| 173 this->getNewPool(gpu); | 174 this->getNewPool(gpu); |
| 174 } | 175 } |
| 175 | 176 |
| 176 ~DescriptorPoolManager() { | 177 ~DescriptorPoolManager() { |
| 177 SkASSERT(!fDescLayout); | 178 SkASSERT(!fDescLayout); |
| 178 SkASSERT(!fPool); | 179 SkASSERT(!fPool); |
| 179 } | 180 } |
| 180 | 181 |
| 181 void getNewDescriptorSet(GrVkGpu* gpu, VkDescriptorSet* ds); | 182 void getNewDescriptorSet(GrVkGpu* gpu, VkDescriptorSet* ds); |
| 182 | 183 |
| 183 void freeGPUResources(const GrVkGpu* gpu); | 184 void freeGPUResources(const GrVkGpu* gpu); |
| 184 void abandonGPUResources(); | 185 void abandonGPUResources(); |
| 185 | 186 |
| 186 VkDescriptorSetLayout fDescLayout; | 187 VkDescriptorSetLayout fDescLayout; |
| 187 VkDescriptorType fDescType; | 188 VkDescriptorType fDescType; |
| 188 uint32_t fMaxDescriptorSets; | 189 uint32_t fDescCountPerSet; |
| 189 uint32_t fCurrentDescriptorSet; | 190 uint32_t fMaxDescriptors; |
| 191 uint32_t fCurrentDescriptorCount; |
| 190 GrVkDescriptorPool* fPool; | 192 GrVkDescriptorPool* fPool; |
| 191 | 193 |
| 192 private: | 194 private: |
| 193 static const uint32_t kMaxDescSetLimit = 1 << 10; | 195 static const uint32_t kMaxDescLimit = 1 << 10; |
| 194 | 196 |
| 195 void getNewPool(GrVkGpu* gpu); | 197 void getNewPool(GrVkGpu* gpu); |
| 196 }; | 198 }; |
| 197 | 199 |
| 198 void writeUniformBuffers(const GrVkGpu* gpu); | 200 void writeUniformBuffers(const GrVkGpu* gpu); |
| 199 | 201 |
| 200 void writeSamplers(GrVkGpu* gpu, const SkTArray<const GrTextureAccess*>& tex
tureBindings); | 202 void writeSamplers(GrVkGpu* gpu, const SkTArray<const GrTextureAccess*>& tex
tureBindings); |
| 201 | 203 |
| 202 /** | 204 /** |
| 203 * We use the RT's size and origin to adjust from Skia device space to vulkan
normalized device | 205 * We use the RT's size and origin to adjust from Skia device space to vulkan
normalized device |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 281 |
| 280 DescriptorPoolManager fSamplerPoolManager; | 282 DescriptorPoolManager fSamplerPoolManager; |
| 281 DescriptorPoolManager fUniformPoolManager; | 283 DescriptorPoolManager fUniformPoolManager; |
| 282 | 284 |
| 283 int fNumSamplers; | 285 int fNumSamplers; |
| 284 | 286 |
| 285 friend class GrVkPipelineStateBuilder; | 287 friend class GrVkPipelineStateBuilder; |
| 286 }; | 288 }; |
| 287 | 289 |
| 288 #endif | 290 #endif |
| OLD | NEW |