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 "src/gpu/vk/GrVkDescriptorSet.h"
9 
10 #include "src/gpu/vk/GrVkDescriptorPool.h"
11 #include "src/gpu/vk/GrVkGpu.h"
12 #include "src/gpu/vk/GrVkResourceProvider.h"
13 
GrVkDescriptorSet(VkDescriptorSet descSet,GrVkDescriptorPool * pool,GrVkDescriptorSetManager::Handle handle)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 
freeGPUData(GrVkGpu * gpu) const23 void GrVkDescriptorSet::freeGPUData(GrVkGpu* gpu) const {
24     fPool->unref(gpu);
25 }
26 
onRecycle(GrVkGpu * gpu) const27 void GrVkDescriptorSet::onRecycle(GrVkGpu* gpu) const {
28     gpu->resourceProvider().recycleDescriptorSet(this, fHandle);
29 }
30 
abandonGPUData() const31 void GrVkDescriptorSet::abandonGPUData() const {
32     fPool->unrefAndAbandon();
33 }
34 
35