Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
VulkanAMDMemoryAllocator.h
Go to the documentation of this file.
1/*
2 * Copyright 2018 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef skgpu_VulkanAMDMemoryAllocator_DEFINED
9#define skgpu_VulkanAMDMemoryAllocator_DEFINED
10
12
13namespace skgpu {
14
15class VulkanExtensions;
16struct VulkanInterface;
17
18#ifndef SK_USE_VMA
20public:
22 VkPhysicalDevice physicalDevice,
23 VkDevice device,
24 uint32_t physicalDeviceVersion,
25 const VulkanExtensions* extensions,
26 const VulkanInterface* interface,
27 bool threadSafe);
28};
29
30#else
31
32#include "VulkanMemoryAllocatorWrapper.h" // NO_G3_REWRITE
33
35public:
37 VkPhysicalDevice physicalDevice,
38 VkDevice device,
39 uint32_t physicalDeviceVersion,
40 const VulkanExtensions* extensions,
41 const VulkanInterface* interface,
42 bool threadSafe);
43
45
46 VkResult allocateImageMemory(VkImage image, uint32_t allocationPropertyFlags,
48
49 VkResult allocateBufferMemory(VkBuffer buffer,
51 uint32_t allocationPropertyFlags,
53
54 void freeMemory(const VulkanBackendMemory&) override;
55
56 void getAllocInfo(const VulkanBackendMemory&, VulkanAlloc*) const override;
57
58 VkResult mapMemory(const VulkanBackendMemory&, void** data) override;
59 void unmapMemory(const VulkanBackendMemory&) override;
60
62 VkDeviceSize size) override;
63 VkResult invalidateMemory(const VulkanBackendMemory&, VkDeviceSize offset,
64 VkDeviceSize size) override;
65
66 std::pair<uint64_t, uint64_t> totalAllocatedAndUsedMemory() const override;
67
68private:
69 VulkanAMDMemoryAllocator(VmaAllocator allocator);
70
71 VmaAllocator fAllocator;
72};
73
74#endif // SK_USE_VMA
75
76} // namespace skgpu
77
78#endif // skgpu_VulkanAMDMemoryAllocator_DEFINED
static sk_sp< VulkanMemoryAllocator > Make(VkInstance instance, VkPhysicalDevice physicalDevice, VkDevice device, uint32_t physicalDeviceVersion, const VulkanExtensions *extensions, const VulkanInterface *interface, bool threadSafe)
VkDevice device
Definition main.cc:53
VkInstance instance
Definition main.cc:48
sk_sp< SkImage > image
Definition examples.cpp:29
static const uint8_t buffer[]
intptr_t VulkanBackendMemory
Definition VulkanTypes.h:31
static void usage(char *argv0)
Point offset
uint64_t VkDeviceSize
Definition vulkan_core.h:96
VkResult