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

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

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

Powered by Google App Engine
This is Rietveld 408576698