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