5#ifndef FLUTTER_IMPELLER_CORE_HOST_BUFFER_H_
6#define FLUTTER_IMPELLER_CORE_HOST_BUFFER_H_
30 static std::shared_ptr<HostBuffer>
Create(
31 const std::shared_ptr<Allocator>& allocator);
48 template <
class UniformType,
49 class = std::enable_if_t<std::is_standard_layout_v<UniformType>>>
51 const auto alignment =
53 return Emplace(
reinterpret_cast<const void*
>(&uniform),
70 class StorageBufferType,
71 class = std::enable_if_t<std::is_standard_layout_v<StorageBufferType>>>
73 const StorageBufferType&
buffer) {
74 const auto alignment =
77 sizeof(StorageBufferType),
94 class = std::enable_if_t<std::is_standard_layout_v<BufferType>>>
96 size_t alignment = 0) {
139 [[nodiscard]] std::tuple<Range, std::shared_ptr<DeviceBuffer>>
142 std::tuple<Range, std::shared_ptr<DeviceBuffer>>
145 std::tuple<Range, std::shared_ptr<DeviceBuffer>>
146 EmplaceInternal(
const void*
buffer,
size_t length,
size_t align);
148 size_t GetLength()
const {
return offset_; }
150 void MaybeCreateNewBuffer();
152 const std::shared_ptr<DeviceBuffer>& GetCurrentBuffer()
const;
156 explicit HostBuffer(
const std::shared_ptr<Allocator>& allocator);
162 std::shared_ptr<Allocator> allocator_;
165 size_t current_buffer_ = 0u;
167 size_t frame_index_ = 0u;
void SetLabel(std::string label)
BufferView Emplace(const BufferType &buffer, size_t alignment=0)
Emplace non-uniform data (like contiguous vertices) onto the host buffer.
TestStateQuery GetStateForTest()
Retrieve internal buffer state for test expectations.
static std::shared_ptr< HostBuffer > Create(const std::shared_ptr< Allocator > &allocator)
BufferView EmplaceUniform(const UniformType &uniform)
Emplace uniform data onto the host buffer. Ensure that backend specific uniform alignment requirement...
BufferView EmplaceStorageBuffer(const StorageBufferType &buffer)
Emplace storage buffer data onto the host buffer. Ensure that backend specific uniform alignment requ...
std::function< void(uint8_t *buffer)> EmplaceProc
void Reset()
Resets the contents of the HostBuffer to nothing so it can be reused.
Dart_NativeFunction function
static float max(float r, float g, float b)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
static const constexpr size_t kHostBufferArenaSize
Approximately the same size as the max frames in flight.
constexpr size_t DefaultUniformAlignment()
Test only internal state.
size_t total_buffer_count