10#include "flutter/fml/trace_event.h"
19 std::shared_ptr<Allocation> backing_store)
21 reactor_(
std::move(reactor)),
24 backing_store_(
std::move(backing_store)) {}
29 reactor_->CollectHandle(handle_);
38 return backing_store_->GetBuffer();
49 if (
offset + source_range.
length > backing_store_->GetLength()) {
53 std::memmove(backing_store_->GetBuffer() +
offset,
67 return GL_ARRAY_BUFFER;
69 return GL_ELEMENT_ARRAY_BUFFER;
79 auto buffer = reactor_->GetGLHandle(handle_);
85 const auto& gl = reactor_->GetProcTable();
87 gl.BindBuffer(target_type,
buffer.value());
89 if (upload_generation_ != generation_) {
91 std::to_string(backing_store_->GetLength()).c_str());
92 gl.BufferData(target_type, backing_store_->GetLength(),
93 backing_store_->GetBuffer(), GL_STATIC_DRAW);
94 upload_generation_ = generation_;
102 reactor_->SetDebugLabel(handle_, label);
114 return backing_store_->GetBuffer();
118 const std::function<
void(uint8_t* data,
size_t length)>&
119 update_buffer_data) {
120 if (update_buffer_data) {
121 update_buffer_data(backing_store_->GetBuffer(),
122 backing_store_->GetLength());
void Flush(std::optional< Range > range=std::nullopt) const override
DeviceBufferGLES(DeviceBufferDescriptor desc, ReactorGLES::Ref reactor, std::shared_ptr< Allocation > backing_store)
void UpdateBufferData(const std::function< void(uint8_t *, size_t length)> &update_buffer_data)
uint8_t * OnGetContents() const override
bool BindAndUploadDataIfNecessary(BindingType type) const
bool SetLabel(const std::string &label) override
~DeviceBufferGLES() override
bool OnCopyHostBuffer(const uint8_t *source, Range source_range, size_t offset) override
const uint8_t * GetBufferData() const
std::shared_ptr< ReactorGLES > Ref
static const uint8_t buffer[]
#define FML_UNREACHABLE()
static GLenum ToTarget(DeviceBufferGLES::BindingType type)
constexpr bool IsDead() const
#define TRACE_EVENT1(category_group, name, arg1_name, arg1_val)