Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: src/gpu/vk/GrVkMemory.h

Issue 2072453002: Add heap tests for Vulkan (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: One last test Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/gpu/vk/GrVkMemory.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 , fUsedSize(0) { 88 , fUsedSize(0) {
89 if (strategy == kSubAlloc_Strategy) { 89 if (strategy == kSubAlloc_Strategy) {
90 fAllocFunc = &GrVkHeap::subAlloc; 90 fAllocFunc = &GrVkHeap::subAlloc;
91 } else { 91 } else {
92 fAllocFunc = &GrVkHeap::singleAlloc; 92 fAllocFunc = &GrVkHeap::singleAlloc;
93 } 93 }
94 } 94 }
95 95
96 ~GrVkHeap(); 96 ~GrVkHeap();
97 97
98 VkDeviceSize allocSize() const { return fAllocSize; }
99 VkDeviceSize usedSize() const { return fUsedSize; }
100
98 bool alloc(VkDeviceSize size, VkDeviceSize alignment, uint32_t memoryTypeInd ex, 101 bool alloc(VkDeviceSize size, VkDeviceSize alignment, uint32_t memoryTypeInd ex,
99 GrVkAlloc* alloc) { 102 GrVkAlloc* alloc) {
100 return (*this.*fAllocFunc)(size, alignment, memoryTypeIndex, alloc); 103 return (*this.*fAllocFunc)(size, alignment, memoryTypeIndex, alloc);
101 } 104 }
102 bool free(const GrVkAlloc& alloc); 105 bool free(const GrVkAlloc& alloc);
103 106
104 private: 107 private:
105 typedef bool (GrVkHeap::*AllocFunc)(VkDeviceSize size, VkDeviceSize alignmen t, 108 typedef bool (GrVkHeap::*AllocFunc)(VkDeviceSize size, VkDeviceSize alignmen t,
106 uint32_t memoryTypeIndex, GrVkAlloc* all oc); 109 uint32_t memoryTypeIndex, GrVkAlloc* all oc);
107 110
108 bool subAlloc(VkDeviceSize size, VkDeviceSize alignment, 111 bool subAlloc(VkDeviceSize size, VkDeviceSize alignment,
109 uint32_t memoryTypeIndex, GrVkAlloc* alloc); 112 uint32_t memoryTypeIndex, GrVkAlloc* alloc);
110 bool singleAlloc(VkDeviceSize size, VkDeviceSize alignment, 113 bool singleAlloc(VkDeviceSize size, VkDeviceSize alignment,
111 uint32_t memoryTypeIndex, GrVkAlloc* alloc); 114 uint32_t memoryTypeIndex, GrVkAlloc* alloc);
112 115
113 const GrVkGpu* fGpu; 116 const GrVkGpu* fGpu;
114 VkDeviceSize fSubHeapSize; 117 VkDeviceSize fSubHeapSize;
115 VkDeviceSize fAllocSize; 118 VkDeviceSize fAllocSize;
116 VkDeviceSize fUsedSize; 119 VkDeviceSize fUsedSize;
117 AllocFunc fAllocFunc; 120 AllocFunc fAllocFunc;
118 SkTArray<SkAutoTDelete<GrVkSubHeap>> fSubHeaps; 121 SkTArray<SkAutoTDelete<GrVkSubHeap>> fSubHeaps;
119 }; 122 };
120 #endif 123 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/vk/GrVkMemory.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698