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

Side by Side Diff: src/gpu/vk/GrVkIndexBuffer.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/GrVkIndexBuffer.h ('k') | src/gpu/vk/GrVkInterface.cpp » ('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 "GrVkIndexBuffer.h"
9 #include "GrVkGpu.h"
10
11 GrVkIndexBuffer::GrVkIndexBuffer(GrVkGpu* gpu, const GrVkBuffer::Desc& desc,
12 const GrVkBuffer::Resource* bufferResource)
13 : INHERITED(gpu, desc.fSizeInBytes, desc.fDynamic, false)
14 , GrVkBuffer(desc, bufferResource) {
15 this->registerWithCache();
16 }
17
18 GrVkIndexBuffer* GrVkIndexBuffer::Create(GrVkGpu* gpu, size_t size, bool dynamic ) {
19 GrVkBuffer::Desc desc;
20 desc.fDynamic = dynamic;
21 desc.fType = GrVkBuffer::kIndex_Type;
22 desc.fSizeInBytes = size;
23
24 const GrVkBuffer::Resource* bufferResource = GrVkBuffer::Create(gpu, desc);
25 if (!bufferResource) {
26 return nullptr;
27 }
28
29
30 GrVkIndexBuffer* buffer = new GrVkIndexBuffer(gpu, desc, bufferResource);
31 if (!buffer) {
32 bufferResource->unref(gpu);
33 }
34 return buffer;
35 }
36
37 void GrVkIndexBuffer::onRelease() {
38 if (!this->wasDestroyed()) {
39 this->vkRelease(this->getVkGpu());
40 }
41
42 INHERITED::onRelease();
43 }
44
45 void GrVkIndexBuffer::onAbandon() {
46 this->vkAbandon();
47 INHERITED::onAbandon();
48 }
49
50 void* GrVkIndexBuffer::onMap() {
51 if (!this->wasDestroyed()) {
52 return this->vkMap(this->getVkGpu());
53 } else {
54 return NULL;
55 }
56 }
57
58 void GrVkIndexBuffer::onUnmap() {
59 if (!this->wasDestroyed()) {
60 this->vkUnmap(this->getVkGpu());
61 }
62 }
63
64 bool GrVkIndexBuffer::onUpdateData(const void* src, size_t srcSizeInBytes) {
65 if (!this->wasDestroyed()) {
66 return this->vkUpdateData(this->getVkGpu(), src, srcSizeInBytes);
67 } else {
68 return false;
69 }
70 }
71
72 GrVkGpu* GrVkIndexBuffer::getVkGpu() const {
73 SkASSERT(!this->wasDestroyed());
74 return static_cast<GrVkGpu*>(this->getGpu());
75 }
76
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkIndexBuffer.h ('k') | src/gpu/vk/GrVkInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698