7 #include "flutter/fml/paths.h"
8 #include "impeller/entity/vk/entity_shaders_vk.h"
9 #include "impeller/entity/vk/framebuffer_blend_shaders_vk.h"
10 #include "impeller/entity/vk/modern_shaders_vk.h"
12 #include "impeller/renderer/vk/compute_shaders_vk.h"
16 static std::vector<std::shared_ptr<fml::Mapping>>
19 std::make_shared<fml::NonOwnedMapping>(impeller_entity_shaders_vk_data,
20 impeller_entity_shaders_vk_length),
21 std::make_shared<fml::NonOwnedMapping>(impeller_modern_shaders_vk_data,
22 impeller_modern_shaders_vk_length),
23 std::make_shared<fml::NonOwnedMapping>(
24 impeller_framebuffer_blend_shaders_vk_data,
25 impeller_framebuffer_blend_shaders_vk_length),
26 std::make_shared<fml::NonOwnedMapping>(
27 impeller_compute_shaders_vk_data, impeller_compute_shaders_vk_length),
32 thread_local std::function<PFN_vkVoidFunction(VkInstance instance,
33 const char* proc_name)>
38 const char* proc_name) {
57 auto impeller_context =
60 if (!impeller_context) {
64 return Create(std::move(impeller_context));
68 std::shared_ptr<impeller::Context> impeller_context) {
71 auto context = Adopt<Context>(
new ContextVK(std::move(impeller_context)));
72 if (!context->IsValid()) {
85 : enable_validation(settings.enable_vulkan_validation) {
87 [&settings](VkInstance instance,
88 const char* proc_name) -> PFN_vkVoidFunction {
90 return reinterpret_cast<PFN_vkVoidFunction
>(
104 info.
vk_instance =
reinterpret_cast<void*
>(VkInstance(context.GetInstance()));
106 reinterpret_cast<void*
>(VkPhysicalDevice(context.GetPhysicalDevice()));
108 reinterpret_cast<void*
>(VkDevice(context.GetDevice()));
111 context.GetGraphicsQueue()->GetIndex().family;
117 return !!instance_proc_address_callback;
static ContextVK & Cast(Context &base)
static std::shared_ptr< ContextVK > Create(Settings settings)
std::shared_ptr< impeller::Context > GetContext() const
ContextVK(const ContextVK &)=delete
bool GetInfo(ImpellerContextVulkanInfo &info) const
static ScopedObject< Context > Create(const Settings &settings)
thread_local std::function< PFN_vkVoidFunction(VkInstance instance, const char *proc_name)> sContextVKProcAddressCallback
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL ContextVKGetInstanceProcAddress(VkInstance instance, const char *proc_name)
static std::vector< std::shared_ptr< fml::Mapping > > CreateShaderLibraryMappings()
uint32_t graphics_queue_index
uint32_t graphics_queue_family_index
void *IMPELLER_NULLABLE vk_instance
void *IMPELLER_NULLABLE vk_logical_device
void *IMPELLER_NULLABLE vk_physical_device
ImpellerVulkanProcAddressCallback IMPELLER_NONNULL proc_address_callback
void *IMPELLER_NULLABLE user_data
std::vector< std::shared_ptr< fml::Mapping > > shader_libraries_data
PFN_vkGetInstanceProcAddr proc_address_callback
fml::UniqueFD cache_directory
Settings(const ImpellerContextVulkanSettings &settings)
std::function< PFN_vkVoidFunction(VkInstance instance, const char *proc_name)> instance_proc_address_callback