5#include "flutter/shell/platform/android/android_context_vulkan_impeller.h"
7#include "flutter/fml/paths.h"
8#include "flutter/impeller/entity/vk/entity_shaders_vk.h"
9#include "flutter/impeller/entity/vk/framebuffer_blend_shaders_vk.h"
10#include "flutter/impeller/entity/vk/modern_shaders_vk.h"
11#include "flutter/impeller/renderer/backend/vulkan/context_vk.h"
14#include "flutter/impeller/scene/shaders/vk/scene_shaders_vk.h"
21 bool enable_vulkan_validation,
22 bool enable_gpu_tracing,
29 std::vector<std::shared_ptr<fml::Mapping>> shader_mappings = {
30 std::make_shared<fml::NonOwnedMapping>(impeller_entity_shaders_vk_data,
31 impeller_entity_shaders_vk_length),
32 std::make_shared<fml::NonOwnedMapping>(
33 impeller_framebuffer_blend_shaders_vk_data,
34 impeller_framebuffer_blend_shaders_vk_length),
36 std::make_shared<fml::NonOwnedMapping>(impeller_scene_shaders_vk_data,
37 impeller_scene_shaders_vk_length),
39 std::make_shared<fml::NonOwnedMapping>(impeller_modern_shaders_vk_data,
40 impeller_modern_shaders_vk_length),
43 auto instance_proc_addr =
45 "vkGetInstanceProcAddr");
47 if (!instance_proc_addr.has_value()) {
53 settings.proc_address_callback = instance_proc_addr.value();
54 settings.shader_libraries_data = std::move(shader_mappings);
56 settings.enable_validation = enable_vulkan_validation;
57 settings.enable_gpu_tracing = enable_gpu_tracing;
64 FML_LOG(IMPORTANT) <<
"Using the Impeller rendering backend (Vulkan with "
65 "Validation Layers).";
67 FML_LOG(IMPORTANT) <<
"Using the Impeller rendering backend (Vulkan).";
75 bool enable_validation,
76 bool enable_gpu_tracing,
79 vulkan_dylib_(
fml::NativeLibrary::
Create(
"libvulkan.so")) {
81 vulkan_dylib_, enable_validation, enable_gpu_tracing, quiet);
83 is_valid_ = !!impeller_context;
static sk_sp< Effect > Create()
AndroidContextVulkanImpeller(bool enable_validation, bool enable_gpu_tracing, bool quiet=false)
~AndroidContextVulkanImpeller()
bool IsValid() const override
Holds state that is shared across Android surfaces.
void SetImpellerContext(const std::shared_ptr< impeller::Context > &context)
const std::optional< T > ResolveFunction(const char *symbol)
static CapabilitiesVK & Cast(Capabilities &base)
bool AreValidationsEnabled() const
static std::shared_ptr< ContextVK > Create(Settings settings)
#define FML_LOG(severity)
static std::shared_ptr< impeller::Context > CreateImpellerContext(const std::shared_ptr< impeller::ReactorGLES::Worker > &worker, bool enable_gpu_tracing)
fml::UniqueFD GetCachesDirectory()
PFN_vkVoidFunction(VKAPI_PTR * PFN_vkGetInstanceProcAddr)(VkInstance instance, const char *pName)