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