OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrVkImage_DEFINED | 8 #ifndef GrVkImage_DEFINED |
9 #define GrVkImage_DEFINED | 9 #define GrVkImage_DEFINED |
10 | 10 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 , fImage(VK_NULL_HANDLE) { | 100 , fImage(VK_NULL_HANDLE) { |
101 fAlloc.fMemory = VK_NULL_HANDLE; | 101 fAlloc.fMemory = VK_NULL_HANDLE; |
102 fAlloc.fOffset = 0; | 102 fAlloc.fOffset = 0; |
103 } | 103 } |
104 | 104 |
105 Resource(VkImage image, const GrVkAlloc& alloc, VkImageTiling tiling) | 105 Resource(VkImage image, const GrVkAlloc& alloc, VkImageTiling tiling) |
106 : fImage(image), fAlloc(alloc), fImageTiling(tiling) {} | 106 : fImage(image), fAlloc(alloc), fImageTiling(tiling) {} |
107 | 107 |
108 ~Resource() override {} | 108 ~Resource() override {} |
109 | 109 |
| 110 #ifdef SK_TRACE_VK_RESOURCES |
| 111 void dumpInfo() const override { |
| 112 SkDebugf("GrVkImage: %d (%d refs)\n", fImage, this->getRefCnt()); |
| 113 } |
| 114 #endif |
110 private: | 115 private: |
111 void freeGPUData(const GrVkGpu* gpu) const override; | 116 void freeGPUData(const GrVkGpu* gpu) const override; |
112 | 117 |
113 VkImage fImage; | 118 VkImage fImage; |
114 GrVkAlloc fAlloc; | 119 GrVkAlloc fAlloc; |
115 VkImageTiling fImageTiling; | 120 VkImageTiling fImageTiling; |
116 | 121 |
117 typedef GrVkResource INHERITED; | 122 typedef GrVkResource INHERITED; |
118 }; | 123 }; |
119 | 124 |
120 // for wrapped textures | 125 // for wrapped textures |
121 class BorrowedResource : public Resource { | 126 class BorrowedResource : public Resource { |
122 public: | 127 public: |
123 BorrowedResource(VkImage image, const GrVkAlloc& alloc, VkImageTiling ti
ling) | 128 BorrowedResource(VkImage image, const GrVkAlloc& alloc, VkImageTiling ti
ling) |
124 : Resource(image, alloc, tiling) { | 129 : Resource(image, alloc, tiling) { |
125 } | 130 } |
126 private: | 131 private: |
127 void freeGPUData(const GrVkGpu* gpu) const override; | 132 void freeGPUData(const GrVkGpu* gpu) const override; |
128 }; | 133 }; |
129 | 134 |
130 const Resource* fResource; | 135 const Resource* fResource; |
131 | 136 |
132 friend class GrVkRenderTarget; | 137 friend class GrVkRenderTarget; |
133 }; | 138 }; |
134 | 139 |
135 #endif | 140 #endif |
OLD | NEW |