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" |
11 | 11 |
12 | 12 |
13 GrVkTransferBuffer* GrVkTransferBuffer::Create(GrVkGpu* gpu, size_t size, GrVkBu
ffer::Type type) { | 13 GrVkTransferBuffer* GrVkTransferBuffer::Create(GrVkGpu* gpu, size_t size, GrVkBu
ffer::Type type) { |
14 GrVkBuffer::Desc desc; | 14 GrVkBuffer::Desc desc; |
15 desc.fDynamic = false; | 15 desc.fDynamic = true; |
16 SkASSERT(GrVkBuffer::kCopyRead_Type == type || GrVkBuffer::kCopyWrite_Type =
= type); | 16 SkASSERT(GrVkBuffer::kCopyRead_Type == type || GrVkBuffer::kCopyWrite_Type =
= type); |
17 desc.fType = type; | 17 desc.fType = type; |
18 desc.fSizeInBytes = size; | 18 desc.fSizeInBytes = size; |
19 | 19 |
20 const GrVkBuffer::Resource* bufferResource = GrVkBuffer::Create(gpu, desc); | 20 const GrVkBuffer::Resource* bufferResource = GrVkBuffer::Create(gpu, desc); |
21 if (!bufferResource) { | 21 if (!bufferResource) { |
22 return nullptr; | 22 return nullptr; |
23 } | 23 } |
24 | 24 |
25 GrVkTransferBuffer* buffer = new GrVkTransferBuffer(gpu, desc, bufferResourc
e); | 25 GrVkTransferBuffer* buffer = new GrVkTransferBuffer(gpu, desc, bufferResourc
e); |
(...skipping 26 matching lines...) Expand all Loading... |
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 |