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 "GrVkDescriptorSetManager.h" 12 #include "GrVkResource.h" 13 #include "vk/GrVkDefines.h" 14 15 class GrVkDescriptorPool; 16 class GrVkGpu; 17 18 class GrVkDescriptorSet : public GrVkRecycledResource { 19 public: 20 GrVkDescriptorSet(VkDescriptorSet descSet, 21 GrVkDescriptorPool* pool, 22 GrVkDescriptorSetManager::Handle handle); 23 ~GrVkDescriptorSet()24 ~GrVkDescriptorSet() override {} 25 descriptorSet()26 VkDescriptorSet descriptorSet() const { return fDescSet; } 27 28 #ifdef SK_TRACE_VK_RESOURCES dumpInfo()29 void dumpInfo() const override { 30 SkDebugf("GrVkDescriptorSet: %d (%d refs)\n", fDescSet, this->getRefCnt()); 31 } 32 #endif 33 34 private: 35 void freeGPUData(const GrVkGpu* gpu) const override; 36 void abandonGPUData() const override; 37 void onRecycle(GrVkGpu* gpu) const override; 38 39 VkDescriptorSet fDescSet; 40 SkDEBUGCODE(mutable) GrVkDescriptorPool* fPool; 41 GrVkDescriptorSetManager::Handle fHandle; 42 }; 43 44 #endif 45