| 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 GrVkMemory_DEFINED | 8 #ifndef GrVkMemory_DEFINED |
| 9 #define GrVkMemory_DEFINED | 9 #define GrVkMemory_DEFINED |
| 10 | 10 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 ~GrVkHeap(); | 96 ~GrVkHeap(); |
| 97 | 97 |
| 98 VkDeviceSize allocSize() const { return fAllocSize; } | 98 VkDeviceSize allocSize() const { return fAllocSize; } |
| 99 VkDeviceSize usedSize() const { return fUsedSize; } | 99 VkDeviceSize usedSize() const { return fUsedSize; } |
| 100 | 100 |
| 101 bool alloc(VkDeviceSize size, VkDeviceSize alignment, uint32_t memoryTypeInd
ex, | 101 bool alloc(VkDeviceSize size, VkDeviceSize alignment, uint32_t memoryTypeInd
ex, |
| 102 GrVkAlloc* alloc) { | 102 GrVkAlloc* alloc) { |
| 103 SkASSERT(size > 0); |
| 103 return (*this.*fAllocFunc)(size, alignment, memoryTypeIndex, alloc); | 104 return (*this.*fAllocFunc)(size, alignment, memoryTypeIndex, alloc); |
| 104 } | 105 } |
| 105 bool free(const GrVkAlloc& alloc); | 106 bool free(const GrVkAlloc& alloc); |
| 106 | 107 |
| 107 private: | 108 private: |
| 108 typedef bool (GrVkHeap::*AllocFunc)(VkDeviceSize size, VkDeviceSize alignmen
t, | 109 typedef bool (GrVkHeap::*AllocFunc)(VkDeviceSize size, VkDeviceSize alignmen
t, |
| 109 uint32_t memoryTypeIndex, GrVkAlloc* all
oc); | 110 uint32_t memoryTypeIndex, GrVkAlloc* all
oc); |
| 110 | 111 |
| 111 bool subAlloc(VkDeviceSize size, VkDeviceSize alignment, | 112 bool subAlloc(VkDeviceSize size, VkDeviceSize alignment, |
| 112 uint32_t memoryTypeIndex, GrVkAlloc* alloc); | 113 uint32_t memoryTypeIndex, GrVkAlloc* alloc); |
| 113 bool singleAlloc(VkDeviceSize size, VkDeviceSize alignment, | 114 bool singleAlloc(VkDeviceSize size, VkDeviceSize alignment, |
| 114 uint32_t memoryTypeIndex, GrVkAlloc* alloc); | 115 uint32_t memoryTypeIndex, GrVkAlloc* alloc); |
| 115 | 116 |
| 116 const GrVkGpu* fGpu; | 117 const GrVkGpu* fGpu; |
| 117 VkDeviceSize fSubHeapSize; | 118 VkDeviceSize fSubHeapSize; |
| 118 VkDeviceSize fAllocSize; | 119 VkDeviceSize fAllocSize; |
| 119 VkDeviceSize fUsedSize; | 120 VkDeviceSize fUsedSize; |
| 120 AllocFunc fAllocFunc; | 121 AllocFunc fAllocFunc; |
| 121 SkTArray<SkAutoTDelete<GrVkSubHeap>> fSubHeaps; | 122 SkTArray<SkAutoTDelete<GrVkSubHeap>> fSubHeaps; |
| 122 }; | 123 }; |
| 123 #endif | 124 #endif |
| OLD | NEW |