Flutter Engine
The Flutter Engine
device_buffer.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6
7namespace impeller {
8
10
12
13void DeviceBuffer::Flush(std::optional<Range> range) const {}
14
15void DeviceBuffer::Invalidate(std::optional<Range> range) const {}
16
17// static
18BufferView DeviceBuffer::AsBufferView(std::shared_ptr<DeviceBuffer> buffer) {
19 BufferView view;
20 view.buffer = std::move(buffer);
21 view.range = {0u, view.buffer->desc_.size};
22 return view;
23}
24
26 return desc_;
27}
28
29[[nodiscard]] bool DeviceBuffer::CopyHostBuffer(const uint8_t* source,
30 Range source_range,
31 size_t offset) {
32 if (source_range.length == 0u) {
33 // Nothing to copy. Bail.
34 return true;
35 }
36
37 if (source == nullptr) {
38 // Attempted to copy data from a null buffer.
39 return false;
40 }
41
43 // One of the storage modes where a transfer queue must be used.
44 return false;
45 }
46
47 if (offset + source_range.length > desc_.size) {
48 // Out of bounds of this buffer.
49 return false;
50 }
51
52 return OnCopyHostBuffer(source, source_range, offset);
53}
54
55} // namespace impeller
static BufferView AsBufferView(std::shared_ptr< DeviceBuffer > buffer)
Create a buffer view of this entire buffer.
virtual void Flush(std::optional< Range > range=std::nullopt) const
const DeviceBufferDescriptor desc_
Definition: device_buffer.h:49
virtual void Invalidate(std::optional< Range > range=std::nullopt) const
const DeviceBufferDescriptor & GetDeviceBufferDescriptor() const
DeviceBuffer(DeviceBufferDescriptor desc)
Definition: device_buffer.cc:9
virtual bool OnCopyHostBuffer(const uint8_t *source, Range source_range, size_t offset)=0
bool CopyHostBuffer(const uint8_t *source, Range source_range, size_t offset=0u)
SkBitmap source
Definition: examples.cpp:28
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
Definition: switches.h:126
SeparatedVector2 offset
std::shared_ptr< const DeviceBuffer > buffer
Definition: buffer_view.h:16
size_t length
Definition: range.h:14