Flutter Engine
flutter::AndroidSurfaceVulkan Class Reference

#include <android_surface_vulkan.h>

Inheritance diagram for flutter::AndroidSurfaceVulkan:
flutter::AndroidSurface flutter::GPUSurfaceVulkanDelegate flutter::GPUSurfaceDelegate

Public Member Functions

 AndroidSurfaceVulkan (std::shared_ptr< AndroidContext > android_context, std::shared_ptr< PlatformViewAndroidJNI > jni_facade, std::shared_ptr< AndroidExternalViewEmbedder > external_view_embedder)
 
 ~AndroidSurfaceVulkan () 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
 
bool SetNativeWindow (fml::RefPtr< AndroidNativeWindow > window) override
 
ExternalViewEmbedderGetExternalViewEmbedder () override
 Gets the view embedder that controls how the Flutter layer hierarchy split into multiple chunks should be composited back on-screen. This field is optional and the Flutter rasterizer will render into a single on-screen surface if this call returns a null external view embedder. This happens on the GPU thread. More...
 
fml::RefPtr< vulkan::VulkanProcTablevk () override
 
- Public Member Functions inherited from flutter::AndroidSurface
virtual ~AndroidSurface ()
 
- Public Member Functions inherited from flutter::GPUSurfaceVulkanDelegate
 ~GPUSurfaceVulkanDelegate () override
 
- Public Member Functions inherited from flutter::GPUSurfaceDelegate
virtual ~GPUSurfaceDelegate ()
 

Detailed Description

Definition at line 21 of file android_surface_vulkan.h.

Constructor & Destructor Documentation

◆ AndroidSurfaceVulkan()

flutter::AndroidSurfaceVulkan::AndroidSurfaceVulkan ( std::shared_ptr< AndroidContext android_context,
std::shared_ptr< PlatformViewAndroidJNI jni_facade,
std::shared_ptr< AndroidExternalViewEmbedder external_view_embedder 
)

Definition at line 15 of file android_surface_vulkan.cc.

References ~AndroidSurfaceVulkan().

19  : external_view_embedder_(external_view_embedder),
20  proc_table_(fml::MakeRefCounted<vulkan::VulkanProcTable>()) {}

◆ ~AndroidSurfaceVulkan()

flutter::AndroidSurfaceVulkan::~AndroidSurfaceVulkan ( )
overridedefault

Referenced by AndroidSurfaceVulkan().

Member Function Documentation

◆ CreateGPUSurface()

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

Implements flutter::AndroidSurface.

Definition at line 32 of file android_surface_vulkan.cc.

References IsValid().

33  {
34  if (!IsValid()) {
35  return nullptr;
36  }
37 
38  if (!native_window_ || !native_window_->IsValid()) {
39  return nullptr;
40  }
41 
42  auto vulkan_surface_android =
43  std::make_unique<vulkan::VulkanNativeSurfaceAndroid>(
44  native_window_->handle());
45 
46  if (!vulkan_surface_android->IsValid()) {
47  return nullptr;
48  }
49 
50  auto gpu_surface = std::make_unique<GPUSurfaceVulkan>(
51  this, std::move(vulkan_surface_android), true);
52 
53  if (!gpu_surface->IsValid()) {
54  return nullptr;
55  }
56 
57  return gpu_surface;
58 }

◆ GetExternalViewEmbedder()

ExternalViewEmbedder * flutter::AndroidSurfaceVulkan::GetExternalViewEmbedder ( )
overridevirtual

Gets the view embedder that controls how the Flutter layer hierarchy split into multiple chunks should be composited back on-screen. This field is optional and the Flutter rasterizer will render into a single on-screen surface if this call returns a null external view embedder. This happens on the GPU thread.

Returns
The external view embedder, or, null if Flutter is rendering into a single on-screen surface.

Reimplemented from flutter::GPUSurfaceVulkanDelegate.

Definition at line 80 of file android_surface_vulkan.cc.

80  {
81  return external_view_embedder_.get();
82 }

◆ IsValid()

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

Implements flutter::AndroidSurface.

Definition at line 24 of file android_surface_vulkan.cc.

References vulkan::VulkanProcTable::HasAcquiredMandatoryProcAddresses().

Referenced by CreateGPUSurface().

24  {
25  return proc_table_->HasAcquiredMandatoryProcAddresses();
26 }
bool HasAcquiredMandatoryProcAddresses() const

◆ OnScreenSurfaceResize()

bool flutter::AndroidSurfaceVulkan::OnScreenSurfaceResize ( const SkISize &  size)
overridevirtual

Implements flutter::AndroidSurface.

Definition at line 60 of file android_surface_vulkan.cc.

60  {
61  return true;
62 }

◆ ResourceContextClearCurrent()

bool flutter::AndroidSurfaceVulkan::ResourceContextClearCurrent ( )
overridevirtual

Implements flutter::AndroidSurface.

Definition at line 69 of file android_surface_vulkan.cc.

References FML_DLOG.

69  {
70  FML_DLOG(ERROR) << "The vulkan backend does not support resource contexts.";
71  return false;
72 }
#define FML_DLOG(severity)
Definition: logging.h:85

◆ ResourceContextMakeCurrent()

bool flutter::AndroidSurfaceVulkan::ResourceContextMakeCurrent ( )
overridevirtual

Implements flutter::AndroidSurface.

Definition at line 64 of file android_surface_vulkan.cc.

References FML_DLOG.

64  {
65  FML_DLOG(ERROR) << "The vulkan backend does not support resource contexts.";
66  return false;
67 }
#define FML_DLOG(severity)
Definition: logging.h:85

◆ SetNativeWindow()

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

Implements flutter::AndroidSurface.

Definition at line 74 of file android_surface_vulkan.cc.

75  {
76  native_window_ = std::move(window);
77  return native_window_ && native_window_->IsValid();
78 }

◆ TeardownOnScreenContext()

void flutter::AndroidSurfaceVulkan::TeardownOnScreenContext ( )
overridevirtual

Implements flutter::AndroidSurface.

Definition at line 28 of file android_surface_vulkan.cc.

28  {
29  // Nothing to do.
30 }

◆ vk()

fml::RefPtr< vulkan::VulkanProcTable > flutter::AndroidSurfaceVulkan::vk ( )
overridevirtual

Implements flutter::GPUSurfaceVulkanDelegate.

Definition at line 84 of file android_surface_vulkan.cc.

84  {
85  return proc_table_;
86 }

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