1 /* 2 * Copyright 2017 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 GrVkSemaphore_DEFINED 9 #define GrVkSemaphore_DEFINED 10 11 #include "GrSemaphore.h" 12 #include "GrVkResource.h" 13 14 #include "vk/GrVkTypes.h" 15 16 class GrVkGpu; 17 18 class GrVkSemaphore : public GrSemaphore { 19 public: 20 static sk_sp<GrVkSemaphore> Make(const GrVkGpu* gpu); 21 22 ~GrVkSemaphore() override; 23 24 class Resource : public GrVkResource { 25 public: Resource(VkSemaphore semaphore)26 Resource(VkSemaphore semaphore) : INHERITED(), fSemaphore(semaphore) {} 27 ~Resource()28 ~Resource() override {} 29 semaphore()30 VkSemaphore semaphore() const { return fSemaphore; } 31 32 #ifdef SK_TRACE_VK_RESOURCES dumpInfo()33 void dumpInfo() const override { 34 SkDebugf("GrVkSemaphore: %d (%d refs)\n", fSemaphore, this->getRefCnt()); 35 } 36 #endif 37 private: 38 void freeGPUData(const GrVkGpu* gpu) const override; 39 40 VkSemaphore fSemaphore; 41 42 typedef GrVkResource INHERITED; 43 }; 44 getResource()45 const Resource* getResource() const { return fResource; } 46 47 private: 48 GrVkSemaphore(const GrVkGpu* gpu, VkSemaphore semaphore); 49 50 const Resource* fResource; 51 52 typedef GrSemaphore INHERITED; 53 }; 54 55 #endif 56