Debian Codegraph @

src/gpu/ganesh/vk/GrVkDescriptorPool.h

raw
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 GrVkDescriptorPool_DEFINED
9 #define GrVkDescriptorPool_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/GrVkManagedResource.h"
15
16 #include <cinttypes>
17 #include <cstdint>
18
19 class GrVkGpu;
20
21 /**
22 * We require that all descriptor sets are of a single descriptor type. We also use a pool to only
23 * make one type of descriptor set. Thus a single VkDescriptorPool will only allocated space for
24 * for one type of descriptor.
25 */
26 class GrVkDescriptorPool : public GrVkManagedResource {
27 public:
28 static GrVkDescriptorPool* Create(GrVkGpu* gpu, VkDescriptorType type, uint32_t count);
29
30 VkDescriptorPool descPool() const { return fDescPool; }
31
32 // Returns whether or not this descriptor pool could be used, assuming it gets fully reset and
33 // not in use by another draw, to support the requested type and count.
34 bool isCompatible(VkDescriptorType type, uint32_t count) const;
35
36 #ifdef SK_TRACE_MANAGED_RESOURCES
37 void dumpInfo() const override {
38 SkDebugf("GrVkDescriptorPool: %" PRIdPTR ", type %d (%d refs)\n", (intptr_t)fDescPool,
39 fType, this->getRefCnt());
40 }
41 #endif
42
43 private:
44 GrVkDescriptorPool(const GrVkGpu*, VkDescriptorPool pool, VkDescriptorType type,
45 uint32_t count);
46
47 void freeGPUData() const override;
48
49 VkDescriptorType fType;
50 uint32_t fCount;
51 VkDescriptorPool fDescPool;
52
53 using INHERITED = GrVkManagedResource;
54 };
55
56 #endif