Flutter Engine
 
Loading...
Searching...
No Matches
device_buffer_gles.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_DEVICE_BUFFER_GLES_H_
6#define FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_DEVICE_BUFFER_GLES_H_
7
8#include <cstdint>
9#include <memory>
10
15
16namespace impeller {
17
19 : public DeviceBuffer,
20 public BackendCast<DeviceBufferGLES, DeviceBuffer> {
21 public:
23 std::shared_ptr<ReactorGLES> reactor,
24 std::shared_ptr<Allocation> backing_store);
25
26 // |DeviceBuffer|
27 ~DeviceBufferGLES() override;
28
29 const uint8_t* GetBufferData() const;
30
32 const std::function<void(uint8_t*, size_t length)>& update_buffer_data);
33
39
40 [[nodiscard]] bool BindAndUploadDataIfNecessary(BindingType type) const;
41
42 void Flush(std::optional<Range> range = std::nullopt) const override;
43
44 std::optional<GLuint> GetHandle() const;
45
46 private:
47 std::shared_ptr<ReactorGLES> reactor_;
48 std::optional<std::string> label_;
49 // Mutable for lazy evaluation.
50 mutable std::optional<HandleGLES> handle_;
51 mutable std::shared_ptr<Allocation> backing_store_;
52 mutable std::optional<Range> dirty_range_ = std::nullopt;
53 mutable bool initialized_ = false;
54
55 // |DeviceBuffer|
56 uint8_t* OnGetContents() const override;
57
58 // |DeviceBuffer|
59 bool OnCopyHostBuffer(const uint8_t* source,
60 Range source_range,
61 size_t offset) override;
62
63 // |DeviceBuffer|
64 bool SetLabel(std::string_view label) override;
65
66 // |DeviceBuffer|
67 bool SetLabel(std::string_view label, Range range) override;
68
69 DeviceBufferGLES(const DeviceBufferGLES&) = delete;
70
71 DeviceBufferGLES& operator=(const DeviceBufferGLES&) = delete;
72};
73
74} // namespace impeller
75
76#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_DEVICE_BUFFER_GLES_H_
GLenum type
void Flush(std::optional< Range > range=std::nullopt) const override
void UpdateBufferData(const std::function< void(uint8_t *, size_t length)> &update_buffer_data)
bool BindAndUploadDataIfNecessary(BindingType type) const
const uint8_t * GetBufferData() const
std::optional< GLuint > GetHandle() const
size_t length