egdaniel | a95220d | 2016-07-21 11:50:37 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #include "GrVkDescriptorSet.h" |
| 9 | |
| 10 | #include "GrVkDescriptorPool.h" |
| 11 | #include "GrVkGpu.h" |
| 12 | #include "GrVkResourceProvider.h" |
| 13 | |
| 14 | GrVkDescriptorSet::GrVkDescriptorSet(VkDescriptorSet descSet, |
| 15 | GrVkDescriptorPool* pool, |
| 16 | GrVkDescriptorSetManager::Handle handle) |
| 17 | : fDescSet(descSet) |
| 18 | , fPool(pool) |
| 19 | , fHandle(handle) { |
| 20 | fPool->ref(); |
| 21 | } |
| 22 | |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 23 | void GrVkDescriptorSet::freeGPUData(GrVkGpu* gpu) const { |
egdaniel | a95220d | 2016-07-21 11:50:37 -0700 | [diff] [blame] | 24 | fPool->unref(gpu); |
| 25 | } |
| 26 | |
| 27 | void GrVkDescriptorSet::onRecycle(GrVkGpu* gpu) const { |
| 28 | gpu->resourceProvider().recycleDescriptorSet(this, fHandle); |
| 29 | } |
| 30 | |
Greg Daniel | cef213c | 2017-04-21 11:52:27 -0400 | [diff] [blame] | 31 | void GrVkDescriptorSet::abandonGPUData() const { |
egdaniel | a95220d | 2016-07-21 11:50:37 -0700 | [diff] [blame] | 32 | fPool->unrefAndAbandon(); |
| 33 | } |
| 34 | |