#include <device_buffer_mtl.h>
Definition at line 16 of file device_buffer_mtl.h.
◆ DeviceBufferMTL()
impeller::DeviceBufferMTL::DeviceBufferMTL |
( |
| ) |
|
◆ ~DeviceBufferMTL()
impeller::DeviceBufferMTL::~DeviceBufferMTL |
( |
| ) |
|
|
overridedefault |
◆ AsTexture()
Reimplemented from impeller::DeviceBuffer.
Definition at line 32 of file device_buffer_mtl.mm.
35 {
37
38 if (!mtl_texture_desc) {
40 return nullptr;
41 }
42
43 if (@available(iOS 13.0, macos 10.15, *)) {
44 mtl_texture_desc.resourceOptions = buffer_.resourceOptions;
45 }
46
47 auto texture = [buffer_ newTextureWithDescriptor:mtl_texture_desc
49 bytesPerRow:row_bytes];
51 return nullptr;
52 }
54}
static std::shared_ptr< TextureMTL > Create(TextureDescriptor desc, id< MTLTexture > texture)
MTLTextureDescriptor * ToMTLTextureDescriptor(const TextureDescriptor &desc)
◆ Flush()
void impeller::DeviceBufferMTL::Flush |
( |
std::optional< Range > |
range | ) |
const |
|
overrideprivatevirtual |
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 from impeller::DeviceBuffer.
Definition at line 81 of file device_buffer_mtl.mm.
81 {
82#if !FML_OS_IOS
84 if (storage_mode_ == MTLStorageModeManaged) {
85 [buffer_
86 didModifyRange:NSMakeRange(flush_range.offset, flush_range.length)];
87 }
88#endif
89}
const DeviceBufferDescriptor & GetDeviceBufferDescriptor() const
◆ GetMTLBuffer()
id< MTLBuffer > impeller::DeviceBufferMTL::GetMTLBuffer |
( |
| ) |
const |
◆ OnCopyHostBuffer()
bool impeller::DeviceBufferMTL::OnCopyHostBuffer |
( |
const uint8_t * |
source, |
|
|
Range |
source_range, |
|
|
size_t |
offset |
|
) |
| |
|
overrideprivatevirtual |
Implements impeller::DeviceBuffer.
Definition at line 56 of file device_buffer_mtl.mm.
58 {
59 auto dest =
static_cast<uint8_t*
>(buffer_.contents);
60
61 if (!dest) {
62 return false;
63 }
64
66 ::memmove(dest +
offset,
source + source_range.offset, source_range.length);
67 }
68
69
70
71
72#if !FML_OS_IOS
73 if (storage_mode_ == MTLStorageModeManaged) {
74 [buffer_ didModifyRange:NSMakeRange(
offset, source_range.length)];
75 }
76#endif
77
78 return true;
79}
◆ OnGetContents()
uint8_t * impeller::DeviceBufferMTL::OnGetContents |
( |
| ) |
const |
|
overrideprivatevirtual |
Implements impeller::DeviceBuffer.
Definition at line 25 of file device_buffer_mtl.mm.
25 {
26 if (storage_mode_ != MTLStorageModeShared) {
27 return nullptr;
28 }
29 return reinterpret_cast<uint8_t*>(buffer_.contents);
30}
◆ SetLabel() [1/2]
bool impeller::DeviceBufferMTL::SetLabel |
( |
const std::string & |
label | ) |
|
|
overrideprivatevirtual |
◆ SetLabel() [2/2]
bool impeller::DeviceBufferMTL::SetLabel |
( |
const std::string & |
label, |
|
|
Range |
range |
|
) |
| |
|
overrideprivatevirtual |
◆ AllocatorMTL
The documentation for this class was generated from the following files: