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

Side by Side Diff: src/gpu/vk/GrVkGpu.cpp

Issue 2087283002: Use single alloc for vulkan optimal image heaps to fix memory crash (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | no next file » | 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 #include "GrVkGpu.h" 8 #include "GrVkGpu.h"
9 9
10 #include "GrContextOptions.h" 10 #include "GrContextOptions.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 &fCmdPool)); 128 &fCmdPool));
129 129
130 // must call this after creating the CommandPool 130 // must call this after creating the CommandPool
131 fResourceProvider.init(); 131 fResourceProvider.init();
132 fCurrentCmdBuffer = fResourceProvider.createPrimaryCommandBuffer(); 132 fCurrentCmdBuffer = fResourceProvider.createPrimaryCommandBuffer();
133 SkASSERT(fCurrentCmdBuffer); 133 SkASSERT(fCurrentCmdBuffer);
134 fCurrentCmdBuffer->begin(this); 134 fCurrentCmdBuffer->begin(this);
135 135
136 // set up our heaps 136 // set up our heaps
137 fHeaps[kLinearImage_Heap].reset(new GrVkHeap(this, GrVkHeap::kSubAlloc_Strat egy, 16*1024*1024)); 137 fHeaps[kLinearImage_Heap].reset(new GrVkHeap(this, GrVkHeap::kSubAlloc_Strat egy, 16*1024*1024));
138 fHeaps[kOptimalImage_Heap].reset(new GrVkHeap(this, GrVkHeap::kSubAlloc_Stra tegy, 64*1024*1024)); 138 // We want the OptimalImage_Heap to use a SubAlloc_strategy but it occasiona lly causes the
139 // device to run out of memory. Most likely this is caused by fragmentation in the device heap
140 // and we can't allocate more. Until we get a fix moving this to SingleAlloc .
141 fHeaps[kOptimalImage_Heap].reset(new GrVkHeap(this, GrVkHeap::kSingleAlloc_S trategy, 64*1024*1024));
139 fHeaps[kSmallOptimalImage_Heap].reset(new GrVkHeap(this, GrVkHeap::kSubAlloc _Strategy, 2*1024*1024)); 142 fHeaps[kSmallOptimalImage_Heap].reset(new GrVkHeap(this, GrVkHeap::kSubAlloc _Strategy, 2*1024*1024));
140 fHeaps[kVertexBuffer_Heap].reset(new GrVkHeap(this, GrVkHeap::kSingleAlloc_S trategy, 0)); 143 fHeaps[kVertexBuffer_Heap].reset(new GrVkHeap(this, GrVkHeap::kSingleAlloc_S trategy, 0));
141 fHeaps[kIndexBuffer_Heap].reset(new GrVkHeap(this, GrVkHeap::kSingleAlloc_St rategy, 0)); 144 fHeaps[kIndexBuffer_Heap].reset(new GrVkHeap(this, GrVkHeap::kSingleAlloc_St rategy, 0));
142 fHeaps[kUniformBuffer_Heap].reset(new GrVkHeap(this, GrVkHeap::kSubAlloc_Str ategy, 64*1024)); 145 fHeaps[kUniformBuffer_Heap].reset(new GrVkHeap(this, GrVkHeap::kSubAlloc_Str ategy, 64*1024));
143 fHeaps[kCopyReadBuffer_Heap].reset(new GrVkHeap(this, GrVkHeap::kSingleAlloc _Strategy, 0)); 146 fHeaps[kCopyReadBuffer_Heap].reset(new GrVkHeap(this, GrVkHeap::kSingleAlloc _Strategy, 0));
144 fHeaps[kCopyWriteBuffer_Heap].reset(new GrVkHeap(this, GrVkHeap::kSubAlloc_S trategy, 16*1024*1024)); 147 fHeaps[kCopyWriteBuffer_Heap].reset(new GrVkHeap(this, GrVkHeap::kSubAlloc_S trategy, 16*1024*1024));
145 } 148 }
146 149
147 GrVkGpu::~GrVkGpu() { 150 GrVkGpu::~GrVkGpu() {
148 fCurrentCmdBuffer->end(this); 151 fCurrentCmdBuffer->end(this);
(...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after
1706 aglSwapBuffers(aglGetCurrentContext()); 1709 aglSwapBuffers(aglGetCurrentContext());
1707 int set_a_break_pt_here = 9; 1710 int set_a_break_pt_here = 9;
1708 aglSwapBuffers(aglGetCurrentContext()); 1711 aglSwapBuffers(aglGetCurrentContext());
1709 #elif defined(SK_BUILD_FOR_WIN32) 1712 #elif defined(SK_BUILD_FOR_WIN32)
1710 SwapBuf(); 1713 SwapBuf();
1711 int set_a_break_pt_here = 9; 1714 int set_a_break_pt_here = 9;
1712 SwapBuf(); 1715 SwapBuf();
1713 #endif 1716 #endif
1714 #endif 1717 #endif
1715 } 1718 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698