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

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

Issue 1718693002: Add vulkan files into skia repo. (Closed) Base URL: https://skia.googlesource.com/skia.git@merge
Patch Set: fix path Created 4 years, 10 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/GrVkUniformBuffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "GrVkTransferBuffer.h"
9 #include "GrVkGpu.h"
10 #include "SkTraceMemoryDump.h"
11
12
13 GrVkTransferBuffer* GrVkTransferBuffer::Create(GrVkGpu* gpu, size_t size, GrVkBu ffer::Type type) {
14 GrVkBuffer::Desc desc;
15 desc.fDynamic = false;
16 SkASSERT(GrVkBuffer::kCopyRead_Type == type || GrVkBuffer::kCopyWrite_Type = = type);
17 desc.fType = type;
18 desc.fSizeInBytes = size;
19
20 const GrVkBuffer::Resource* bufferResource = GrVkBuffer::Create(gpu, desc);
21 if (!bufferResource) {
22 return nullptr;
23 }
24
25 GrVkTransferBuffer* buffer = new GrVkTransferBuffer(gpu, desc, bufferResourc e);
26 if (!buffer) {
27 bufferResource->unref(gpu);
28 }
29 return buffer;
30 }
31
32 GrVkTransferBuffer::GrVkTransferBuffer(GrVkGpu* gpu, const GrVkBuffer::Desc& des c,
33 const GrVkBuffer::Resource* bufferResourc e)
34 : INHERITED(gpu, desc.fSizeInBytes)
35 , GrVkBuffer(desc, bufferResource) {
36 this->registerWithCache();
37 }
38
39 void GrVkTransferBuffer::onRelease() {
40 if (!this->wasDestroyed()) {
41 this->vkRelease(this->getVkGpu());
42 }
43
44 INHERITED::onRelease();
45 }
46
47 void GrVkTransferBuffer::onAbandon() {
48 this->vkAbandon();
49 INHERITED::onAbandon();
50 }
51
52 void GrVkTransferBuffer::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump,
53 const SkString& dumpName) const {
54 SkString buffer_id;
55 buffer_id.appendU64((uint64_t)this->buffer());
56 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "vk_buffer",
57 buffer_id.c_str());
58 }
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkTransferBuffer.h ('k') | src/gpu/vk/GrVkUniformBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698