Index: src/gpu/vk/GrVkGpu.cpp |
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp |
index 28dce344be37659f0e18b4fbd768dc0b7164461f..b23cced41d81a2016e748ae37f5b49295f52580c 100644 |
--- a/src/gpu/vk/GrVkGpu.cpp |
+++ b/src/gpu/vk/GrVkGpu.cpp |
@@ -172,26 +172,32 @@ void GrVkGpu::submitCommandBuffer(SyncQueue sync) { |
} |
/////////////////////////////////////////////////////////////////////////////// |
-GrBuffer* GrVkGpu::onCreateBuffer(size_t size, GrBufferType type, GrAccessPattern accessPattern) { |
+GrBuffer* GrVkGpu::onCreateBuffer(size_t size, GrBufferType type, GrAccessPattern accessPattern, |
+ const void* data) { |
+ GrBuffer* buff; |
switch (type) { |
case kVertex_GrBufferType: |
SkASSERT(kDynamic_GrAccessPattern == accessPattern || |
kStatic_GrAccessPattern == accessPattern); |
- return GrVkVertexBuffer::Create(this, size, kDynamic_GrAccessPattern == accessPattern); |
+ buff = GrVkVertexBuffer::Create(this, size, kDynamic_GrAccessPattern == accessPattern); |
case kIndex_GrBufferType: |
SkASSERT(kDynamic_GrAccessPattern == accessPattern || |
kStatic_GrAccessPattern == accessPattern); |
- return GrVkIndexBuffer::Create(this, size, kDynamic_GrAccessPattern == accessPattern); |
+ buff = GrVkIndexBuffer::Create(this, size, kDynamic_GrAccessPattern == accessPattern); |
case kXferCpuToGpu_GrBufferType: |
SkASSERT(kStream_GrAccessPattern == accessPattern); |
- return GrVkTransferBuffer::Create(this, size, GrVkBuffer::kCopyRead_Type); |
+ buff = GrVkTransferBuffer::Create(this, size, GrVkBuffer::kCopyRead_Type); |
case kXferGpuToCpu_GrBufferType: |
SkASSERT(kStream_GrAccessPattern == accessPattern); |
- return GrVkTransferBuffer::Create(this, size, GrVkBuffer::kCopyWrite_Type); |
+ buff = GrVkTransferBuffer::Create(this, size, GrVkBuffer::kCopyWrite_Type); |
default: |
SkFAIL("Unknown buffer type."); |
return nullptr; |
} |
+ if (data && buff) { |
+ buff->updateData(data, size); |
+ } |
+ return buff; |
} |
//////////////////////////////////////////////////////////////////////////////// |