5#include "flutter/lib/gpu/device_buffer.h"
8#include "flutter/lib/gpu/formats.h"
24 std::shared_ptr<impeller::DeviceBuffer> device_buffer)
25 : device_buffer_(
std::move(device_buffer)) {}
30 return device_buffer_;
34 size_t destination_offset_in_bytes) {
35 if (!device_buffer_->CopyHostBuffer(
36 reinterpret_cast<const uint8_t*
>(source_bytes.
data()),
38 destination_offset_in_bytes)) {
58 desc.size = size_in_bytes;
60 gpu_context->
GetContext()->GetResourceAllocator()->CreateBuffer(
desc);
67 fml::MakeRefCounted<flutter::gpu::DeviceBuffer>(std::move(device_buffer));
68 res->AssociateWithDartWrapper(wrapper);
79 data.length_in_bytes());
81 gpu_context->
GetContext()->GetResourceAllocator()->CreateBufferWithCopy(
84 FML_LOG(
ERROR) <<
"Failed to create device buffer with copy.";
89 fml::MakeRefCounted<flutter::gpu::DeviceBuffer>(std::move(device_buffer));
90 res->AssociateWithDartWrapper(wrapper);
98 int destination_offset_in_bytes) {
100 destination_offset_in_bytes);
std::shared_ptr< impeller::Context > GetContext()
bool Overwrite(const tonic::DartByteData &source_bytes, size_t destination_offset_in_bytes)
std::shared_ptr< impeller::DeviceBuffer > GetBuffer()
DeviceBuffer(std::shared_ptr< impeller::DeviceBuffer > device_buffer)
const void * data() const
size_t length_in_bytes() const
struct _Dart_Handle * Dart_Handle
#define FML_LOG(severity)
bool InternalFlutterGpu_DeviceBuffer_Initialize(Dart_Handle wrapper, flutter::gpu::Context *gpu_context, int storage_mode, int size_in_bytes)
bool InternalFlutterGpu_DeviceBuffer_InitializeWithHostData(Dart_Handle wrapper, flutter::gpu::Context *gpu_context, Dart_Handle byte_data)
bool InternalFlutterGpu_DeviceBuffer_Overwrite(flutter::gpu::DeviceBuffer *device_buffer, Dart_Handle source_byte_data, int destination_offset_in_bytes)
IMPLEMENT_WRAPPERTYPEINFO(flutter_gpu, CommandBuffer)
constexpr impeller::StorageMode ToImpellerStorageMode(FlutterGPUStorageMode value)
std::shared_ptr< const fml::Mapping > data