Skip to content

Commit d024ae4

Browse files
drevemanDavid Reveman
and
David Reveman
authored
[fuchsia] Use memory_requirements_2 extension. (flutter#19678)
This is required by some Vulkan 1.0 drivers. For example, MoltenVK through goldfish ICD when running in the emulator. Co-authored-by: David Reveman <[email protected]>
1 parent 5b966eb commit d024ae4

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

shell/platform/fuchsia/flutter/vulkan_surface_producer.cc

+11
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "third_party/skia/include/gpu/GrBackendSurface.h"
1717
#include "third_party/skia/include/gpu/GrContext.h"
1818
#include "third_party/skia/include/gpu/vk/GrVkBackendContext.h"
19+
#include "third_party/skia/include/gpu/vk/GrVkExtensions.h"
1920
#include "third_party/skia/include/gpu/vk/GrVkTypes.h"
2021

2122
namespace flutter_runner {
@@ -126,6 +127,16 @@ bool VulkanSurfaceProducer::Initialize(scenic::Session* scenic_session) {
126127
backend_context.fFeatures = skia_features;
127128
backend_context.fGetProc = std::move(getProc);
128129
backend_context.fOwnsInstanceAndDevice = false;
130+
// The memory_requirements_2 extension is required on Fuchsia as the AMD
131+
// memory allocator used by Skia benefit from it.
132+
const char* device_extensions[] = {
133+
VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME,
134+
};
135+
GrVkExtensions vk_extensions;
136+
vk_extensions.init(backend_context.fGetProc, backend_context.fInstance,
137+
backend_context.fPhysicalDevice, 0, nullptr,
138+
countof(device_extensions), device_extensions);
139+
backend_context.fVkExtensions = &vk_extensions;
129140

130141
context_ = GrContext::MakeVulkan(backend_context);
131142

vulkan/vulkan_device.cc

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ VulkanDevice::VulkanDevice(VulkanProcTable& p_vk,
6868
VK_FUCHSIA_EXTERNAL_MEMORY_EXTENSION_NAME,
6969
VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME,
7070
VK_FUCHSIA_EXTERNAL_SEMAPHORE_EXTENSION_NAME,
71+
VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME,
7172
#endif
7273
};
7374

0 commit comments

Comments
 (0)