An object that allocates device memory. More...
#include <allocator.h>
Public Member Functions | |
| virtual | ~Allocator () |
| bool | IsValid () const |
| std::shared_ptr< DeviceBuffer > | CreateBuffer (const DeviceBufferDescriptor &desc) |
| std::shared_ptr< Texture > | CreateTexture (const TextureDescriptor &desc, bool threadsafe=false) |
| Creates a new texture. | |
| virtual uint16_t | MinimumBytesPerRow (PixelFormat format) const |
Minimum value for row_bytes on a Texture. The row bytes parameter of that method must be aligned to this value. | |
| std::shared_ptr< DeviceBuffer > | CreateBufferWithCopy (const uint8_t *buffer, size_t length) |
| std::shared_ptr< DeviceBuffer > | CreateBufferWithCopy (const fml::Mapping &mapping) |
| virtual ISize | GetMaxTextureSizeSupported () const =0 |
| virtual void | DebugTraceMemoryStatistics () const |
| Write debug memory usage information to the dart timeline in debug and profile modes. | |
| virtual Bytes | DebugGetHeapUsage () const |
Protected Member Functions | |
| Allocator () | |
| virtual std::shared_ptr< DeviceBuffer > | OnCreateBuffer (const DeviceBufferDescriptor &desc)=0 |
| virtual std::shared_ptr< Texture > | OnCreateTexture (const TextureDescriptor &desc, bool threadsafe=false)=0 |
An object that allocates device memory.
Definition at line 24 of file allocator.h.
|
virtualdefault |
|
protecteddefault |
| std::shared_ptr< DeviceBuffer > impeller::Allocator::CreateBuffer | ( | const DeviceBufferDescriptor & | desc | ) |
Definition at line 44 of file allocator.cc.
References OnCreateBuffer().
Referenced by CreateBufferWithCopy().
| std::shared_ptr< DeviceBuffer > impeller::Allocator::CreateBufferWithCopy | ( | const fml::Mapping & | mapping | ) |
Definition at line 39 of file allocator.cc.
References CreateBufferWithCopy(), fml::Mapping::GetMapping(), and fml::Mapping::GetSize().
| std::shared_ptr< DeviceBuffer > impeller::Allocator::CreateBufferWithCopy | ( | const uint8_t * | buffer, |
| size_t | length | ||
| ) |
Definition at line 18 of file allocator.cc.
References CreateBuffer(), impeller::kHostVisible, length, impeller::DeviceBufferDescriptor::size, and impeller::DeviceBufferDescriptor::storage_mode.
Referenced by CreateBufferWithCopy().
| std::shared_ptr< Texture > impeller::Allocator::CreateTexture | ( | const TextureDescriptor & | desc, |
| bool | threadsafe = false |
||
| ) |
Creates a new texture.
| [in] | desc | The descriptor of the texture to create. |
| [in] | threadsafe | Whether mutations to this texture should be protected with a threadsafe barrier. |
This parameter only affects the OpenGLES rendering backend.
If any interaction with this texture (including creation) will be done on a thread other than where the OpenGLES context resides, then threadsafe, must be set to true.
Definition at line 49 of file allocator.cc.
References GetMaxTextureSizeSupported(), impeller::TSize< T >::height, impeller::TextureDescriptor::mip_count, impeller::TSize< T >::MipCount(), OnCreateTexture(), impeller::TextureDescriptor::size, VALIDATION_LOG, and impeller::TSize< T >::width.
Referenced by impeller::RenderTarget::SetupDepthStencilAttachments().
|
inlinevirtual |
Reimplemented in impeller::AllocatorMTL, and impeller::AllocatorVK.
Definition at line 72 of file allocator.h.
|
inlinevirtual |
Write debug memory usage information to the dart timeline in debug and profile modes.
This is supported on both the Metal and Vulkan backends.
Definition at line 69 of file allocator.h.
|
pure virtual |
Implemented in impeller::testing::FailingAllocator, impeller::testing::FlushTestAllocator, and impeller::testing::TestAllocator.
Referenced by CreateTexture().
| bool impeller::Allocator::IsValid | ( | ) | const |
|
virtual |
Minimum value for row_bytes on a Texture. The row bytes parameter of that method must be aligned to this value.
Definition at line 69 of file allocator.cc.
References impeller::BytesPerPixelForPixelFormat(), and format.
|
protectedpure virtual |
Implemented in impeller::testing::FailingAllocator, impeller::testing::FlushTestAllocator, and impeller::testing::TestAllocator.
Referenced by CreateBuffer().
|
protectedpure virtual |
Implemented in impeller::testing::FailingAllocator, impeller::testing::FlushTestAllocator, and impeller::testing::TestAllocator.
Referenced by CreateTexture().