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