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

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

Issue 1825393002: Consolidate GPU buffer implementations (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: asserts Created 4 years, 9 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/GrVkTransferBuffer.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 "GrVkIndexBuffer.h" 8 #include "GrVkIndexBuffer.h"
9 #include "GrVkGpu.h" 9 #include "GrVkGpu.h"
10 10
11 GrVkIndexBuffer::GrVkIndexBuffer(GrVkGpu* gpu, const GrVkBuffer::Desc& desc, 11 GrVkIndexBuffer::GrVkIndexBuffer(GrVkGpu* gpu, const GrVkBuffer::Desc& desc,
12 const GrVkBuffer::Resource* bufferResource) 12 const GrVkBuffer::Resource* bufferResource)
13 : INHERITED(gpu, desc.fSizeInBytes, desc.fDynamic, false) 13 : INHERITED(gpu, kIndex_GrBufferType, desc.fSizeInBytes,
14 desc.fDynamic ? kDynamic_GrAccessPattern : kStatic_GrAccessPatte rn, false)
14 , GrVkBuffer(desc, bufferResource) { 15 , GrVkBuffer(desc, bufferResource) {
15 this->registerWithCache(); 16 this->registerWithCache();
16 } 17 }
17 18
18 GrVkIndexBuffer* GrVkIndexBuffer::Create(GrVkGpu* gpu, size_t size, bool dynamic ) { 19 GrVkIndexBuffer* GrVkIndexBuffer::Create(GrVkGpu* gpu, size_t size, bool dynamic ) {
19 GrVkBuffer::Desc desc; 20 GrVkBuffer::Desc desc;
20 desc.fDynamic = dynamic; 21 desc.fDynamic = dynamic;
21 desc.fType = GrVkBuffer::kIndex_Type; 22 desc.fType = GrVkBuffer::kIndex_Type;
22 desc.fSizeInBytes = size; 23 desc.fSizeInBytes = size;
23 24
(...skipping 16 matching lines...) Expand all
40 } 41 }
41 42
42 INHERITED::onRelease(); 43 INHERITED::onRelease();
43 } 44 }
44 45
45 void GrVkIndexBuffer::onAbandon() { 46 void GrVkIndexBuffer::onAbandon() {
46 this->vkAbandon(); 47 this->vkAbandon();
47 INHERITED::onAbandon(); 48 INHERITED::onAbandon();
48 } 49 }
49 50
50 void* GrVkIndexBuffer::onMap() { 51 void GrVkIndexBuffer::onMap() {
51 if (!this->wasDestroyed()) { 52 if (!this->wasDestroyed()) {
52 return this->vkMap(this->getVkGpu()); 53 this->GrBuffer::fMapPtr = this->vkMap(this->getVkGpu());
53 } else {
54 return NULL;
55 } 54 }
56 } 55 }
57 56
58 void GrVkIndexBuffer::onUnmap() { 57 void GrVkIndexBuffer::onUnmap() {
59 if (!this->wasDestroyed()) { 58 if (!this->wasDestroyed()) {
60 this->vkUnmap(this->getVkGpu()); 59 this->vkUnmap(this->getVkGpu());
61 } 60 }
62 } 61 }
63 62
64 bool GrVkIndexBuffer::onUpdateData(const void* src, size_t srcSizeInBytes) { 63 bool GrVkIndexBuffer::onUpdateData(const void* src, size_t srcSizeInBytes) {
65 if (!this->wasDestroyed()) { 64 if (!this->wasDestroyed()) {
66 return this->vkUpdateData(this->getVkGpu(), src, srcSizeInBytes); 65 return this->vkUpdateData(this->getVkGpu(), src, srcSizeInBytes);
67 } else { 66 } else {
68 return false; 67 return false;
69 } 68 }
70 } 69 }
71 70
72 GrVkGpu* GrVkIndexBuffer::getVkGpu() const { 71 GrVkGpu* GrVkIndexBuffer::getVkGpu() const {
73 SkASSERT(!this->wasDestroyed()); 72 SkASSERT(!this->wasDestroyed());
74 return static_cast<GrVkGpu*>(this->getGpu()); 73 return static_cast<GrVkGpu*>(this->getGpu());
75 } 74 }
76 75
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkIndexBuffer.h ('k') | src/gpu/vk/GrVkTransferBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698