Flutter Engine
 
Loading...
Searching...
No Matches
flutter::AndroidSurfaceVKImpeller Class Reference

#include <android_surface_vk_impeller.h>

Inheritance diagram for flutter::AndroidSurfaceVKImpeller:
flutter::AndroidSurface

Public Member Functions

 AndroidSurfaceVKImpeller (const std::shared_ptr< AndroidContextVKImpeller > &android_context)
 
 ~AndroidSurfaceVKImpeller () override
 
bool IsValid () const override
 
std::unique_ptr< SurfaceCreateGPUSurface (GrDirectContext *gr_context) override
 
void TeardownOnScreenContext () override
 
bool OnScreenSurfaceResize (const DlISize &size) override
 
bool ResourceContextMakeCurrent () override
 
bool ResourceContextClearCurrent () override
 
std::shared_ptr< impeller::ContextGetImpellerContext () override
 
bool SetNativeWindow (fml::RefPtr< AndroidNativeWindow > window, const std::shared_ptr< PlatformViewAndroidJNI > &jni_facade) override
 
- Public Member Functions inherited from flutter::AndroidSurface
virtual ~AndroidSurface ()
 
virtual std::unique_ptr< SurfaceCreateSnapshotSurface ()
 
virtual void SetupImpellerSurface ()
 

Additional Inherited Members

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

Detailed Description

Definition at line 19 of file android_surface_vk_impeller.h.

Constructor & Destructor Documentation

◆ AndroidSurfaceVKImpeller()

flutter::AndroidSurfaceVKImpeller::AndroidSurfaceVKImpeller ( const std::shared_ptr< AndroidContextVKImpeller > &  android_context)
explicit

Definition at line 22 of file android_surface_vk_impeller.cc.

23 {
24 is_valid_ = android_context->IsValid();
25
26 auto& context_vk =
27 impeller::ContextVK::Cast(*android_context->GetImpellerContext());
28 surface_context_vk_ = context_vk.CreateSurfaceContext();
29}
static ContextVK & Cast(Context &base)

References impeller::BackendCast< ContextVK, Context >::Cast().

◆ ~AndroidSurfaceVKImpeller()

flutter::AndroidSurfaceVKImpeller::~AndroidSurfaceVKImpeller ( )
overridedefault

Member Function Documentation

◆ CreateGPUSurface()

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

Implements flutter::AndroidSurface.

Definition at line 41 of file android_surface_vk_impeller.cc.

42 {
43 if (!IsValid()) {
44 return nullptr;
45 }
46
47 if (!native_window_ || !native_window_->IsValid()) {
48 return nullptr;
49 }
50
51 std::unique_ptr<GPUSurfaceVulkanImpeller> gpu_surface =
52 std::make_unique<GPUSurfaceVulkanImpeller>(nullptr, surface_context_vk_);
53
54 if (!gpu_surface->IsValid()) {
55 return nullptr;
56 }
57
58 return gpu_surface;
59}

References IsValid().

◆ GetImpellerContext()

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

Reimplemented from flutter::AndroidSurface.

Definition at line 111 of file android_surface_vk_impeller.cc.

111 {
112 return surface_context_vk_;
113}

◆ IsValid()

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

Implements flutter::AndroidSurface.

Definition at line 33 of file android_surface_vk_impeller.cc.

33 {
34 return is_valid_;
35}

Referenced by CreateGPUSurface().

◆ OnScreenSurfaceResize()

bool flutter::AndroidSurfaceVKImpeller::OnScreenSurfaceResize ( const DlISize size)
overridevirtual

Implements flutter::AndroidSurface.

Definition at line 61 of file android_surface_vk_impeller.cc.

61 {
62 surface_context_vk_->UpdateSurfaceSize(
64 return true;
65}
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all 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
Type width
Definition size.h:28

References flutter::size, and impeller::TSize< T >::width.

Referenced by SetNativeWindow().

◆ ResourceContextClearCurrent()

bool flutter::AndroidSurfaceVKImpeller::ResourceContextClearCurrent ( )
overridevirtual

Implements flutter::AndroidSurface.

Definition at line 71 of file android_surface_vk_impeller.cc.

71 {
72 return true;
73}

◆ ResourceContextMakeCurrent()

bool flutter::AndroidSurfaceVKImpeller::ResourceContextMakeCurrent ( )
overridevirtual

Implements flutter::AndroidSurface.

Definition at line 67 of file android_surface_vk_impeller.cc.

67 {
68 return true;
69}

◆ SetNativeWindow()

bool flutter::AndroidSurfaceVKImpeller::SetNativeWindow ( fml::RefPtr< AndroidNativeWindow window,
const std::shared_ptr< PlatformViewAndroidJNI > &  jni_facade 
)
overridevirtual

Implements flutter::AndroidSurface.

Definition at line 75 of file android_surface_vk_impeller.cc.

77 {
78 if (window && (native_window_ == window)) {
79 return OnScreenSurfaceResize(window->GetSize());
80 }
81
82 native_window_ = nullptr;
83
84 if (!window || !window->IsValid()) {
85 return false;
86 }
87
88 impeller::CreateTransactionCB cb = [jni_facade = jni_facade]() {
89 FML_CHECK(jni_facade) << "JNI was nullptr";
90 ASurfaceTransaction* tx = jni_facade->createTransaction();
91 if (tx == nullptr) {
93 }
95 };
96
98 std::reinterpret_pointer_cast<impeller::Context>(
99 surface_context_vk_->GetParent()),
100 window->handle(), cb);
101
102 if (surface_context_vk_->SetSwapchain(std::move(swapchain))) {
103 native_window_ = std::move(window);
104 return true;
105 }
106
107 return false;
108}
bool OnScreenSurfaceResize(const DlISize &size) override
static std::shared_ptr< SwapchainVK > Create(const std::shared_ptr< Context > &context, vk::UniqueSurfaceKHR surface, const ISize &size, bool enable_msaa=true)
A wrapper for ASurfaceTransaction. https://developer.android.com/ndk/reference/group/native-activity#...
VkSwapchainKHR swapchain
Definition main.cc:80
GLFWwindow * window
Definition main.cc:60
#define FML_CHECK(condition)
Definition logging.h:104
std::function< android::SurfaceTransaction()> CreateTransactionCB

References impeller::SwapchainVK::Create(), FML_CHECK, OnScreenSurfaceResize(), swapchain, and window.

◆ TeardownOnScreenContext()

void flutter::AndroidSurfaceVKImpeller::TeardownOnScreenContext ( )
overridevirtual

Implements flutter::AndroidSurface.

Definition at line 37 of file android_surface_vk_impeller.cc.

37 {
38 surface_context_vk_->TeardownSwapchain();
39}

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