| Flutter Impeller |

Classes | Public Member Functions | Static Public Member Functions | List of all members
impeller::interop::ContextVK Class Referencefinal

`#include <context_vk.h>`

Inheritance diagram for impeller::interop::ContextVK:

## Classes
struct | Settings

## Public Member Functions
| ~ContextVK () override
| ContextVK (const ContextVK &)=delete
ContextVK & | operator= (const ContextVK &)=delete
bool | GetInfo (ImpellerContextVulkanInfo &info) const
Public Member Functions inherited from impeller::interop::Context
| ~Context () override
| Context (const Context &)=delete
Context & | operator= (const Context &)=delete
bool | IsValid () const
std::shared_ptr< impeller::Context > | GetContext () const
AiksContext & | GetAiksContext ()
bool | IsBackend (impeller::Context::BackendType type) const
bool | IsGL () const
bool | IsMetal () const
bool | IsVulkan () const
Public Member Functions inherited from impeller::interop::ObjectBase
| ObjectBase ()=default
virtual | ~ObjectBase ()=default
| ObjectBase (const ObjectBase &)=delete
| ObjectBase (ObjectBase &&)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
ObjectBase & | operator= (ObjectBase &&)=delete
void | Retain ()
void | Release ()
uint64_t | GetRefCountForTests () const

## Static Public Member Functions
static ScopedObject< Context > | Create (const Settings &settings)
static ScopedObject< Context > | Create (std::shared_ptr< impeller::Context > context)
Static Public Member Functions inherited from impeller::interop::ObjectBase
static void | SafeRetain (void *ptr)
static void | SafeRelease (void *ptr)

## Additional Inherited Members
Public Types inherited from impeller::interop::Object< Context, IMPELLER_INTERNAL_HANDLE_NAME(ImpellerContext)>
using | InteropClass = Context
using | InteropCSibling = IMPELLER_INTERNAL_HANDLE_NAME(ImpellerContext)
Protected Member Functions inherited from impeller::interop::Context
| Context (std::shared_ptr< impeller::Context > context)

## Detailed Description

Definition at line 14 of file context_vk.h.

## Constructor & Destructor Documentation

## ◆ ~ContextVK()

impeller::interop::ContextVK::~ContextVK | ( |  | ) |
| overridedefault

## ◆ ContextVK()

impeller::interop::ContextVK::ContextVK | ( | const ContextVK & |  | ) |
| delete

Referenced by Create().

## Member Function Documentation

## ◆ Create() [1/2]

ScopedObject< Context > impeller::interop::ContextVK::Create | ( | const Settings & | settings | ) |
| static

Definition at line 44 of file context_vk.cc.

44 {
45 if (!settings.IsValid()) {
46 VALIDATION_LOG << "Invalid settings for Vulkan context creation.";
47 return {};
48 }
49 impeller::ContextVK::Settings impeller_settings;
50 impeller_settings.shader_libraries_data = CreateShaderLibraryMappings();
51 impeller_settings.cache_directory = fml::paths::GetCachesDirectory();
52 impeller_settings.enable_validation = true;
53 sContextVKProcAddressCallback = settings.instance_proc_address_callback;
54 impeller_settings.proc_address_callback = ContextVKGetInstanceProcAddress;
55 impeller_settings.flags = impeller::Flags{};
56 auto impeller_context =
57 impeller::ContextVK::Create(std::move(impeller_settings));
58 sContextVKProcAddressCallback = nullptr;
59 if (!impeller_context) {
60 VALIDATION_LOG << "Could not create Impeller context.";
61 return {};
62 }
63 return Create(std::move(impeller_context));
64 }
impeller::ContextVK::Create
static std::shared_ptr< ContextVK > Create(Settings settings)
Definition: context_vk.cc:105
impeller::interop::ContextVK::Create
static ScopedObject< Context > Create(const Settings &settings)
Definition: context_vk.cc:44
impeller::interop::sContextVKProcAddressCallback
thread_local std::function< PFN_vkVoidFunction(VkInstance instance, const char *proc_name)> sContextVKProcAddressCallback
Definition: context_vk.cc:34
impeller::interop::ContextVKGetInstanceProcAddress
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL ContextVKGetInstanceProcAddress(VkInstance instance, const char *proc_name)
Definition: context_vk.cc:37
impeller::interop::CreateShaderLibraryMappings
static std::vector< std::shared_ptr< fml::Mapping > > CreateShaderLibraryMappings()
Definition: context_mtl.mm:17
impeller::ContextVK::Settings
Definition: context_vk.h:79
impeller::ContextVK::Settings::flags
Flags flags
Definition: context_vk.h:88
impeller::ContextVK::Settings::shader_libraries_data
std::vector< std::shared_ptr< fml::Mapping > > shader_libraries_data
Definition: context_vk.h:81
impeller::ContextVK::Settings::proc_address_callback
PFN_vkGetInstanceProcAddr proc_address_callback
Definition: context_vk.h:80
impeller::ContextVK::Settings::enable_validation
bool enable_validation
Definition: context_vk.h:83
impeller::ContextVK::Settings::cache_directory
fml::UniqueFD cache_directory
Definition: context_vk.h:82
impeller::Flags
Definition: flags.h:9
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91

References impeller::ContextVK::Settings::cache_directory, impeller::interop::ContextVKGetInstanceProcAddress(), impeller::ContextVK::Create(), impeller::interop::CreateShaderLibraryMappings(), impeller::ContextVK::Settings::enable_validation, impeller::ContextVK::Settings::flags, impeller::interop::ContextVK::Settings::instance_proc_address_callback, impeller::interop::ContextVK::Settings::IsValid(), impeller::ContextVK::Settings::proc_address_callback, impeller::interop::sContextVKProcAddressCallback, impeller::ContextVK::Settings::shader_libraries_data, and VALIDATION_LOG.

Referenced by impeller::interop::testing::CreateSharedContext(), and impeller::interop::ImpellerContextCreateVulkanNew().

## ◆ Create() [2/2]

ScopedObject< Context > impeller::interop::ContextVK::Create | ( | std::shared_ptr< impeller::Context > | context | ) |
| static

Definition at line 66 of file context_vk.cc.

67 {
68 // Can't call Create because of private constructor. Adopt the raw pointer
69 // instead.
70 auto context = Adopt<Context>(new ContextVK(std::move(impeller_context)));
71 if (!context->IsValid()) {
72 VALIDATION_LOG << " Could not create valid context.";
73 return {};
74 }
75 return context;
76 }
impeller::interop::ContextVK::ContextVK
ContextVK(const ContextVK &)=delete

References ContextVK(), and VALIDATION_LOG.

## ◆ GetInfo()

bool impeller::interop::ContextVK::GetInfo | ( | ImpellerContextVulkanInfo & | info | ) | const

Definition at line 97 of file context_vk.cc.

97 {
98 if (!IsValid()) {
99 return false;
100 }
101 const auto& context = impeller::ContextVK::Cast(*GetContext());
102 // NOLINTBEGIN(google-readability-casting)
103 info.vk_instance = reinterpret_cast<void*>(VkInstance(context.GetInstance()));
104 info.vk_physical_device =
105 reinterpret_cast<void*>(VkPhysicalDevice(context.GetPhysicalDevice()));
106 info.vk_logical_device =
107 reinterpret_cast<void*>(VkDevice(context.GetDevice()));
108 // NOLINTEND(google-readability-casting)
109 info.graphics_queue_family_index =
110 context.GetGraphicsQueue()->GetIndex().family;
111 info.graphics_queue_index = context.GetGraphicsQueue()->GetIndex().index;
112 return true;
113 }
impeller::BackendCast< ContextVK, Context >::Cast
static ContextVK & Cast(Context &base)
Definition: backend_cast.h:13
impeller::interop::Context::GetContext
std::shared_ptr< impeller::Context > GetContext() const
Definition: context.cc:20
impeller::interop::Context::IsValid
bool IsValid() const
Definition: context.cc:16
ImpellerContextVulkanInfo::graphics_queue_index
uint32_t graphics_queue_index
Definition: impeller.h:643
ImpellerContextVulkanInfo::graphics_queue_family_index
uint32_t graphics_queue_family_index
Definition: impeller.h:642
ImpellerContextVulkanInfo::vk_instance
void *IMPELLER_NULLABLE vk_instance
Definition: impeller.h:639
ImpellerContextVulkanInfo::vk_logical_device
void *IMPELLER_NULLABLE vk_logical_device
Definition: impeller.h:641
ImpellerContextVulkanInfo::vk_physical_device
void *IMPELLER_NULLABLE vk_physical_device
Definition: impeller.h:640

References impeller::BackendCast< ContextVK, Context >::Cast(), impeller::interop::Context::GetContext(), ImpellerContextVulkanInfo::graphics_queue_family_index, ImpellerContextVulkanInfo::graphics_queue_index, impeller::interop::Context::IsValid(), ImpellerContextVulkanInfo::vk_instance, ImpellerContextVulkanInfo::vk_logical_device, and ImpellerContextVulkanInfo::vk_physical_device.

## ◆ operator=()

ContextVK& impeller::interop::ContextVK::operator= | ( | const ContextVK & |  | ) |
| delete

The documentation for this class was generated from the following files:

- impeller/toolkit/interop/backend/vulkan/context_vk.h
- impeller/toolkit/interop/backend/vulkan/context_vk.cc