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

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

Issue 2159333002: Recycle small uniform buffers. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update values Created 4 years, 5 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 | « src/gpu/vk/GrVkBuffer.h ('k') | src/gpu/vk/GrVkGpu.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 #include "GrVkBuffer.h" 8 #include "GrVkBuffer.h"
9 #include "GrVkGpu.h" 9 #include "GrVkGpu.h"
10 #include "GrVkMemory.h" 10 #include "GrVkMemory.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 void GrVkBuffer::Resource::freeGPUData(const GrVkGpu* gpu) const { 102 void GrVkBuffer::Resource::freeGPUData(const GrVkGpu* gpu) const {
103 SkASSERT(fBuffer); 103 SkASSERT(fBuffer);
104 SkASSERT(fAlloc.fMemory); 104 SkASSERT(fAlloc.fMemory);
105 VK_CALL(gpu, DestroyBuffer(gpu->device(), fBuffer, nullptr)); 105 VK_CALL(gpu, DestroyBuffer(gpu->device(), fBuffer, nullptr));
106 GrVkMemory::FreeBufferMemory(gpu, fType, fAlloc); 106 GrVkMemory::FreeBufferMemory(gpu, fType, fAlloc);
107 } 107 }
108 108
109 void GrVkBuffer::vkRelease(const GrVkGpu* gpu) { 109 void GrVkBuffer::vkRelease(const GrVkGpu* gpu) {
110 VALIDATE(); 110 VALIDATE();
111 fResource->unref(gpu); 111 fResource->recycle(const_cast<GrVkGpu*>(gpu));
112 fResource = nullptr; 112 fResource = nullptr;
113 fMapPtr = nullptr; 113 fMapPtr = nullptr;
114 VALIDATE(); 114 VALIDATE();
115 } 115 }
116 116
117 void GrVkBuffer::vkAbandon() { 117 void GrVkBuffer::vkAbandon() {
118 fResource->unrefAndAbandon(); 118 fResource->unrefAndAbandon();
119 fResource = nullptr; 119 fResource = nullptr;
120 fMapPtr = nullptr; 120 fMapPtr = nullptr;
121 VALIDATE(); 121 VALIDATE();
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 VK_CALL(gpu, UnmapMemory(gpu->device(), alloc.fMemory)); 202 VK_CALL(gpu, UnmapMemory(gpu->device(), alloc.fMemory));
203 203
204 return true; 204 return true;
205 } 205 }
206 206
207 void GrVkBuffer::validate() const { 207 void GrVkBuffer::validate() const {
208 SkASSERT(!fResource || kVertex_Type == fDesc.fType || kIndex_Type == fDesc.f Type 208 SkASSERT(!fResource || kVertex_Type == fDesc.fType || kIndex_Type == fDesc.f Type
209 || kCopyRead_Type == fDesc.fType || kCopyWrite_Type == fDesc.fType 209 || kCopyRead_Type == fDesc.fType || kCopyWrite_Type == fDesc.fType
210 || kUniform_Type == fDesc.fType); 210 || kUniform_Type == fDesc.fType);
211 } 211 }
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkBuffer.h ('k') | src/gpu/vk/GrVkGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698