| 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 | ( |  | ) |
| override default

## ◆ 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 45 of file context_vk.cc.

45 {
46 if (!settings.IsValid()) {
47 VALIDATION_LOG << "Invalid settings for Vulkan context creation.";
48 return {};
49 }
50 impeller::ContextVK::Settings impeller_settings;
51 impeller_settings.shader_libraries_data = CreateShaderLibraryMappings();
52 impeller_settings.cache_directory = fml::paths::GetCachesDirectory();
53 impeller_settings.enable_validation = true;
54 sContextVKProcAddressCallback = settings.instance_proc_address_callback;
55 impeller_settings.proc_address_callback = ContextVKGetInstanceProcAddress;
56 impeller_settings.flags = impeller::Flags{};
57 auto impeller_context =
58 impeller::ContextVK::Create(std::move(impeller_settings));
59 sContextVKProcAddressCallback = nullptr;
60 if (!impeller_context) {
61 VALIDATION_LOG << "Could not create Impeller context.";
62 return {};
63 }
64 return Create(std::move(impeller_context));
65 }
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:45
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:36
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 67 of file context_vk.cc.

68 {
69 // Can't call Create because of private constructor. Adopt the raw pointer
70 // instead.
71 auto context = Adopt<Context>(new ContextVK(std::move(impeller_context)));
72 if (!context->IsValid()) {
73 VALIDATION_LOG << " Could not create valid context.";
74 return {};
75 }
76 return context;
77 }
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 98 of file context_vk.cc.

98 {
99 if (!IsValid()) {
100 return false;
101 }
102 const auto& context = impeller::ContextVK::Cast(*GetContext());
103 // NOLINTBEGIN(google-readability-casting)
104 info.vk_instance = reinterpret_cast<void*>(VkInstance(context.GetInstance()));
105 info.vk_physical_device =
106 reinterpret_cast<void*>(VkPhysicalDevice(context.GetPhysicalDevice()));
107 info.vk_logical_device =
108 reinterpret_cast<void*>(VkDevice(context.GetDevice()));
109 // NOLINTEND(google-readability-casting)
110 info.graphics_queue_family_index =
111 context.GetGraphicsQueue()->GetIndex().family;
112 info.graphics_queue_index = context.GetGraphicsQueue()->GetIndex().index;
113 return true;
114 }
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