Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
flutter::egl::Manager Class Reference

#include <manager.h>

Inheritance diagram for flutter::egl::Manager:
flutter::testing::egl::MockManager

Public Member Functions

virtual ~Manager ()
 
bool IsValid () const
 
virtual std::unique_ptr< WindowSurfaceCreateWindowSurface (HWND hwnd, size_t width, size_t height)
 
bool HasContextCurrent ()
 
EGLSurface CreateSurfaceFromHandle (EGLenum handle_type, EGLClientBuffer handle, const EGLint *attributes) const
 
EGLDisplay egl_display () const
 
bool GetDevice (ID3D11Device **device)
 
virtual Contextrender_context () const
 
virtual Contextresource_context () const
 

Static Public Member Functions

static std::unique_ptr< ManagerCreate (GpuPreference gpu_preference)
 
static std::optional< LUID > GetLowPowerGpuLuid ()
 
static std::optional< LUID > GetHighPerformanceGpuLuid ()
 

Protected Member Functions

 Manager (GpuPreference gpu_preference)
 

Detailed Description

Definition at line 40 of file manager.h.

Constructor & Destructor Documentation

◆ ~Manager()

flutter::egl::Manager::~Manager ( )
virtual

Definition at line 44 of file manager.cc.

44 {
45 CleanUp();
46 --instance_count_;
47}

◆ Manager()

flutter::egl::Manager::Manager ( GpuPreference  gpu_preference)
explicitprotected

Definition at line 26 of file manager.cc.

26 {
27 ++instance_count_;
28
29 if (!InitializeDisplay(gpu_preference)) {
30 return;
31 }
32
33 if (!InitializeConfig()) {
34 return;
35 }
36
37 if (!InitializeContexts()) {
38 return;
39 }
40
41 is_valid_ = true;
42}

Member Function Documentation

◆ Create()

std::unique_ptr< Manager > flutter::egl::Manager::Create ( GpuPreference  gpu_preference)
static

Definition at line 17 of file manager.cc.

17 {
18 std::unique_ptr<Manager> manager;
19 manager.reset(new Manager(gpu_preference));
20 if (!manager->IsValid()) {
21 return nullptr;
22 }
23 return std::move(manager);
24}
Manager(GpuPreference gpu_preference)
Definition manager.cc:26
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 manager

References flutter::manager.

◆ CreateSurfaceFromHandle()

EGLSurface flutter::egl::Manager::CreateSurfaceFromHandle ( EGLenum  handle_type,
EGLClientBuffer  handle,
const EGLint *  attributes 
) const

Definition at line 317 of file manager.cc.

319 {
320 return ::eglCreatePbufferFromClientBuffer(display_, handle_type, handle,
321 config_, attributes);
322}

◆ CreateWindowSurface()

std::unique_ptr< WindowSurface > flutter::egl::Manager::CreateWindowSurface ( HWND  hwnd,
size_t  width,
size_t  height 
)
virtual

Definition at line 283 of file manager.cc.

285 {
286 if (!hwnd || !is_valid_) {
287 return nullptr;
288 }
289
290 // Disable ANGLE's automatic surface resizing and provide an explicit size.
291 // The surface will need to be destroyed and re-created if the HWND is
292 // resized.
293 const EGLint surface_attributes[] = {EGL_FIXED_SIZE_ANGLE,
294 EGL_TRUE,
295 EGL_WIDTH,
296 static_cast<EGLint>(width),
297 EGL_HEIGHT,
298 static_cast<EGLint>(height),
299 EGL_NONE};
300
301 auto const surface = ::eglCreateWindowSurface(
302 display_, config_, static_cast<EGLNativeWindowType>(hwnd),
303 surface_attributes);
304 if (surface == EGL_NO_SURFACE) {
305 LogEGLError("Surface creation failed.");
306 return nullptr;
307 }
308
309 return std::make_unique<WindowSurface>(display_, render_context_->GetHandle(),
310 surface, width, height);
311}
VkSurfaceKHR surface
Definition main.cc:65
void LogEGLError(std::string_view message)
Log the last EGL error with an error message.
Definition egl.cc:55
int32_t height
int32_t width

References height, flutter::egl::LogEGLError(), surface, and width.

Referenced by flutter::FlutterWindowsView::CreateRenderSurface().

◆ egl_display()

EGLDisplay flutter::egl::Manager::egl_display ( ) const
inline

Definition at line 72 of file manager.h.

72{ return display_; };

◆ GetDevice()

bool flutter::egl::Manager::GetDevice ( ID3D11Device **  device)

Definition at line 324 of file manager.cc.

324 {
325 if (!resolved_device_) {
326 if (!InitializeDevice()) {
327 return false;
328 }
329 }
330
331 resolved_device_.CopyTo(device);
332 return (resolved_device_ != nullptr);
333}
VkDevice device
Definition main.cc:69

References device.

◆ GetHighPerformanceGpuLuid()

std::optional< LUID > flutter::egl::Manager::GetHighPerformanceGpuLuid ( )
static

Definition at line 380 of file manager.cc.

380 {
381 return GetGpuLuidByPreference(DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE);
382}

Referenced by flutter::testing::TEST_F().

◆ GetLowPowerGpuLuid()

std::optional< LUID > flutter::egl::Manager::GetLowPowerGpuLuid ( )
static

Definition at line 376 of file manager.cc.

376 {
377 return GetGpuLuidByPreference(DXGI_GPU_PREFERENCE_MINIMUM_POWER);
378}

Referenced by flutter::testing::TEST_F().

◆ HasContextCurrent()

bool flutter::egl::Manager::HasContextCurrent ( )

Definition at line 313 of file manager.cc.

313 {
314 return ::eglGetCurrentContext() != EGL_NO_CONTEXT;
315}

◆ IsValid()

bool flutter::egl::Manager::IsValid ( ) const

Definition at line 279 of file manager.cc.

279 {
280 return is_valid_;
281}

◆ render_context()

Context * flutter::egl::Manager::render_context ( ) const
virtual

Definition at line 335 of file manager.cc.

335 {
336 return render_context_.get();
337}

◆ resource_context()

Context * flutter::egl::Manager::resource_context ( ) const
virtual

Definition at line 339 of file manager.cc.

339 {
340 return resource_context_.get();
341}

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