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 #include "vk/GrVkTypes.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 GrVkDescriptorPool(const GrVkGpu* gpu, VkDescriptorType type, uint32_t count); 24 descPool()25 VkDescriptorPool descPool() const { return fDescPool; } 26 27 void reset(const GrVkGpu* gpu); 28 29 // Returns whether or not this descriptor pool could be used, assuming it gets fully reset and 30 // not in use by another draw, to support the requested type and count. 31 bool isCompatible(VkDescriptorType type, uint32_t count) const; 32 33 #ifdef SK_TRACE_VK_RESOURCES dumpInfo()34 void dumpInfo() const override { 35 SkDebugf("GrVkDescriptorPool: %d, type %d (%d refs)\n", fDescPool, fType, 36 this->getRefCnt()); 37 } 38 #endif 39 40 private: 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