5#include "flutter/vulkan/procs/vulkan_proc_table.h"
9#include "flutter/fml/logging.h"
11#define ACQUIRE_PROC(name, context) \
12 if (!(name = AcquireProc("vk" #name, context))) { \
16#define ACQUIRE_PROC_EITHER(name, name2, context) \
17 if (!(name = AcquireProc("vk" #name, context)) && \
18 !(name2 = AcquireProc("vk" #name2, context))) { \
27 :
handle_(nullptr), acquired_mandatory_proc_addresses_(
false) {
28 acquired_mandatory_proc_addresses_ = OpenLibraryHandle(so_path) &&
29 SetupGetInstanceProcAddress() &&
30 SetupLoaderProcAddresses();
35 :
handle_(nullptr), acquired_mandatory_proc_addresses_(
false) {
37 acquired_mandatory_proc_addresses_ = SetupLoaderProcAddresses();
45 return acquired_mandatory_proc_addresses_;
49 return instance_ && device_;
60bool VulkanProcTable::SetupGetInstanceProcAddress() {
67 FML_DLOG(WARNING) <<
"Could not acquire vkGetInstanceProcAddr.";
80 const_cast<uint8_t*
>(handle_->
ResolveSymbol(
"vkGetInstanceProcAddr"));
84bool VulkanProcTable::SetupLoaderProcAddresses() {
88 ACQUIRE_PROC(EnumerateInstanceExtensionProperties, null_instance);
89 ACQUIRE_PROC(EnumerateInstanceLayerProperties, null_instance);
103 ACQUIRE_PROC(GetPhysicalDeviceQueueFamilyProperties, handle);
105 ACQUIRE_PROC(GetPhysicalDeviceMemoryProperties, handle);
107 GetPhysicalDeviceMemoryProperties2KHR, handle);
110 ACQUIRE_PROC(GetPhysicalDeviceSurfaceCapabilitiesKHR, handle);
111 ACQUIRE_PROC(GetPhysicalDeviceSurfaceFormatsKHR, handle);
112 ACQUIRE_PROC(GetPhysicalDeviceSurfacePresentModesKHR, handle);
113 ACQUIRE_PROC(GetPhysicalDeviceSurfaceSupportKHR, handle);
123 [
this, &handle]() ->
bool {
170 GetBufferMemoryRequirements2KHR, handle);
172 GetImageMemoryRequirements2KHR, handle);
176#ifndef TEST_VULKAN_PROCS
185 ACQUIRE_PROC(ImportSemaphoreZirconHandleFUCHSIA, handle);
190 ACQUIRE_PROC(SetBufferCollectionImageConstraintsFUCHSIA, handle);
191 ACQUIRE_PROC(GetBufferCollectionPropertiesFUCHSIA, handle);
198bool VulkanProcTable::OpenLibraryHandle(
const char*
path) {
207bool VulkanProcTable::CloseLibraryHandle() {
213 const char* proc_name,
225 const char* proc_name,
227 if (proc_name ==
nullptr || !
device || !GetDeviceProcAddr) {
231 return GetDeviceProcAddr(
device, proc_name);
static fml::RefPtr< NativeLibrary > Create(const char *path)
const uint8_t * ResolveSymbol(const char *symbol)
bool SetupInstanceProcAddresses(const VulkanHandle< VkInstance > &instance)
bool AreDeviceProcsSetup() const
PFN_vkVoidFunction AcquireProc(const char *proc_name, const VulkanHandle< VkInstance > &instance) const
PFN_vkGetInstanceProcAddr NativeGetInstanceProcAddr() const
bool HasAcquiredMandatoryProcAddresses() const
PFN_vkGetInstanceProcAddr GetInstanceProcAddr
bool AreInstanceProcsSetup() const
bool SetupDeviceProcAddresses(const VulkanHandle< VkDevice > &device)
decltype(vkGetInstanceProcAddr) * get_instance_proc_addr
#define FML_DLOG(severity)
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
void(VKAPI_PTR * PFN_vkVoidFunction)(void)
PFN_vkVoidFunction(VKAPI_PTR * PFN_vkGetInstanceProcAddr)(VkInstance instance, const char *pName)
#define ACQUIRE_PROC(name, context)
#define ACQUIRE_PROC_EITHER(name, name2, context)