| Flutter Impeller |

Public Member Functions | List of all members
impeller::ComputePlaygroundTest Class Reference

`#include <compute_playground_test.h>`

Inheritance diagram for impeller::ComputePlaygroundTest:

## Public Member Functions
| ComputePlaygroundTest ()
virtual | ~ComputePlaygroundTest ()
void | SetUp () override
void | TearDown () override
std::unique_ptr< fml::Mapping > | OpenAssetAsMapping (std::string asset_name) const override
std::string | GetWindowTitle () const override
template<typename T >
std::shared_ptr< DeviceBuffer > | CreateHostVisibleDeviceBuffer (const std::shared_ptr< Context > &context, const std::string &label)
Public Member Functions inherited from impeller::Playground
| Playground (PlaygroundSwitches switches)
virtual | ~Playground ()
void | SetupContext (PlaygroundBackend backend, const PlaygroundSwitches &switches)
void | SetupWindow ()
void | TeardownWindow ()
bool | IsPlaygroundEnabled () const
Point | GetCursorPosition () const
ISize | GetWindowSize () const
Point | GetContentScale () const
Scalar | GetSecondsElapsed () const
| Get the amount of time elapsed from the start of the playground's execution. More...
std::shared_ptr< Context > | GetContext () const
std::shared_ptr< Context > | MakeContext () const
bool | OpenPlaygroundHere (const RenderCallback &render_callback)
bool | OpenPlaygroundHere (SinglePassCallback pass_callback)
std::shared_ptr< Texture > | CreateTextureForFixture (const char *fixture_name, bool enable_mipmapping=false) const
std::shared_ptr< Texture > | CreateTextureCubeForFixture (std::array< const char *, 6 > fixture_names) const
fml::Status | SetCapabilities (const std::shared_ptr< Capabilities > &capabilities)
bool | WillRenderSomething () const
| Returns true if `OpenPlaygroundHere` will actually render anything. More...
GLProcAddressResolver | CreateGLProcAddressResolver () const

## Additional Inherited Members
Public Types inherited from impeller::Playground
using | SinglePassCallback = std::function< bool(RenderPass &pass)>
using | RenderCallback = std::function< bool(RenderTarget &render_target)>
using | GLProcAddressResolver = std::function< void *(const char *proc_name)>
Static Public Member Functions inherited from impeller::Playground
static bool | ShouldOpenNewPlaygrounds ()
static std::shared_ptr< CompressedImage > | LoadFixtureImageCompressed (std::shared_ptr< fml::Mapping > mapping)
static std::optional< DecompressedImage > | DecodeImageRGBA (const std::shared_ptr< CompressedImage > &compressed)
static std::shared_ptr< Texture > | CreateTextureForMapping (const std::shared_ptr< Context > &context, std::shared_ptr< fml::Mapping > mapping, bool enable_mipmapping=false)
static bool | SupportsBackend (PlaygroundBackend backend)
Protected Member Functions inherited from impeller::Playground
virtual bool | ShouldKeepRendering () const
void | SetWindowSize (ISize size)
Protected Attributes inherited from impeller::Playground
const PlaygroundSwitches | switches_

## Detailed Description

Definition at line 17 of file compute_playground_test.h.

## Constructor & Destructor Documentation

## ◆ ComputePlaygroundTest()

impeller::ComputePlaygroundTest::ComputePlaygroundTest | ( |  | ) |

Definition at line 12 of file compute_playground_test.cc.

13 : Playground(PlaygroundSwitches{flutter::testing::GetArgsForProcess()}) {}

## ◆ ~ComputePlaygroundTest()

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

## Member Function Documentation

## ◆ CreateHostVisibleDeviceBuffer()

template<typename T >

std::shared_ptr<DeviceBuffer> impeller::ComputePlaygroundTest::CreateHostVisibleDeviceBuffer | ( | const std::shared_ptr< Context > & | context,
|  | const std::string & | label
| ) |  |
| inline

Definition at line 37 of file compute_playground_test.h.

39 {
40 DeviceBufferDescriptor desc;
41 desc.storage_mode = StorageMode::kHostVisible;
42 desc.size = sizeof(T);
43 auto buffer = context->GetResourceAllocator()->CreateBuffer(desc);
44 buffer->SetLabel(label);
45 return buffer;
46 }

References impeller::kHostVisible, impeller::DeviceBufferDescriptor::size, and impeller::DeviceBufferDescriptor::storage_mode.

## ◆ GetWindowTitle()

std::string impeller::ComputePlaygroundTest::GetWindowTitle | ( |  | ) | const
| override virtual

Implements impeller::Playground.

Definition at line 51 of file compute_playground_test.cc.

51 {
52 return FormatWindowTitle(flutter::testing::GetCurrentTestName());
53 }

References impeller::FormatWindowTitle().

## ◆ OpenAssetAsMapping()

std::unique_ptr< fml::Mapping > impeller::ComputePlaygroundTest::OpenAssetAsMapping | ( | std::string | asset_name | ) | const
| override virtual

Implements impeller::Playground.

Definition at line 39 of file compute_playground_test.cc.

40 {
41 return flutter::testing::OpenFixtureAsMapping(asset_name);
42 }

## ◆ SetUp()

void impeller::ComputePlaygroundTest::SetUp | ( |  | ) |
| override

Definition at line 17 of file compute_playground_test.cc.

17 {
18 if (!Playground::SupportsBackend(GetParam())) {
19 GTEST_SKIP() << "Playground doesn't support this backend type.";
20 return;
21 }
22
23 if (!Playground::ShouldOpenNewPlaygrounds()) {
24 GTEST_SKIP() << "Skipping due to user action.";
25 return;
26 }
27
28 SetupContext(GetParam(), switches_);
29 SetupWindow();
30
31 start_time_ = fml::TimePoint::Now().ToEpochDelta();
32 }

References impeller::Playground::SetupContext(), impeller::Playground::SetupWindow(), impeller::Playground::ShouldOpenNewPlaygrounds(), impeller::Playground::SupportsBackend(), and impeller::Playground::switches_.

## ◆ TearDown()

void impeller::ComputePlaygroundTest::TearDown | ( |  | ) |
| override

Definition at line 34 of file compute_playground_test.cc.

34 {
35 TeardownWindow();
36 }

References impeller::Playground::TeardownWindow().

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

- impeller/playground/compute_playground_test.h
- impeller/playground/compute_playground_test.cc

impeller::Playground::ShouldOpenNewPlaygrounds
static bool ShouldOpenNewPlaygrounds()
Definition: playground.cc:160
impeller::StorageMode::kHostVisible
@ kHostVisible
impeller::FormatWindowTitle
static std::string FormatWindowTitle(const std::string &test_name)
Definition: compute_playground_test.cc:44
impeller::Playground::SetupWindow
void SetupWindow()
Definition: playground.cc:137
impeller::Playground::switches_
const PlaygroundSwitches switches_
Definition: playground.h:121
impeller::Playground::SetupContext
void SetupContext(PlaygroundBackend backend, const PlaygroundSwitches &switches)
Definition: playground.cc:124
impeller::Playground::SupportsBackend
static bool SupportsBackend(PlaygroundBackend backend)
Definition: playground.cc:100
impeller::Playground::TeardownWindow
void TeardownWindow()
Definition: playground.cc:150
impeller::Playground::Playground
Playground(PlaygroundSwitches switches)
Definition: playground.cc:83