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

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

Issue 2072763002: Check for some potential subheap allocation failures. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add some asserts 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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