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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 *handle = GrVkDescriptorSetManager::Handle(i); | 170 *handle = GrVkDescriptorSetManager::Handle(i); |
171 return; | 171 return; |
172 } | 172 } |
173 } | 173 } |
174 | 174 |
175 fDescriptorSetManagers.emplace_back(fGpu, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_
SAMPLER, | 175 fDescriptorSetManagers.emplace_back(fGpu, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_
SAMPLER, |
176 &uniformHandler); | 176 &uniformHandler); |
177 *handle = GrVkDescriptorSetManager::Handle(fDescriptorSetManagers.count() -
1); | 177 *handle = GrVkDescriptorSetManager::Handle(fDescriptorSetManagers.count() -
1); |
178 } | 178 } |
179 | 179 |
| 180 void GrVkResourceProvider::getSamplerDescriptorSetHandle(const uint32_t* visibil
ities, |
| 181 int visibilityCount, |
| 182 GrVkDescriptorSetManage
r::Handle* handle) { |
| 183 SkASSERT(handle); |
| 184 for (int i = 0; i < fDescriptorSetManagers.count(); ++i) { |
| 185 if (fDescriptorSetManagers[i].isCompatible(VK_DESCRIPTOR_TYPE_COMBINED_I
MAGE_SAMPLER, |
| 186 visibilities, visibilityCount
)) { |
| 187 *handle = GrVkDescriptorSetManager::Handle(i); |
| 188 return; |
| 189 } |
| 190 } |
| 191 |
| 192 fDescriptorSetManagers.emplace_back(fGpu, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_
SAMPLER, |
| 193 visibilities, visibilityCount); |
| 194 *handle = GrVkDescriptorSetManager::Handle(fDescriptorSetManagers.count() -
1); |
| 195 } |
| 196 |
180 VkDescriptorSetLayout GrVkResourceProvider::getUniformDSLayout() const { | 197 VkDescriptorSetLayout GrVkResourceProvider::getUniformDSLayout() const { |
181 SkASSERT(fUniformDSHandle.isValid()); | 198 SkASSERT(fUniformDSHandle.isValid()); |
182 return fDescriptorSetManagers[fUniformDSHandle.toIndex()].layout(); | 199 return fDescriptorSetManagers[fUniformDSHandle.toIndex()].layout(); |
183 } | 200 } |
184 | 201 |
185 VkDescriptorSetLayout GrVkResourceProvider::getSamplerDSLayout( | 202 VkDescriptorSetLayout GrVkResourceProvider::getSamplerDSLayout( |
186 const GrVkDescriptorSetManager::Handle& handle) const { | 203 const GrVkDescriptorSetManager::Handle& handle) const { |
187 SkASSERT(handle.isValid()); | 204 SkASSERT(handle.isValid()); |
188 return fDescriptorSetManagers[handle.toIndex()].layout(); | 205 return fDescriptorSetManagers[handle.toIndex()].layout(); |
189 } | 206 } |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 } | 443 } |
427 | 444 |
428 void GrVkResourceProvider::CompatibleRenderPassSet::abandonResources() { | 445 void GrVkResourceProvider::CompatibleRenderPassSet::abandonResources() { |
429 for (int i = 0; i < fRenderPasses.count(); ++i) { | 446 for (int i = 0; i < fRenderPasses.count(); ++i) { |
430 if (fRenderPasses[i]) { | 447 if (fRenderPasses[i]) { |
431 fRenderPasses[i]->unrefAndAbandon(); | 448 fRenderPasses[i]->unrefAndAbandon(); |
432 fRenderPasses[i] = nullptr; | 449 fRenderPasses[i] = nullptr; |
433 } | 450 } |
434 } | 451 } |
435 } | 452 } |
OLD | NEW |