Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
flutter::AndroidSurfaceVulkanImpeller Class Reference

#include <android_surface_vulkan_impeller.h>

Inheritance diagram for flutter::AndroidSurfaceVulkanImpeller:
flutter::AndroidSurface

Public Member Functions

 AndroidSurfaceVulkanImpeller (const std::shared_ptr< AndroidContextVulkanImpeller > &android_context)
 
 ~AndroidSurfaceVulkanImpeller () override
 
bool IsValid () const override
 
std::unique_ptr< SurfaceCreateGPUSurface (GrDirectContext *gr_context) override
 
void TeardownOnScreenContext () override
 
bool OnScreenSurfaceResize (const SkISize &size) override
 
bool ResourceContextMakeCurrent () override
 
bool ResourceContextClearCurrent () override
 
std::shared_ptr< impeller::ContextGetImpellerContext () override
 
bool SetNativeWindow (fml::RefPtr< AndroidNativeWindow > window) override
 
- Public Member Functions inherited from flutter::AndroidSurface
virtual ~AndroidSurface ()
 
virtual bool IsValid () const =0
 
virtual void TeardownOnScreenContext ()=0
 
virtual std::unique_ptr< SurfaceCreateGPUSurface (GrDirectContext *gr_context=nullptr)=0
 
virtual bool OnScreenSurfaceResize (const SkISize &size)=0
 
virtual bool ResourceContextMakeCurrent ()=0
 
virtual bool ResourceContextClearCurrent ()=0
 
virtual bool SetNativeWindow (fml::RefPtr< AndroidNativeWindow > window)=0
 
virtual std::unique_ptr< SurfaceCreateSnapshotSurface ()
 
virtual std::shared_ptr< impeller::ContextGetImpellerContext ()
 

Additional Inherited Members

- Protected Member Functions inherited from flutter::AndroidSurface
 AndroidSurface ()
 

Detailed Description

Definition at line 18 of file android_surface_vulkan_impeller.h.

Constructor & Destructor Documentation

◆ AndroidSurfaceVulkanImpeller()

flutter::AndroidSurfaceVulkanImpeller::AndroidSurfaceVulkanImpeller ( const std::shared_ptr< AndroidContextVulkanImpeller > &  android_context)
explicit

Definition at line 20 of file android_surface_vulkan_impeller.cc.

21 {
22 is_valid_ = android_context->IsValid();
23
24 auto& context_vk =
25 impeller::ContextVK::Cast(*android_context->GetImpellerContext());
26 surface_context_vk_ = context_vk.CreateSurfaceContext();
27 eager_gpu_surface_ =
28 std::make_unique<GPUSurfaceVulkanImpeller>(surface_context_vk_);
29}
static ContextVK & Cast(Context &base)
Definition: backend_cast.h:13

◆ ~AndroidSurfaceVulkanImpeller()

flutter::AndroidSurfaceVulkanImpeller::~AndroidSurfaceVulkanImpeller ( )
overridedefault

Member Function Documentation

◆ CreateGPUSurface()

std::unique_ptr< Surface > flutter::AndroidSurfaceVulkanImpeller::CreateGPUSurface ( GrDirectContext gr_context)
overridevirtual

Implements flutter::AndroidSurface.

Definition at line 41 of file android_surface_vulkan_impeller.cc.

42 {
43 if (!IsValid()) {
44 return nullptr;
45 }
46
47 if (!native_window_ || !native_window_->IsValid()) {
48 return nullptr;
49 }
50
51 if (eager_gpu_surface_) {
52 auto gpu_surface = std::move(eager_gpu_surface_);
53 if (!gpu_surface->IsValid()) {
54 return nullptr;
55 }
56 return gpu_surface;
57 }
58
59 std::unique_ptr<GPUSurfaceVulkanImpeller> gpu_surface =
60 std::make_unique<GPUSurfaceVulkanImpeller>(surface_context_vk_);
61
62 if (!gpu_surface->IsValid()) {
63 return nullptr;
64 }
65
66 return gpu_surface;
67}

◆ GetImpellerContext()

std::shared_ptr< impeller::Context > flutter::AndroidSurfaceVulkanImpeller::GetImpellerContext ( )
overridevirtual

Reimplemented from flutter::AndroidSurface.

Definition at line 109 of file android_surface_vulkan_impeller.cc.

109 {
110 return surface_context_vk_;
111}

◆ IsValid()

bool flutter::AndroidSurfaceVulkanImpeller::IsValid ( ) const
overridevirtual

Implements flutter::AndroidSurface.

Definition at line 33 of file android_surface_vulkan_impeller.cc.

33 {
34 return is_valid_;
35}

◆ OnScreenSurfaceResize()

bool flutter::AndroidSurfaceVulkanImpeller::OnScreenSurfaceResize ( const SkISize size)
overridevirtual

Implements flutter::AndroidSurface.

Definition at line 69 of file android_surface_vulkan_impeller.cc.

69 {
70 surface_context_vk_->UpdateSurfaceSize(
71 impeller::ISize{size.width(), size.height()});
72 return true;
73}
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

◆ ResourceContextClearCurrent()

bool flutter::AndroidSurfaceVulkanImpeller::ResourceContextClearCurrent ( )
overridevirtual

Implements flutter::AndroidSurface.

Definition at line 79 of file android_surface_vulkan_impeller.cc.

79 {
80 return true;
81}

◆ ResourceContextMakeCurrent()

bool flutter::AndroidSurfaceVulkanImpeller::ResourceContextMakeCurrent ( )
overridevirtual

Implements flutter::AndroidSurface.

Definition at line 75 of file android_surface_vulkan_impeller.cc.

75 {
76 return true;
77}

◆ SetNativeWindow()

bool flutter::AndroidSurfaceVulkanImpeller::SetNativeWindow ( fml::RefPtr< AndroidNativeWindow window)
overridevirtual

Implements flutter::AndroidSurface.

Definition at line 83 of file android_surface_vulkan_impeller.cc.

84 {
85 if (window && (native_window_ == window)) {
86 return OnScreenSurfaceResize(window->GetSize());
87 }
88
89 native_window_ = nullptr;
90
91 if (!window || !window->IsValid()) {
92 return false;
93 }
94
96 std::reinterpret_pointer_cast<impeller::Context>(
97 surface_context_vk_->GetParent()),
98 window->handle());
99
100 if (surface_context_vk_->SetSwapchain(std::move(swapchain))) {
101 native_window_ = std::move(window);
102 return true;
103 }
104
105 return false;
106}
bool OnScreenSurfaceResize(const SkISize &size) override
static std::shared_ptr< SwapchainVK > Create(const std::shared_ptr< Context > &context, vk::UniqueSurfaceKHR surface, const ISize &size, bool enable_msaa=true)
Definition: swapchain_vk.cc:18
VkSwapchainKHR swapchain
Definition: main.cc:64
GLFWwindow * window
Definition: main.cc:45

◆ TeardownOnScreenContext()

void flutter::AndroidSurfaceVulkanImpeller::TeardownOnScreenContext ( )
overridevirtual

Implements flutter::AndroidSurface.

Definition at line 37 of file android_surface_vulkan_impeller.cc.

37 {
38 // Nothing to do.
39}

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