Flutter Engine
The Flutter Engine
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 ReactorGLES::Ref 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
34 enum class BindingType {
35 kArrayBuffer,
36 kElementArrayBuffer,
37 };
38
39 [[nodiscard]] bool BindAndUploadDataIfNecessary(BindingType type) const;
40
41 void Flush(std::optional<Range> range = std::nullopt) const override;
42
43 private:
44 ReactorGLES::Ref reactor_;
45 HandleGLES handle_;
46 mutable std::shared_ptr<Allocation> backing_store_;
47 mutable uint32_t generation_ = 0;
48 mutable uint32_t upload_generation_ = 0;
49
50 // |DeviceBuffer|
51 uint8_t* OnGetContents() const override;
52
53 // |DeviceBuffer|
54 bool OnCopyHostBuffer(const uint8_t* source,
55 Range source_range,
56 size_t offset) override;
57
58 // |DeviceBuffer|
59 bool SetLabel(const std::string& label) override;
60
61 // |DeviceBuffer|
62 bool SetLabel(const std::string& label, Range range) override;
63
64 DeviceBufferGLES(const DeviceBufferGLES&) = delete;
65
66 DeviceBufferGLES& operator=(const DeviceBufferGLES&) = delete;
67};
68
69} // namespace impeller
70
71#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_DEVICE_BUFFER_GLES_H_
GLenum type
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)
bool BindAndUploadDataIfNecessary(BindingType type) const
const uint8_t * GetBufferData() const
std::shared_ptr< ReactorGLES > Ref
Definition: reactor_gles.h:86
SkBitmap source
Definition: examples.cpp:28
Dart_NativeFunction function
Definition: fuchsia.cc:51
size_t length
SeparatedVector2 offset