#include <host_buffer.h>
Classes | |
| struct | TestStateQuery |
| Test only internal state. More... | |
Public Types | |
| using | EmplaceProc = std::function< void(uint8_t *buffer)> |
Public Member Functions | |
| ~HostBuffer () | |
| template<class UniformType , class = std::enable_if_t<std::is_standard_layout_v<UniformType>>> | |
| BufferView | EmplaceUniform (const UniformType &uniform) |
| Emplace uniform data onto the host buffer. Ensure that backend specific uniform alignment requirements are respected. | |
| template<class StorageBufferType , class = std::enable_if_t<std::is_standard_layout_v<StorageBufferType>>> | |
| BufferView | EmplaceStorageBuffer (const StorageBufferType &buffer) |
| Emplace storage buffer data onto the host buffer. Ensure that backend specific uniform alignment requirements are respected. | |
| template<class BufferType , class = std::enable_if_t<std::is_standard_layout_v<BufferType>>> | |
| BufferView | Emplace (const BufferType &buffer, size_t alignment=0) |
| Emplace non-uniform data (like contiguous vertices) onto the host buffer. | |
| BufferView | Emplace (const void *buffer, size_t length, size_t align) |
| BufferView | Emplace (size_t length, size_t align, const EmplaceProc &cb) |
| Emplaces undefined data onto the managed buffer and gives the caller a chance to update it using the specified callback. The buffer is guaranteed to have enough space for length bytes. It is the responsibility of the caller to not exceed the bounds of the buffer returned in the EmplaceProc. | |
| size_t | GetMinimumUniformAlignment () const |
| Retrieve the minimum uniform buffer alignment in bytes. | |
| void | Reset () |
| Resets the contents of the HostBuffer to nothing so it can be reused. | |
| TestStateQuery | GetStateForTest () |
| Retrieve internal buffer state for test expectations. | |
Static Public Member Functions | |
| static std::shared_ptr< HostBuffer > | Create (const std::shared_ptr< Allocator > &allocator, const std::shared_ptr< const IdleWaiter > &idle_waiter, size_t minimum_uniform_alignment, std::shared_ptr< const GpuSubmissionTracker > submission_tracker=nullptr) |
The host buffer class manages one more 1024 Kb blocks of device buffer allocations.
These are reset per-frame.
The buffers of an arena entry are reused kHostBufferArenaSize resets after they were written. Nothing guarantees that few frames are in flight, so with a [GpuSubmissionTracker] the reuse is made safe. Entries whose GPU work has not completed by the time they come up for reuse are kept alive off to the side and replaced with fresh allocations.
Definition at line 35 of file host_buffer.h.
| using impeller::HostBuffer::EmplaceProc = std::function<void(uint8_t* buffer)> |
Definition at line 114 of file host_buffer.h.
| impeller::HostBuffer::~HostBuffer | ( | ) |
Definition at line 50 of file host_buffer.cc.
|
static |
Definition at line 21 of file host_buffer.cc.
References allocator.
Referenced by impeller::ContentContext::ContentContext(), impeller::testing::DrawCompressedTextureGolden(), impeller::testing::DrawManuallyMippedTextureGolden(), impeller::testing::FlushTestContentContext::FlushTestContentContext(), impeller::Playground::OpenPlaygroundHere(), impeller::testing::RendererDartTest::RenderDartToPlayground(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), and impeller::testing::TEST_P().
|
inline |
Emplace non-uniform data (like contiguous vertices) onto the host buffer.
| [in] | buffer | The buffer data. |
| [in] | alignment | Minimum alignment of the data being emplaced. |
| BufferType | The type of the buffer data. |
Definition at line 102 of file host_buffer.h.
References Emplace().
Referenced by impeller::BulkUpdateAtlasBitmap(), impeller::Geometry::ComputePositionGeometry(), impeller::ContentContext::ContentContext(), impeller::DlAtlasGeometry::CreateBlendVertexBuffer(), impeller::DrawImageRectAtlasGeometry::CreateBlendVertexBuffer(), impeller::DlAtlasGeometry::CreateSimpleVertexBuffer(), impeller::DrawImageRectAtlasGeometry::CreateSimpleVertexBuffer(), impeller::CreateVertexBuffer(), Emplace(), EmplaceStorageBuffer(), impeller::RuntimeEffectContents::EmplaceUniform(), EmplaceUniform(), impeller::ShadowVertices::GetPositionBuffer(), impeller::DlVerticesGeometry::GetPositionBuffer(), impeller::DlVerticesGeometry::GetPositionUVColorBuffer(), impeller::TextContents::Render(), impeller::testing::TEST_P(), and impeller::UpdateAtlasBitmap().
| BufferView impeller::HostBuffer::Emplace | ( | const void * | buffer, |
| size_t | length, | ||
| size_t | align | ||
| ) |
Definition at line 58 of file host_buffer.cc.
References length.
| BufferView impeller::HostBuffer::Emplace | ( | size_t | length, |
| size_t | align, | ||
| const EmplaceProc & | cb | ||
| ) |
Emplaces undefined data onto the managed buffer and gives the caller a chance to update it using the specified callback. The buffer is guaranteed to have enough space for length bytes. It is the responsibility of the caller to not exceed the bounds of the buffer returned in the EmplaceProc.
| [in] | cb | A callback that will be passed a ptr to the underlying host buffer. |
Definition at line 84 of file host_buffer.cc.
References length.
|
inline |
Emplace storage buffer data onto the host buffer. Ensure that backend specific uniform alignment requirements are respected.
| [in] | uniform | The storage buffer to emplace onto the buffer. |
| StorageBufferType | The type of the shader storage buffer. |
Definition at line 79 of file host_buffer.h.
References Emplace(), and GetMinimumUniformAlignment().
|
inline |
Emplace uniform data onto the host buffer. Ensure that backend specific uniform alignment requirements are respected.
| [in] | uniform | The uniform struct to emplace onto the buffer. |
| UniformType | The type of the uniform struct. |
Definition at line 57 of file host_buffer.h.
References Emplace(), and GetMinimumUniformAlignment().
Referenced by impeller::ColorSourceContents::DrawGeometry(), ImGui_ImplImpeller_RenderDrawData(), impeller::TextContents::Render(), and impeller::ClipContents::Render().
| size_t impeller::HostBuffer::GetMinimumUniformAlignment | ( | ) | const |
Retrieve the minimum uniform buffer alignment in bytes.
Definition at line 282 of file host_buffer.cc.
Referenced by impeller::BulkUpdateAtlasBitmap(), EmplaceStorageBuffer(), impeller::RuntimeEffectContents::EmplaceUniform(), EmplaceUniform(), and impeller::UpdateAtlasBitmap().
| HostBuffer::TestStateQuery impeller::HostBuffer::GetStateForTest | ( | ) |
Retrieve internal buffer state for test expectations.
Definition at line 98 of file host_buffer.cc.
References impeller::HostBuffer::TestStateQuery::current_frame.
| void impeller::HostBuffer::Reset | ( | ) |
Resets the contents of the HostBuffer to nothing so it can be reused.
Definition at line 234 of file host_buffer.cc.
References impeller::kAllocatorBlockSize, impeller::kHostBufferArenaSize, impeller::kHostVisible, impeller::DeviceBufferDescriptor::size, impeller::DeviceBufferDescriptor::storage_mode, and VALIDATION_LOG.
Referenced by ImGui_ImplImpeller_RenderDrawData(), impeller::EntityPlayground::OpenPlaygroundHere(), and impeller::EntityPlayground::OpenPlaygroundHere().