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

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

Issue 1825393002: Consolidate GPU buffer implementations (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: asserts Created 4 years, 8 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/GrVkTransferBuffer.h ('k') | src/gpu/vk/GrVkVertexBuffer.h » ('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 "GrVkTransferBuffer.h" 8 #include "GrVkTransferBuffer.h"
9 #include "GrVkGpu.h" 9 #include "GrVkGpu.h"
10 #include "SkTraceMemoryDump.h" 10 #include "SkTraceMemoryDump.h"
(...skipping 13 matching lines...) Expand all
24 24
25 GrVkTransferBuffer* buffer = new GrVkTransferBuffer(gpu, desc, bufferResourc e); 25 GrVkTransferBuffer* buffer = new GrVkTransferBuffer(gpu, desc, bufferResourc e);
26 if (!buffer) { 26 if (!buffer) {
27 bufferResource->unref(gpu); 27 bufferResource->unref(gpu);
28 } 28 }
29 return buffer; 29 return buffer;
30 } 30 }
31 31
32 GrVkTransferBuffer::GrVkTransferBuffer(GrVkGpu* gpu, const GrVkBuffer::Desc& des c, 32 GrVkTransferBuffer::GrVkTransferBuffer(GrVkGpu* gpu, const GrVkBuffer::Desc& des c,
33 const GrVkBuffer::Resource* bufferResourc e) 33 const GrVkBuffer::Resource* bufferResourc e)
34 : INHERITED(gpu, desc.fSizeInBytes) 34 : INHERITED(gpu, kCopyRead_Type == desc.fType ?
35 kXferCpuToGpu_GrBufferType : kXferGpuToCpu_GrBufferType,
36 desc.fSizeInBytes, kStream_GrAccessPattern, false)
35 , GrVkBuffer(desc, bufferResource) { 37 , GrVkBuffer(desc, bufferResource) {
36 this->registerWithCache(); 38 this->registerWithCache();
37 } 39 }
38 40
39 void GrVkTransferBuffer::onRelease() { 41 void GrVkTransferBuffer::onRelease() {
40 if (!this->wasDestroyed()) { 42 if (!this->wasDestroyed()) {
41 this->vkRelease(this->getVkGpu()); 43 this->vkRelease(this->getVkGpu());
42 } 44 }
43 45
44 INHERITED::onRelease(); 46 INHERITED::onRelease();
45 } 47 }
46 48
47 void GrVkTransferBuffer::onAbandon() { 49 void GrVkTransferBuffer::onAbandon() {
48 this->vkAbandon(); 50 this->vkAbandon();
49 INHERITED::onAbandon(); 51 INHERITED::onAbandon();
50 } 52 }
51 53
52 void GrVkTransferBuffer::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, 54 void GrVkTransferBuffer::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump,
53 const SkString& dumpName) const { 55 const SkString& dumpName) const {
54 SkString buffer_id; 56 SkString buffer_id;
55 buffer_id.appendU64((uint64_t)this->buffer()); 57 buffer_id.appendU64((uint64_t)this->buffer());
56 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "vk_buffer", 58 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "vk_buffer",
57 buffer_id.c_str()); 59 buffer_id.c_str());
58 } 60 }
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkTransferBuffer.h ('k') | src/gpu/vk/GrVkVertexBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698