aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/vk/GrVkDescriptorSet.cpp
blob: 3cb1035de0b88e21ddcba0b11515b41d49d4aa1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/

#include "GrVkDescriptorSet.h"

#include "GrVkDescriptorPool.h"
#include "GrVkGpu.h"
#include "GrVkResourceProvider.h"

GrVkDescriptorSet::GrVkDescriptorSet(VkDescriptorSet descSet,
                                     GrVkDescriptorPool* pool,
                                     GrVkDescriptorSetManager::Handle handle)
    : fDescSet(descSet)
    , fPool(pool)
    , fHandle(handle) {
    fPool->ref();
}

void GrVkDescriptorSet::freeGPUData(const GrVkGpu* gpu) const {
    fPool->unref(gpu);
}

void GrVkDescriptorSet::onRecycle(GrVkGpu* gpu) const {
    gpu->resourceProvider().recycleDescriptorSet(this, fHandle);
}

void GrVkDescriptorSet::abandonGPUData() const {
    fPool->unrefAndAbandon();
}