Flutter Engine
 
Loading...
Searching...
No Matches
impeller::DeviceBuffer Class Referenceabstract

#include <device_buffer.h>

Inheritance diagram for impeller::DeviceBuffer:
impeller::DeviceBufferGLES impeller::DeviceBufferMTL impeller::DeviceBufferVK impeller::TestImpellerDeviceBuffer impeller::testing::FlushTestDeviceBuffer impeller::testing::MockDeviceBuffer

Public Member Functions

virtual ~DeviceBuffer ()
 
bool CopyHostBuffer (const uint8_t *source, Range source_range, size_t offset=0u)
 
virtual bool SetLabel (std::string_view label)=0
 
virtual bool SetLabel (std::string_view label, Range range)=0
 
const DeviceBufferDescriptorGetDeviceBufferDescriptor () const
 
virtual uint8_t * OnGetContents () const =0
 
virtual void Flush (std::optional< Range > range=std::nullopt) const
 
virtual void Invalidate (std::optional< Range > range=std::nullopt) const
 

Static Public Member Functions

static BufferView AsBufferView (std::shared_ptr< DeviceBuffer > buffer)
 Create a buffer view of this entire buffer.
 

Protected Member Functions

 DeviceBuffer (DeviceBufferDescriptor desc)
 
virtual bool OnCopyHostBuffer (const uint8_t *source, Range source_range, size_t offset)=0
 

Protected Attributes

const DeviceBufferDescriptor desc_
 

Detailed Description

Definition at line 18 of file device_buffer.h.

Constructor & Destructor Documentation

◆ ~DeviceBuffer()

impeller::DeviceBuffer::~DeviceBuffer ( )
virtualdefault

◆ DeviceBuffer()

impeller::DeviceBuffer::DeviceBuffer ( DeviceBufferDescriptor  desc)
explicitprotected

Definition at line 9 of file device_buffer.cc.

9: desc_(desc) {}
const DeviceBufferDescriptor desc_

Member Function Documentation

◆ AsBufferView()

BufferView impeller::DeviceBuffer::AsBufferView ( std::shared_ptr< DeviceBuffer buffer)
static

Create a buffer view of this entire buffer.

Definition at line 18 of file device_buffer.cc.

18 {
19 Range range = {0u, buffer->desc_.size};
20 return BufferView(std::move(buffer), range);
21}
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 disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set profile Make the profiler discard new samples once the profiler sample buffer is full When this flag is not the profiler sample buffer is used as a ring buffer
Definition switch_defs.h:98

Referenced by impeller::testing::CreateTestYUVTextures(), impeller::CreateTexture(), impeller::Playground::CreateTextureCubeForFixture(), impeller::CreateTextureForDecompressedImage(), ImGui_ImplImpeller_Init(), 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().

◆ CopyHostBuffer()

bool impeller::DeviceBuffer::CopyHostBuffer ( const uint8_t *  source,
Range  source_range,
size_t  offset = 0u 
)

Definition at line 27 of file device_buffer.cc.

29 {
30 if (source_range.length == 0u) {
31 // Nothing to copy. Bail.
32 return true;
33 }
34
35 if (source == nullptr) {
36 // Attempted to copy data from a null buffer.
37 return false;
38 }
39
41 // One of the storage modes where a transfer queue must be used.
42 return false;
43 }
44
45 if (offset + source_range.length > desc_.size) {
46 // Out of bounds of this buffer.
47 return false;
48 }
49
50 return OnCopyHostBuffer(source, source_range, offset);
51}
virtual bool OnCopyHostBuffer(const uint8_t *source, Range source_range, size_t offset)=0

References desc_, impeller::kHostVisible, impeller::Range::length, OnCopyHostBuffer(), impeller::DeviceBufferDescriptor::size, and impeller::DeviceBufferDescriptor::storage_mode.

◆ Flush()

void impeller::DeviceBuffer::Flush ( std::optional< Range range = std::nullopt) const
virtual

Make any pending writes visible to the GPU.

This method must be called if the device pointer provided by [OnGetContents] is written to without using [CopyHostBuffer]. On Devices with coherent host memory, this method will not perform extra work.

If the range is not provided, the entire buffer is flushed.

Reimplemented in impeller::testing::FlushTestDeviceBuffer, and impeller::DeviceBufferGLES.

Definition at line 13 of file device_buffer.cc.

13{}

Referenced by impeller::Tessellator::TessellateConvex().

◆ GetDeviceBufferDescriptor()

const DeviceBufferDescriptor & impeller::DeviceBuffer::GetDeviceBufferDescriptor ( ) const

Definition at line 23 of file device_buffer.cc.

23 {
24 return desc_;
25}

References desc_.

◆ Invalidate()

void impeller::DeviceBuffer::Invalidate ( std::optional< Range range = std::nullopt) const
virtual

Definition at line 15 of file device_buffer.cc.

15{}

◆ OnCopyHostBuffer()

virtual bool impeller::DeviceBuffer::OnCopyHostBuffer ( const uint8_t *  source,
Range  source_range,
size_t  offset 
)
protectedpure virtual

◆ OnGetContents()

virtual uint8_t * impeller::DeviceBuffer::OnGetContents ( ) const
pure virtual

◆ SetLabel() [1/2]

virtual bool impeller::DeviceBuffer::SetLabel ( std::string_view  label)
pure virtual

◆ SetLabel() [2/2]

virtual bool impeller::DeviceBuffer::SetLabel ( std::string_view  label,
Range  range 
)
pure virtual

Member Data Documentation

◆ desc_

const DeviceBufferDescriptor impeller::DeviceBuffer::desc_
protected

Definition at line 49 of file device_buffer.h.

Referenced by CopyHostBuffer(), and GetDeviceBufferDescriptor().


The documentation for this class was generated from the following files: