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