Flutter Engine
 
Loading...
Searching...
No Matches
flutter_skia_vma.h
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
5#ifndef FLUTTER_FLUTTER_VMA_FLUTTER_SKIA_VMA_H_
6#define FLUTTER_FLUTTER_VMA_FLUTTER_SKIA_VMA_H_
7
9
12#include "third_party/skia/include/gpu/vk/VulkanMemoryAllocator.h"
13#include "third_party/skia/include/gpu/vk/VulkanTypes.h"
14
15namespace flutter {
16
17class FlutterSkiaVulkanMemoryAllocator : public skgpu::VulkanMemoryAllocator {
18 public:
19 static sk_sp<VulkanMemoryAllocator> Make(
20 uint32_t vulkan_api_version,
21 VkInstance instance,
22 VkPhysicalDevice physicalDevice,
23 VkDevice device,
25 bool mustUseCoherentHostVisibleMemory);
26
28
29 VkResult allocateImageMemory(VkImage image,
30 uint32_t allocationPropertyFlags,
31 skgpu::VulkanBackendMemory*) override;
32
33 VkResult allocateBufferMemory(VkBuffer buffer,
34 BufferUsage usage,
35 uint32_t allocationPropertyFlags,
36 skgpu::VulkanBackendMemory*) override;
37
38 void freeMemory(const skgpu::VulkanBackendMemory&) override;
39
40 void getAllocInfo(const skgpu::VulkanBackendMemory&,
41 skgpu::VulkanAlloc*) const override;
42
43 VkResult mapMemory(const skgpu::VulkanBackendMemory&, void** data) override;
44 void unmapMemory(const skgpu::VulkanBackendMemory&) override;
45
46 VkResult flushMemory(const skgpu::VulkanBackendMemory&,
47 VkDeviceSize offset,
48 VkDeviceSize size) override;
49 VkResult invalidateMemory(const skgpu::VulkanBackendMemory&,
50 VkDeviceSize offset,
51 VkDeviceSize size) override;
52
53 std::pair<uint64_t, uint64_t> totalAllocatedAndUsedMemory() const override;
54
55 private:
58 VmaAllocator allocator,
59 bool mustUseCoherentHostVisibleMemory);
60
62 VmaAllocator allocator_;
63
64 // For host visible allocations do we require they are coherent or not. All
65 // devices are required to support a host visible and coherent memory type.
66 // This is used to work around bugs for devices that don't handle non coherent
67 // memory correctly.
68 bool must_use_coherent_host_visible_memory_;
69};
70
71} // namespace flutter
72
73#endif // FLUTTER_FLUTTER_VMA_FLUTTER_SKIA_VMA_H_
VkResult mapMemory(const skgpu::VulkanBackendMemory &, void **data) override
static sk_sp< VulkanMemoryAllocator > Make(uint32_t vulkan_api_version, VkInstance instance, VkPhysicalDevice physicalDevice, VkDevice device, const fml::RefPtr< vulkan::VulkanProcTable > &vk, bool mustUseCoherentHostVisibleMemory)
VkResult invalidateMemory(const skgpu::VulkanBackendMemory &, VkDeviceSize offset, VkDeviceSize size) override
void freeMemory(const skgpu::VulkanBackendMemory &) override
VkResult allocateImageMemory(VkImage image, uint32_t allocationPropertyFlags, skgpu::VulkanBackendMemory *) override
VkResult allocateBufferMemory(VkBuffer buffer, BufferUsage usage, uint32_t allocationPropertyFlags, skgpu::VulkanBackendMemory *) override
void getAllocInfo(const skgpu::VulkanBackendMemory &, skgpu::VulkanAlloc *) const override
VkResult flushMemory(const skgpu::VulkanBackendMemory &, VkDeviceSize offset, VkDeviceSize size) override
std::pair< uint64_t, uint64_t > totalAllocatedAndUsedMemory() const override
void unmapMemory(const skgpu::VulkanBackendMemory &) override
FlutterVulkanImage * image
VkDevice device
Definition main.cc:69
VkInstance instance
Definition main.cc:64
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switch_defs.h:36
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