Flutter Impeller
impeller::ComputePlaygroundTest Class Reference

#include <compute_playground_test.h>

Inheritance diagram for impeller::ComputePlaygroundTest:
impeller::Playground

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::shared_ptr< RuntimeStageOpenAssetAsRuntimeStage (const char *asset_name) const
 
std::string GetWindowTitle () const override
 
template<typename T >
std::shared_ptr< DeviceBufferCreateHostVisibleDeviceBuffer (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)
 
void SetupWindow ()
 
void TeardownWindow ()
 
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< ContextGetContext () const
 
bool OpenPlaygroundHere (const Renderer::RenderCallback &render_callback)
 
bool OpenPlaygroundHere (SinglePassCallback pass_callback)
 
std::shared_ptr< TextureCreateTextureForFixture (const char *fixture_name, bool enable_mipmapping=false) const
 
std::shared_ptr< TextureCreateTextureCubeForFixture (std::array< const char *, 6 > fixture_names) const
 

Additional Inherited Members

- Public Types inherited from impeller::Playground
using SinglePassCallback = std::function< bool(RenderPass &pass)>
 
- Static Public Member Functions inherited from impeller::Playground
static bool ShouldOpenNewPlaygrounds ()
 
static std::shared_ptr< CompressedImageLoadFixtureImageCompressed (std::shared_ptr< fml::Mapping > mapping)
 
static std::optional< DecompressedImageDecodeImageRGBA (const std::shared_ptr< CompressedImage > &compressed)
 
static std::shared_ptr< TextureCreateTextureForMapping (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
 
- Protected Attributes inherited from impeller::Playground
const PlaygroundSwitches switches_
 

Detailed Description

Definition at line 18 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 ( )
virtualdefault

Member Function Documentation

◆ CreateHostVisibleDeviceBuffer()

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

Definition at line 41 of file compute_playground_test.h.

43  {
44  DeviceBufferDescriptor desc;
45  desc.storage_mode = StorageMode::kHostVisible;
46  desc.size = sizeof(T);
47  auto buffer = context->GetResourceAllocator()->CreateBuffer(desc);
48  buffer->SetLabel(label);
49  return buffer;
50  }

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

◆ GetWindowTitle()

std::string impeller::ComputePlaygroundTest::GetWindowTitle ( ) const
overridevirtual

Implements impeller::Playground.

Definition at line 64 of file compute_playground_test.cc.

64  {
65  return FormatWindowTitle(flutter::testing::GetCurrentTestName());
66 }

References impeller::FormatWindowTitle().

◆ OpenAssetAsMapping()

std::unique_ptr< fml::Mapping > impeller::ComputePlaygroundTest::OpenAssetAsMapping ( std::string  asset_name) const
overridevirtual

Implements impeller::Playground.

Definition at line 39 of file compute_playground_test.cc.

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

◆ OpenAssetAsRuntimeStage()

std::shared_ptr< RuntimeStage > impeller::ComputePlaygroundTest::OpenAssetAsRuntimeStage ( const char *  asset_name) const

Definition at line 44 of file compute_playground_test.cc.

45  {
46  auto fixture = flutter::testing::OpenFixtureAsMapping(asset_name);
47  if (!fixture || fixture->GetSize() == 0) {
48  return nullptr;
49  }
50  auto stage = std::make_unique<RuntimeStage>(std::move(fixture));
51  if (!stage->IsValid()) {
52  return nullptr;
53  }
54  return stage;
55 }

◆ 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 
24  GTEST_SKIP_("Skipping due to user action.");
25  return;
26  }
27 
28  SetupContext(GetParam());
29  SetupWindow();
30 
31  start_time_ = fml::TimePoint::Now().ToEpochDelta();
32 }

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

◆ TearDown()

void impeller::ComputePlaygroundTest::TearDown ( )
override

Definition at line 34 of file compute_playground_test.cc.

34  {
36 }

References impeller::Playground::TeardownWindow().


The documentation for this class was generated from the following files:
impeller::Playground::ShouldOpenNewPlaygrounds
static bool ShouldOpenNewPlaygrounds()
Definition: playground.cc:152
impeller::StorageMode::kHostVisible
@ kHostVisible
impeller::FormatWindowTitle
static std::string FormatWindowTitle(const std::string &test_name)
Definition: compute_playground_test.cc:57
impeller::Playground::SetupWindow
void SetupWindow()
Definition: playground.cc:126
impeller::Playground::SetupContext
void SetupContext(PlaygroundBackend backend)
Definition: playground.cc:114
impeller::Playground::SupportsBackend
static bool SupportsBackend(PlaygroundBackend backend)
Definition: playground.cc:90
impeller::Playground::TeardownWindow
void TeardownWindow()
Definition: playground.cc:141
impeller::Playground::Playground
Playground(PlaygroundSwitches switches)
Definition: playground.cc:80