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