| Flutter Impeller |

Public Types | Public Member Functions | List of all members
impeller::DeviceBufferGLES Class Referencefinal

`#include <device_buffer_gles.h>`

Inheritance diagram for impeller::DeviceBufferGLES:

## Public Types
enum | BindingType { BindingType::kArrayBuffer, BindingType::kElementArrayBuffer }

## Public Member Functions
| DeviceBufferGLES (DeviceBufferDescriptor desc, ReactorGLES::Ref reactor, std::shared_ptr< Allocation > backing_store)
| ~DeviceBufferGLES () override
const uint8_t * | GetBufferData () const
void | UpdateBufferData (const std::function< void(uint8_t *, size_t length)> &update_buffer_data)
bool | BindAndUploadDataIfNecessary (BindingType type) const
Public Member Functions inherited from impeller::DeviceBuffer
virtual | ~DeviceBuffer ()
bool | CopyHostBuffer (const uint8_t *source, Range source_range, size_t offset=0u)
BufferView | AsBufferView () const
virtual std::shared_ptr< Texture > | AsTexture (Allocator &allocator, const TextureDescriptor &descriptor, uint16_t row_bytes) const
std::shared_ptr< const DeviceBuffer > | GetDeviceBuffer (Allocator &allocator) const
const DeviceBufferDescriptor & | GetDeviceBufferDescriptor () const
Public Member Functions inherited from impeller::Buffer
virtual | ~Buffer ()

## Additional Inherited Members
Static Public Member Functions inherited from impeller::BackendCast< DeviceBufferGLES, DeviceBuffer >
static DeviceBufferGLES & | Cast (DeviceBuffer &base)
static const DeviceBufferGLES & | Cast (const DeviceBuffer &base)
static DeviceBufferGLES * | Cast (DeviceBuffer *base)
static const DeviceBufferGLES * | Cast (const DeviceBuffer *base)
Protected Member Functions inherited from impeller::DeviceBuffer
| DeviceBuffer (DeviceBufferDescriptor desc)
Protected Attributes inherited from impeller::DeviceBuffer
const DeviceBufferDescriptor | desc_

## Detailed Description

Definition at line 17 of file device_buffer_gles.h.

## Member Enumeration Documentation

## ◆ BindingType

enum impeller::DeviceBufferGLES::BindingType
| strong

Enumerator
kArrayBuffer |
kElementArrayBuffer |

Definition at line 33 of file device_buffer_gles.h.

33 {
34 kArrayBuffer,
35 kElementArrayBuffer,
36 };

## Constructor & Destructor Documentation

## ◆ DeviceBufferGLES()

impeller::DeviceBufferGLES::DeviceBufferGLES | ( | DeviceBufferDescriptor | desc,
|  | ReactorGLES::Ref | reactor,
|  | std::shared_ptr< Allocation > | backing_store
| ) |  |

Definition at line 17 of file device_buffer_gles.cc.

20 : DeviceBuffer(desc),
21 reactor_(std::move(reactor)),
22 handle_(reactor_ ? reactor_->CreateHandle(HandleType::kBuffer)
23 : HandleGLES::DeadHandle()),
24 backing_store_(std::move(backing_store)) {}

References impeller::kBuffer.

## ◆ ~DeviceBufferGLES()

impeller::DeviceBufferGLES::~DeviceBufferGLES | ( |  | ) |
| override

Definition at line 27 of file device_buffer_gles.cc.

27 {
28 if (!handle_.IsDead()) {
29 reactor_->CollectHandle(handle_);
30 }
31 }

References impeller::HandleGLES::IsDead().

## Member Function Documentation

## ◆ BindAndUploadDataIfNecessary()

bool impeller::DeviceBufferGLES::BindAndUploadDataIfNecessary | ( | BindingType | type | ) | const

Definition at line 70 of file device_buffer_gles.cc.

70 {
71 if (!reactor_) {
72 return false;
73 }
74
75 auto buffer = reactor_->GetGLHandle(handle_);
76 if (!buffer.has_value()) {
77 return false;
78 }
79
80 const auto target_type = ToTarget(type);
81 const auto& gl = reactor_->GetProcTable();
82
83 gl.BindBuffer(target_type, buffer.value());
84
85 if (upload_generation_ != generation_) {
86 TRACE_EVENT1("impeller", "BufferData", "Bytes",
87 std::to_string(backing_store_->GetLength()).c_str());
88 gl.BufferData(target_type, backing_store_->GetLength(),
89 backing_store_->GetBuffer(), GL_STATIC_DRAW);
90 upload_generation_ = generation_;
91 }
92
93 return true;
94 }

References impeller::ToTarget().

## ◆ GetBufferData()

const uint8_t * impeller::DeviceBufferGLES::GetBufferData | ( |  | ) | const

Definition at line 109 of file device_buffer_gles.cc.

109 {
110 return backing_store_->GetBuffer();
111 }

## ◆ UpdateBufferData()

void impeller::DeviceBufferGLES::UpdateBufferData | ( | const std::function< void(uint8_t *, size_t length)> & | update_buffer_data | ) |

Definition at line 113 of file device_buffer_gles.cc.

115 {
116 if (update_buffer_data) {
117 update_buffer_data(backing_store_->GetBuffer(),
118 backing_store_->GetLength());
119 ++generation_;
120 }
121 }

Referenced by impeller::BlitCopyTextureToBufferCommandGLES::Encode().

The documentation for this class was generated from the following files:

- impeller/renderer/backend/gles/device_buffer_gles.h
- impeller/renderer/backend/gles/device_buffer_gles.cc

impeller::HandleGLES::DeadHandle
static HandleGLES DeadHandle()
Definition: handle_gles.h:38
impeller::DeviceBuffer::DeviceBuffer
DeviceBuffer(DeviceBufferDescriptor desc)
Definition: device_buffer.cc:9
impeller::HandleGLES::IsDead
constexpr bool IsDead() const
Definition: handle_gles.h:42
impeller::ToTarget
static GLenum ToTarget(DeviceBufferGLES::BindingType type)
Definition: device_buffer_gles.cc:60
impeller::HandleType::kBuffer
@ kBuffer