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 #include "GrVkResourceProvider.h" | 8 #include "GrVkResourceProvider.h" |
9 | 9 |
10 #include "GrTextureParams.h" | 10 #include "GrTextureParams.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 GrPrimitiveType
primitiveType, | 189 GrPrimitiveType
primitiveType, |
190 const GrVkRende
rPass& renderPass) { | 190 const GrVkRende
rPass& renderPass) { |
191 return fPipelineStateCache->refPipelineState(pipeline, proc, primitiveType,
renderPass); | 191 return fPipelineStateCache->refPipelineState(pipeline, proc, primitiveType,
renderPass); |
192 } | 192 } |
193 | 193 |
194 void GrVkResourceProvider::getUniformDescriptorSet(VkDescriptorSet* ds, | 194 void GrVkResourceProvider::getUniformDescriptorSet(VkDescriptorSet* ds, |
195 const GrVkDescriptorPool** ou
tPool) { | 195 const GrVkDescriptorPool** ou
tPool) { |
196 fCurrentUniformDescCount += kNumUniformDescPerSet; | 196 fCurrentUniformDescCount += kNumUniformDescPerSet; |
197 if (fCurrentUniformDescCount > fCurrMaxUniDescriptors) { | 197 if (fCurrentUniformDescCount > fCurrMaxUniDescriptors) { |
198 fUniformDescPool->unref(fGpu); | 198 fUniformDescPool->unref(fGpu); |
199 if (fCurrMaxUniDescriptors < kMaxUniformDescriptors >> 1) { | 199 uint32_t newPoolSize = fCurrMaxUniDescriptors + ((fCurrMaxUniDescriptors
+ 1) >> 1); |
200 fCurrMaxUniDescriptors = fCurrMaxUniDescriptors << 1; | 200 if (newPoolSize < kMaxUniformDescriptors) { |
| 201 fCurrMaxUniDescriptors = newPoolSize; |
201 } else { | 202 } else { |
202 fCurrMaxUniDescriptors = kMaxUniformDescriptors; | 203 fCurrMaxUniDescriptors = kMaxUniformDescriptors; |
203 } | 204 } |
204 fUniformDescPool = | 205 fUniformDescPool = |
205 this->findOrCreateCompatibleDescriptorPool(VK_DESCRIPTOR_TYPE_UNIFOR
M_BUFFER, | 206 this->findOrCreateCompatibleDescriptorPool(VK_DESCRIPTOR_TYPE_UNIFOR
M_BUFFER, |
206 fCurrMaxUniDescriptors); | 207 fCurrMaxUniDescriptors); |
207 fCurrentUniformDescCount = kNumUniformDescPerSet; | 208 fCurrentUniformDescCount = kNumUniformDescPerSet; |
208 } | 209 } |
209 SkASSERT(fUniformDescPool); | 210 SkASSERT(fUniformDescPool); |
210 | 211 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 } | 357 } |
357 | 358 |
358 void GrVkResourceProvider::CompatibleRenderPassSet::abandonResources() { | 359 void GrVkResourceProvider::CompatibleRenderPassSet::abandonResources() { |
359 for (int i = 0; i < fRenderPasses.count(); ++i) { | 360 for (int i = 0; i < fRenderPasses.count(); ++i) { |
360 if (fRenderPasses[i]) { | 361 if (fRenderPasses[i]) { |
361 fRenderPasses[i]->unrefAndAbandon(); | 362 fRenderPasses[i]->unrefAndAbandon(); |
362 fRenderPasses[i] = nullptr; | 363 fRenderPasses[i] = nullptr; |
363 } | 364 } |
364 } | 365 } |
365 } | 366 } |
OLD | NEW |