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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 fAlloc.fOffset = 0; | 103 fAlloc.fOffset = 0; |
104 } | 104 } |
105 | 105 |
106 Resource(VkImage image, const GrVkAlloc& alloc, VkImageTiling tiling) | 106 Resource(VkImage image, const GrVkAlloc& alloc, VkImageTiling tiling) |
107 : fImage(image), fAlloc(alloc), fImageTiling(tiling) {} | 107 : fImage(image), fAlloc(alloc), fImageTiling(tiling) {} |
108 | 108 |
109 ~Resource() override {} | 109 ~Resource() override {} |
110 | 110 |
111 #ifdef SK_TRACE_VK_RESOURCES | 111 #ifdef SK_TRACE_VK_RESOURCES |
112 void dumpInfo() const override { | 112 void dumpInfo() const override { |
113 SkDebugf("GrVkImage: %d (%d refs)\n", fImage, this->getRefCnt()); | 113 SkDebugf("GrVkImage: %d (%d refs)\n", fImage, this->getRefCnt()); |
114 } | 114 } |
115 #endif | 115 #endif |
116 private: | 116 private: |
117 void freeGPUData(const GrVkGpu* gpu) const override; | 117 void freeGPUData(const GrVkGpu* gpu) const override; |
118 | 118 |
119 VkImage fImage; | 119 VkImage fImage; |
120 GrVkAlloc fAlloc; | 120 GrVkAlloc fAlloc; |
121 VkImageTiling fImageTiling; | 121 VkImageTiling fImageTiling; |
122 | 122 |
123 typedef GrVkResource INHERITED; | 123 typedef GrVkResource INHERITED; |
124 }; | 124 }; |
125 | 125 |
126 // for wrapped textures | 126 // for wrapped textures |
127 class BorrowedResource : public Resource { | 127 class BorrowedResource : public Resource { |
128 public: | 128 public: |
129 BorrowedResource(VkImage image, const GrVkAlloc& alloc, VkImageTiling ti
ling) | 129 BorrowedResource(VkImage image, const GrVkAlloc& alloc, VkImageTiling ti
ling) |
130 : Resource(image, alloc, tiling) { | 130 : Resource(image, alloc, tiling) { |
131 } | 131 } |
132 private: | 132 private: |
133 void freeGPUData(const GrVkGpu* gpu) const override; | 133 void freeGPUData(const GrVkGpu* gpu) const override; |
134 }; | 134 }; |
135 | 135 |
136 const Resource* fResource; | 136 const Resource* fResource; |
137 | 137 |
138 friend class GrVkRenderTarget; | 138 friend class GrVkRenderTarget; |
139 }; | 139 }; |
140 | 140 |
141 #endif | 141 #endif |
OLD | NEW |