blob: 9de9a6778ba10c4bdd83e0155b480b11af16960f [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
Mike Kleinc0bd9f92019-04-23 12:05:21 -05008#include "src/gpu/vk/GrVkDescriptorSet.h"
egdaniela95220d2016-07-21 11:50:37 -07009
Mike Kleinc0bd9f92019-04-23 12:05:21 -050010#include "src/gpu/vk/GrVkDescriptorPool.h"
11#include "src/gpu/vk/GrVkGpu.h"
12#include "src/gpu/vk/GrVkResourceProvider.h"
egdaniela95220d2016-07-21 11:50:37 -070013
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
Ethan Nicholas8e265a72018-12-12 16:22:40 -050023void GrVkDescriptorSet::freeGPUData(GrVkGpu* gpu) const {
egdaniela95220d2016-07-21 11:50:37 -070024 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