blob: 3cb1035de0b88e21ddcba0b11515b41d49d4aa1e [file] [log] [blame]
egdaniela95220d2016-07-21 11:50:37 -07001/*
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
14GrVkDescriptorSet::GrVkDescriptorSet(VkDescriptorSet descSet,
15 GrVkDescriptorPool* pool,
16 GrVkDescriptorSetManager::Handle handle)
17 : fDescSet(descSet)
18 , fPool(pool)
19 , fHandle(handle) {
20 fPool->ref();
21}
22
23void GrVkDescriptorSet::freeGPUData(const GrVkGpu* gpu) const {
24 fPool->unref(gpu);
25}
26
27void GrVkDescriptorSet::onRecycle(GrVkGpu* gpu) const {
28 gpu->resourceProvider().recycleDescriptorSet(this, fHandle);
29}
30
Greg Danielcef213c2017-04-21 11:52:27 -040031void GrVkDescriptorSet::abandonGPUData() const {
egdaniela95220d2016-07-21 11:50:37 -070032 fPool->unrefAndAbandon();
33}
34