OLD | NEW |
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 16 matching lines...) Expand all Loading... |
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, desc.fSizeInBytes, |
35 kCopyRead_Type == desc.fType ? | 35 kCopyRead_Type == desc.fType ? |
36 kXferCpuToGpu_GrBufferType : kXferGpuToCpu_GrBufferType, | 36 kXferCpuToGpu_GrBufferType : kXferGpuToCpu_GrBufferType, |
37 kStream_GrAccessPattern, false) | 37 kStream_GrAccessPattern) |
38 , GrVkBuffer(desc, bufferResource) { | 38 , GrVkBuffer(desc, bufferResource) { |
39 this->registerWithCache(SkBudgeted::kYes); | 39 this->registerWithCache(SkBudgeted::kYes); |
40 } | 40 } |
41 | 41 |
42 void GrVkTransferBuffer::onRelease() { | 42 void GrVkTransferBuffer::onRelease() { |
43 if (!this->wasDestroyed()) { | 43 if (!this->wasDestroyed()) { |
44 this->vkRelease(this->getVkGpu()); | 44 this->vkRelease(this->getVkGpu()); |
45 } | 45 } |
46 | 46 |
47 INHERITED::onRelease(); | 47 INHERITED::onRelease(); |
48 } | 48 } |
49 | 49 |
50 void GrVkTransferBuffer::onAbandon() { | 50 void GrVkTransferBuffer::onAbandon() { |
51 this->vkAbandon(); | 51 this->vkAbandon(); |
52 INHERITED::onAbandon(); | 52 INHERITED::onAbandon(); |
53 } | 53 } |
54 | 54 |
55 void GrVkTransferBuffer::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, | 55 void GrVkTransferBuffer::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, |
56 const SkString& dumpName) const { | 56 const SkString& dumpName) const { |
57 SkString buffer_id; | 57 SkString buffer_id; |
58 buffer_id.appendU64((uint64_t)this->buffer()); | 58 buffer_id.appendU64((uint64_t)this->buffer()); |
59 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "vk_buffer", | 59 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "vk_buffer", |
60 buffer_id.c_str()); | 60 buffer_id.c_str()); |
61 } | 61 } |
OLD | NEW |