xref: /aosp_15_r20/external/skia/src/gpu/ganesh/vk/GrVkDescriptorSet.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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 #ifndef GrVkDescriptorSet_DEFINED
9 #define GrVkDescriptorSet_DEFINED
10 
11 #include "include/private/base/SkDebug.h"
12 #include "include/private/gpu/vk/SkiaVulkan.h"
13 #include "src/gpu/ganesh/GrManagedResource.h"
14 #include "src/gpu/ganesh/vk/GrVkDescriptorSetManager.h"
15 #include "src/gpu/ganesh/vk/GrVkManagedResource.h"
16 
17 #include <stdint.h>
18 #include <cinttypes>
19 
20 class GrVkDescriptorPool;
21 class GrVkGpu;
22 
23 class GrVkDescriptorSet : public GrVkRecycledResource {
24 public:
25     GrVkDescriptorSet(GrVkGpu* gpu,
26                       VkDescriptorSet descSet,
27                       GrVkDescriptorPool* pool,
28                       GrVkDescriptorSetManager::Handle handle);
29 
~GrVkDescriptorSet()30     ~GrVkDescriptorSet() override {}
31 
descriptorSet()32     const VkDescriptorSet* descriptorSet() const { return &fDescSet; }
33 
34 #ifdef SK_TRACE_MANAGED_RESOURCES
dumpInfo()35     void dumpInfo() const override {
36         SkDebugf("GrVkDescriptorSet: %" PRIdPTR " (%d refs)\n", (intptr_t)fDescSet,
37                  this->getRefCnt());
38     }
39 #endif
40 
41 private:
42     void freeGPUData() const override;
43     void onRecycle() const override;
44 
45     VkDescriptorSet                          fDescSet;
46     SkDEBUGCODE(mutable) GrVkDescriptorPool* fPool;
47     GrVkDescriptorSetManager::Handle         fHandle;
48 
49     using INHERITED = GrVkRecycledResource;
50 };
51 
52 #endif
53