#include <device_buffer_gles.h>
Definition at line 18 of file device_buffer_gles.h.
◆ BindingType
◆ DeviceBufferGLES()
Definition at line 17 of file device_buffer_gles.cc.
21 reactor_(std::move(reactor)),
23 : HandleGLES::DeadHandle()),
24 backing_store_(
std::move(backing_store)) {}
DeviceBuffer(DeviceBufferDescriptor desc)
◆ ~DeviceBufferGLES()
impeller::DeviceBufferGLES::~DeviceBufferGLES |
( |
| ) |
|
|
override |
Definition at line 27 of file device_buffer_gles.cc.
27 {
29 reactor_->CollectHandle(handle_);
30 }
31}
constexpr bool IsDead() const
◆ BindAndUploadDataIfNecessary()
bool impeller::DeviceBufferGLES::BindAndUploadDataIfNecessary |
( |
BindingType |
type | ) |
const |
Definition at line 74 of file device_buffer_gles.cc.
74 {
75 if (!reactor_) {
76 return false;
77 }
78
79 auto buffer = reactor_->GetGLHandle(handle_);
81 return false;
82 }
83
85 const auto&
gl = reactor_->GetProcTable();
86
87 gl.BindBuffer(target_type,
buffer.value());
88
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_;
95 }
96
97 return true;
98}
static const uint8_t buffer[]
static GLenum ToTarget(DeviceBufferGLES::BindingType type)
#define TRACE_EVENT1(category_group, name, arg1_name, arg1_val)
◆ Flush()
void impeller::DeviceBufferGLES::Flush |
( |
std::optional< Range > |
range = std::nullopt | ) |
const |
|
overridevirtual |
Make any pending writes visible to the GPU.
This method must be called if the device pointer provided by [OnGetContents] is written to without using [CopyHostBuffer]. On Devices with coherent host memory, this method will not perform extra work.
If the range is not provided, the entire buffer is flushed.
Reimplemented from impeller::DeviceBuffer.
Definition at line 60 of file device_buffer_gles.cc.
60 {
61 generation_++;
62}
◆ GetBufferData()
const uint8_t * impeller::DeviceBufferGLES::GetBufferData |
( |
| ) |
const |
◆ OnCopyHostBuffer()
bool impeller::DeviceBufferGLES::OnCopyHostBuffer |
( |
const uint8_t * |
source, |
|
|
Range |
source_range, |
|
|
size_t |
offset |
|
) |
| |
|
overrideprivatevirtual |
Implements impeller::DeviceBuffer.
Definition at line 42 of file device_buffer_gles.cc.
44 {
45 if (!reactor_) {
46 return false;
47 }
48
49 if (
offset + source_range.length > backing_store_->GetLength()) {
50 return false;
51 }
52
53 std::memmove(backing_store_->GetBuffer() +
offset,
54 source + source_range.offset, source_range.length);
55 ++generation_;
56
57 return true;
58}
◆ OnGetContents()
uint8_t * impeller::DeviceBufferGLES::OnGetContents |
( |
| ) |
const |
|
overrideprivatevirtual |
◆ SetLabel() [1/2]
bool impeller::DeviceBufferGLES::SetLabel |
( |
const std::string & |
label | ) |
|
|
overrideprivatevirtual |
◆ SetLabel() [2/2]
bool impeller::DeviceBufferGLES::SetLabel |
( |
const std::string & |
label, |
|
|
Range |
range |
|
) |
| |
|
overrideprivatevirtual |
◆ UpdateBufferData()
void impeller::DeviceBufferGLES::UpdateBufferData |
( |
const std::function< void(uint8_t *, size_t length)> & |
update_buffer_data | ) |
|
Definition at line 117 of file device_buffer_gles.cc.
119 {
120 if (update_buffer_data) {
121 update_buffer_data(backing_store_->GetBuffer(),
122 backing_store_->GetLength());
123 ++generation_;
124 }
125}
The documentation for this class was generated from the following files: