OLD | NEW |
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, desc.fSizeInBytes, kVertex_GrBufferType, | 13 : INHERITED(gpu, desc.fSizeInBytes, kVertex_GrBufferType, |
14 desc.fDynamic ? kDynamic_GrAccessPattern : kStatic_GrAccessPatte
rn, false) | 14 desc.fDynamic ? kDynamic_GrAccessPattern : kStatic_GrAccessPatte
rn, false) |
15 , GrVkBuffer(desc, bufferResource) { | 15 , GrVkBuffer(desc, bufferResource) { |
16 this->registerWithCache(); | 16 this->registerWithCache(SkBudgeted::kYes); |
17 } | 17 } |
18 | 18 |
19 GrVkVertexBuffer* GrVkVertexBuffer::Create(GrVkGpu* gpu, size_t size, bool dynam
ic) { | 19 GrVkVertexBuffer* GrVkVertexBuffer::Create(GrVkGpu* gpu, size_t size, bool dynam
ic) { |
20 GrVkBuffer::Desc desc; | 20 GrVkBuffer::Desc desc; |
21 desc.fDynamic = dynamic; | 21 desc.fDynamic = dynamic; |
22 desc.fType = GrVkBuffer::kVertex_Type; | 22 desc.fType = GrVkBuffer::kVertex_Type; |
23 desc.fSizeInBytes = size; | 23 desc.fSizeInBytes = size; |
24 | 24 |
25 const GrVkBuffer::Resource* bufferResource = GrVkBuffer::Create(gpu, desc); | 25 const GrVkBuffer::Resource* bufferResource = GrVkBuffer::Create(gpu, desc); |
26 if (!bufferResource) { | 26 if (!bufferResource) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 return this->vkUpdateData(this->getVkGpu(), src, srcSizeInBytes); | 64 return this->vkUpdateData(this->getVkGpu(), src, srcSizeInBytes); |
65 } else { | 65 } else { |
66 return false; | 66 return false; |
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 GrVkGpu* GrVkVertexBuffer::getVkGpu() const { | 70 GrVkGpu* GrVkVertexBuffer::getVkGpu() const { |
71 SkASSERT(!this->wasDestroyed()); | 71 SkASSERT(!this->wasDestroyed()); |
72 return static_cast<GrVkGpu*>(this->getGpu()); | 72 return static_cast<GrVkGpu*>(this->getGpu()); |
73 } | 73 } |
OLD | NEW |