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

Unified Diff: src/gpu/vk/GrVkGpu.cpp

Issue 1877073002: Add optional data parameter to createBuffer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/vk/GrVkGpu.h ('k') | tools/gpu/GrTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/gpu/vk/GrVkGpu.h ('k') | tools/gpu/GrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698