Flutter Impeller
impeller::PlaygroundImpl Class Referenceabstract

#include <playground_impl.h>

Inheritance diagram for impeller::PlaygroundImpl:
impeller::PlaygroundImplGLES impeller::PlaygroundImplMTL impeller::PlaygroundImplVK

Public Types

using WindowHandle = void *
 

Public Member Functions

virtual ~PlaygroundImpl ()
 
virtual WindowHandle GetWindowHandle () const =0
 
virtual std::shared_ptr< ContextGetContext () const =0
 
virtual std::unique_ptr< SurfaceAcquireSurfaceFrame (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
 
virtual RuntimeStageBackend GetRuntimeStageBackend () const =0
 

Static Public Member Functions

static std::unique_ptr< PlaygroundImplCreate (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

Definition at line 25 of file playground_impl.h.

Constructor & Destructor Documentation

◆ ~PlaygroundImpl()

impeller::PlaygroundImpl::~PlaygroundImpl ( )
virtualdefault

◆ PlaygroundImpl()

impeller::PlaygroundImpl::PlaygroundImpl ( PlaygroundSwitches  switches)
explicitprotected

Definition at line 58 of file playground_impl.cc.

59  : switches_(switches) {}
const PlaygroundSwitches switches_

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
31  return std::make_unique<PlaygroundImplMTL>(switches);
33  switches.flags.use_sdfs = true;
34  return std::make_unique<PlaygroundImplMTL>(switches);
35 #endif // IMPELLER_ENABLE_METAL
36 #if IMPELLER_ENABLE_OPENGLES
38  return std::make_unique<PlaygroundImplGLES>(switches);
39 #endif // IMPELLER_ENABLE_OPENGLES
40 #if IMPELLER_ENABLE_VULKAN
43  FML_CHECK(false) << "Attempted to create playground with backend that "
44  "isn't available or was disabled on this platform: "
45  << PlaygroundBackendToString(backend);
46  }
47  switches.enable_vulkan_validation = true;
48  return std::make_unique<PlaygroundImplVK>(switches);
49 #endif // IMPELLER_ENABLE_VULKAN
50  default:
51  FML_CHECK(false) << "Attempted to create playground with backend that "
52  "isn't available or was disabled on this platform: "
53  << PlaygroundBackendToString(backend);
54  }
55  FML_UNREACHABLE();
56 }
std::string PlaygroundBackendToString(PlaygroundBackend backend)
Definition: playground.cc:47

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

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

◆ CreateGLProcAddressResolver()

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

Definition at line 72 of file playground_impl.cc.

73  {
74  return nullptr;
75 }

◆ CreateVKProcAddressResolver()

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

Definition at line 77 of file playground_impl.cc.

78  {
79  return nullptr;
80 }

◆ GetContentScale()

Vector2 impeller::PlaygroundImpl::GetContentScale ( ) const

Definition at line 63 of file playground_impl.cc.

63  {
64  auto window = reinterpret_cast<GLFWwindow*>(GetWindowHandle());
65 
66  Vector2 scale(1, 1);
67  ::glfwGetWindowContentScale(window, &scale.x, &scale.y);
68 
69  return scale;
70 }
virtual WindowHandle GetWindowHandle() const =0
Point Vector2
Definition: point.h:430

References GetWindowHandle(), impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

◆ GetContext()

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

◆ GetRuntimeStageBackend()

virtual RuntimeStageBackend impeller::PlaygroundImpl::GetRuntimeStageBackend ( ) 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

◆ SetGPUDisabled()

virtual void impeller::PlaygroundImpl::SetGPUDisabled ( bool  disabled) const
inlinevirtual

Definition at line 43 of file playground_impl.h.

43 {}

Member Data Documentation

◆ switches_

const PlaygroundSwitches impeller::PlaygroundImpl::switches_
protected

Definition at line 49 of file playground_impl.h.

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


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