aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/vk/GrVkDescriptorSet.h
blob: cbeb98ed70122f83f6dc5d934b1664c3a484e57a (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
35
36
37
38
39
40
41
42
43
44
/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/

#ifndef GrVkDescriptorSet_DEFINED
#define GrVkDescriptorSet_DEFINED

#include "GrVkDescriptorSetManager.h"
#include "GrVkResource.h"
#include "vk/GrVkDefines.h"

class GrVkDescriptorPool;
class GrVkGpu;

class GrVkDescriptorSet : public GrVkRecycledResource {
public:
    GrVkDescriptorSet(VkDescriptorSet descSet,
                      GrVkDescriptorPool* pool,
                      GrVkDescriptorSetManager::Handle handle);

    ~GrVkDescriptorSet() override {}

    VkDescriptorSet descriptorSet() const { return fDescSet; }

#ifdef SK_TRACE_VK_RESOURCES
    void dumpInfo() const override {
        SkDebugf("GrVkDescriptorSet: %d (%d refs)\n", fDescSet, this->getRefCnt());
    }
#endif

private:
    void freeGPUData(const GrVkGpu* gpu) const override;
    void abandonGPUData() const override;
    void onRecycle(GrVkGpu* gpu) const override;

    VkDescriptorSet                          fDescSet;
    SkDEBUGCODE(mutable) GrVkDescriptorPool* fPool;
    GrVkDescriptorSetManager::Handle         fHandle;
};

#endif