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

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

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