| Flutter Impeller |

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
impeller::PlaygroundImpl Class Referenceabstract

`#include <playground_impl.h>`

Inheritance diagram for impeller::PlaygroundImpl:

## Public Types
using | WindowHandle = void *

## Public Member Functions
virtual | ~PlaygroundImpl ()
virtual WindowHandle | GetWindowHandle () const =0
virtual std::shared_ptr< Context > | GetContext () const =0
virtual std::unique_ptr< Surface > | AcquireSurfaceFrame (std::shared_ptr< Context > context)=0
Vector2 | GetContentScale () const
virtual fml::Status | SetCapabilities (const std::shared_ptr< Capabilities > &capabilities)=0
virtual Playground::GLProcAddressResolver | CreateGLProcAddressResolver () const
virtual Playground::VKProcAddressResolver | CreateVKProcAddressResolver () const
virtual void | SetGPUDisabled (bool disabled) const

## Static Public Member Functions
static std::unique_ptr< PlaygroundImpl > | Create (PlaygroundBackend backend, PlaygroundSwitches switches)

## Protected Member Functions
| PlaygroundImpl (PlaygroundSwitches switches)

## Protected Attributes
const PlaygroundSwitches | switches_

## Detailed Description

Definition at line 18 of file playground_impl.h.

## Member Typedef Documentation

## ◆ WindowHandle

using impeller::PlaygroundImpl::WindowHandle = void*

Definition at line 25 of file playground_impl.h.

## Constructor & Destructor Documentation

## ◆ ~PlaygroundImpl()

impeller::PlaygroundImpl::~PlaygroundImpl | ( |  | ) |
| virtual default

## ◆ PlaygroundImpl()

impeller::PlaygroundImpl::PlaygroundImpl | ( | PlaygroundSwitches | switches | ) |
| explicit protected

Definition at line 55 of file playground_impl.cc.

56 : switches_(switches) {}
impeller::PlaygroundImpl::switches_
const PlaygroundSwitches switches_
Definition: playground_impl.h:46

## Member Function Documentation

## ◆ AcquireSurfaceFrame()

virtual std::unique_ptr<Surface> impeller::PlaygroundImpl::AcquireSurfaceFrame | ( | std::shared_ptr< Context > | context | ) |
| pure virtual

## ◆ Create()

std::unique_ptr< PlaygroundImpl > impeller::PlaygroundImpl::Create | ( | PlaygroundBackend | backend,
|  | PlaygroundSwitches | switches
| ) |  |
| static

Definition at line 25 of file playground_impl.cc.

27 {
28 switch (backend) {
29 #if IMPELLER_ENABLE_METAL
30 case PlaygroundBackend::kMetal:
31 return std::make_unique<PlaygroundImplMTL>(switches);
32 #endif // IMPELLER_ENABLE_METAL
33 #if IMPELLER_ENABLE_OPENGLES
34 case PlaygroundBackend::kOpenGLES:
35 return std::make_unique<PlaygroundImplGLES>(switches);
36 #endif // IMPELLER_ENABLE_OPENGLES
37 #if IMPELLER_ENABLE_VULKAN
38 case PlaygroundBackend::kVulkan:
39 if (!PlaygroundImplVK::IsVulkanDriverPresent()) {
40 FML_CHECK(false) << "Attempted to create playground with backend that "
41 "isn't available or was disabled on this platform: "
42 << PlaygroundBackendToString(backend);
43 }
44 switches.enable_vulkan_validation = true;
45 return std::make_unique<PlaygroundImplVK>(switches);
46 #endif // IMPELLER_ENABLE_VULKAN
47 default:
48 FML_CHECK(false) << "Attempted to create playground with backend that "
49 "isn't available or was disabled on this platform: "
50 << PlaygroundBackendToString(backend);
51 }
52 FML_UNREACHABLE();
53 }
impeller::PlaygroundImplVK::IsVulkanDriverPresent
static bool IsVulkanDriverPresent()
Definition: playground_impl_vk.cc:224
impeller::PlaygroundBackendToString
std::string PlaygroundBackendToString(PlaygroundBackend backend)
Definition: playground.cc:46
impeller::PlaygroundBackend::kOpenGLES
@ kOpenGLES
impeller::PlaygroundBackend::kMetal
@ kMetal
impeller::PlaygroundBackend::kVulkan
@ kVulkan

References impeller::PlaygroundSwitches::enable_vulkan_validation, impeller::PlaygroundImplVK::IsVulkanDriverPresent(), impeller::kMetal, impeller::kOpenGLES, impeller::kVulkan, and impeller::PlaygroundBackendToString().

Referenced by impeller::testing::MetalScreenshotter::MetalScreenshotter(), impeller::GoldenPlaygroundTest::SetUp(), and impeller::Playground::SetupContext().

## ◆ CreateGLProcAddressResolver()

Playground::GLProcAddressResolver impeller::PlaygroundImpl::CreateGLProcAddressResolver | ( |  | ) | const
| virtual

Definition at line 69 of file playground_impl.cc.

70 {
71 return nullptr;
72 }

## ◆ CreateVKProcAddressResolver()

Playground::VKProcAddressResolver impeller::PlaygroundImpl::CreateVKProcAddressResolver | ( |  | ) | const
| virtual

Definition at line 74 of file playground_impl.cc.

75 {
76 return nullptr;
77 }

## ◆ GetContentScale()

Vector2 impeller::PlaygroundImpl::GetContentScale | ( |  | ) | const

Definition at line 60 of file playground_impl.cc.

60 {
61 auto window = reinterpret_cast<GLFWwindow*>(GetWindowHandle());
62
63 Vector2 scale(1, 1);
64 ::glfwGetWindowContentScale(window, &scale.x, &scale.y);
65
66 return scale;
67 }
impeller::PlaygroundImpl::GetWindowHandle
virtual WindowHandle GetWindowHandle() const =0
impeller::Vector2
Point Vector2
Definition: point.h:331
scale
const Scalar scale
Definition: stroke_path_geometry.cc:319

References GetWindowHandle(), and scale.

## ◆ GetContext()

virtual std::shared_ptr<Context> impeller::PlaygroundImpl::GetContext | ( |  | ) | const
| pure virtual

## ◆ GetWindowHandle()

virtual WindowHandle impeller::PlaygroundImpl::GetWindowHandle | ( |  | ) | const
| pure virtual

Referenced by GetContentScale().

## ◆ SetCapabilities()

virtual fml::Status impeller::PlaygroundImpl::SetCapabilities | ( | const std::shared_ptr< Capabilities > & | capabilities | ) |
| pure virtual

Implemented in impeller::PlaygroundImplVK, impeller::PlaygroundImplMTL, and impeller::PlaygroundImplGLES.

## ◆ SetGPUDisabled()

virtual void impeller::PlaygroundImpl::SetGPUDisabled | ( | bool | disabled | ) | const
| inline virtual

Definition at line 43 of file playground_impl.h.

43 {}

## Member Data Documentation

## ◆ switches_

const PlaygroundSwitches impeller::PlaygroundImpl::switches_
| protected

Definition at line 46 of file playground_impl.h.

Referenced by impeller::PlaygroundImplVK::PlaygroundImplVK().

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

- impeller/playground/playground_impl.h
- impeller/playground/playground_impl.cc