Flutter Engine
 
Loading...
Searching...
No Matches
impeller::interop::ContextVK Class Referencefinal

#include <context_vk.h>

Inheritance diagram for impeller::interop::ContextVK:
impeller::interop::Context impeller::interop::Object< Context, IMPELLER_INTERNAL_HANDLE_NAME(ImpellerContext)> impeller::interop::ObjectBase

Classes

struct  Settings
 

Public Member Functions

 ~ContextVK () override
 
 ContextVK (const ContextVK &)=delete
 
ContextVKoperator= (const ContextVK &)=delete
 
bool GetInfo (ImpellerContextVulkanInfo &info) const
 
- Public Member Functions inherited from impeller::interop::Context
 ~Context () override
 
 Context (const Context &)=delete
 
Contextoperator= (const Context &)=delete
 
bool IsValid () const
 
std::shared_ptr< impeller::ContextGetContext () const
 
AiksContextGetAiksContext ()
 
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
 
ObjectBaseoperator= (const ObjectBase &)=delete
 
ObjectBaseoperator= (ObjectBase &&)=delete
 
void Retain ()
 
void Release ()
 
uint64_t GetRefCountForTests () const
 

Static Public Member Functions

static ScopedObject< ContextCreate (const Settings &settings)
 
static ScopedObject< ContextCreate (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

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;
52 impeller_settings.enable_validation = true;
53 sContextVKProcAddressCallback = settings.instance_proc_address_callback;
55 impeller_settings.flags = impeller::Flags{};
56 auto impeller_context =
57 impeller::ContextVK::Create(std::move(impeller_settings));
59 if (!impeller_context) {
60 VALIDATION_LOG << "Could not create Impeller context.";
61 return {};
62 }
63 return Create(std::move(impeller_context));
64}
static std::shared_ptr< ContextVK > Create(Settings settings)
static ScopedObject< Context > Create(const Settings &settings)
Definition context_vk.cc:44
fml::UniqueFD GetCachesDirectory()
thread_local std::function< PFN_vkVoidFunction(VkInstance instance, const char *proc_name)> sContextVKProcAddressCallback
Definition context_vk.cc:34
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL ContextVKGetInstanceProcAddress(VkInstance instance, const char *proc_name)
Definition context_vk.cc:37
static std::vector< std::shared_ptr< fml::Mapping > > CreateShaderLibraryMappings()
std::vector< std::shared_ptr< fml::Mapping > > shader_libraries_data
Definition context_vk.h:81
PFN_vkGetInstanceProcAddr proc_address_callback
Definition context_vk.h:80
#define VALIDATION_LOG
Definition validation.h:91

References impeller::ContextVK::Settings::cache_directory, impeller::interop::ContextVKGetInstanceProcAddress(), Create(), impeller::ContextVK::Create(), impeller::interop::CreateShaderLibraryMappings(), impeller::ContextVK::Settings::enable_validation, impeller::ContextVK::Settings::flags, fml::paths::GetCachesDirectory(), 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 Create(), 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}
ContextVK(const ContextVK &)=delete

References 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)
110 context.GetGraphicsQueue()->GetIndex().family;
111 info.graphics_queue_index = context.GetGraphicsQueue()->GetIndex().index;
112 return true;
113}
static ContextVK & Cast(Context &base)
std::shared_ptr< impeller::Context > GetContext() const
Definition context.cc:20
uint32_t graphics_queue_family_index
Definition impeller.h:642
void *IMPELLER_NULLABLE vk_instance
Definition impeller.h:639
void *IMPELLER_NULLABLE vk_logical_device
Definition impeller.h:641
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: