7 #include "flutter/fml/trace_event.h"
12 std::weak_ptr<Context> context,
14 VmaAllocationInfo info)
16 context_(
std::move(context)),
17 resource_(
ContextVK::Cast(*context_.lock().get()).GetResourceManager(),
25 uint8_t* DeviceBufferVK::OnGetContents()
const {
26 return static_cast<uint8_t*
>(resource_->info.pMappedData);
29 bool DeviceBufferVK::OnCopyHostBuffer(
const uint8_t* source,
32 TRACE_EVENT0(
"impeller",
"CopyToDeviceBuffer");
33 uint8_t* dest = OnGetContents();
40 ::memmove(dest + offset, source + source_range.offset, source_range.length);
42 ::vmaFlushAllocation(resource_->buffer.get().allocator,
43 resource_->buffer.get().allocation, offset,
49 bool DeviceBufferVK::SetLabel(
const std::string& label) {
50 auto context = context_.lock();
51 if (!context || !resource_->buffer.is_valid()) {
56 ::vmaSetAllocationName(resource_->buffer.get().allocator,
57 resource_->buffer.get().allocation,
65 bool DeviceBufferVK::SetLabel(
const std::string& label, Range range) {
67 return SetLabel(label);
71 return resource_->buffer.get().buffer;