27 {
28
29
30
31
33
34
35
37 FML_LOG(
ERROR) <<
"Couldn't find Vulkan ICD \"" << vulkan_icd
38 << "\", trying \"libvulkan.so\" instead.";
39 vulkan_icd = "libvulkan.so";
40 }
41
42 FML_LOG(INFO) <<
"Using Vulkan ICD: " << vulkan_icd;
43
44 vk_ = fml::MakeRefCounted<vulkan::VulkanProcTable>(vulkan_icd);
46 FML_LOG(
ERROR) <<
"Proc table has not acquired mandatory proc addresses.";
47 return;
48 }
49
50 application_ = std::make_unique<vulkan::VulkanApplication>(
51 *vk_, "Flutter Unittests", std::vector<std::string>{},
53 if (!application_->IsValid()) {
54 FML_LOG(
ERROR) <<
"Failed to initialize basic Vulkan state.";
55 return;
56 }
59 return;
60 }
61
62 device_ = application_->AcquireFirstCompatibleLogicalDevice();
63 if (!device_ || !device_->IsValid()) {
64 FML_LOG(
ERROR) <<
"Failed to create compatible logical device.";
65 return;
66 }
67
68
69
70
71
72
74 if (!device_->GetPhysicalDeviceFeatures(&features)) {
75 FML_LOG(
ERROR) <<
"Failed to get physical device features.";
76
77 return;
78 }
79
81 if (get_proc == nullptr) {
82 FML_LOG(
ERROR) <<
"Failed to create Vulkan getProc for Skia.";
83 return;
84 }
85
89 device_->GetPhysicalDeviceHandle(), device_->GetHandle(), vk_, true);
90
92
94 backend_context.
fInstance = application_->GetInstance();
96 backend_context.
fDevice = device_->GetHandle();
97 backend_context.
fQueue = device_->GetQueueHandle();
102 backend_context.
fGetProc = get_proc;
104
109}
static sk_sp< VulkanMemoryAllocator > Make(uint32_t vulkan_api_version, VkInstance instance, VkPhysicalDevice physicalDevice, VkDevice device, const fml::RefPtr< vulkan::VulkanProcTable > &vk, bool mustUseCoherentHostVisibleMemory)
static fml::RefPtr< NativeLibrary > Create(const char *path)
bool HasAcquiredMandatoryProcAddresses() const
bool AreInstanceProcsSetup() const
#define FML_LOG(severity)
SK_API sk_sp< GrDirectContext > MakeVulkan(const skgpu::VulkanBackendContext &, const GrContextOptions &)
GrContextOptions MakeDefaultContextOptions(ContextType type, std::optional< GrBackendApi > api)
Initializes GrContextOptions with values suitable for Flutter. The options can be further tweaked bef...
@ kRender
The context is used to render to a texture or renderbuffer.
GrVkGetProc CreateSkiaGetProc(const fml::RefPtr< vulkan::VulkanProcTable > &vk)
sk_sp< VulkanMemoryAllocator > fMemoryAllocator
const VkPhysicalDeviceFeatures * fDeviceFeatures
uint32_t fGraphicsQueueIndex
skgpu::VulkanGetProc fGetProc
VkPhysicalDevice fPhysicalDevice
const skgpu::VulkanExtensions * fVkExtensions
#define VK_MAKE_VERSION(major, minor, patch)