#include <playground.h>
Public Types | |
using | SinglePassCallback = std::function< bool(RenderPass &pass)> |
using | RenderCallback = std::function< bool(RenderTarget &render_target)> |
using | GLProcAddressResolver = std::function< void *(const char *proc_name)> |
using | VKProcAddressResolver = std::function< void *(void *instance, const char *proc_name)> |
Public Member Functions | |
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 |
virtual std::unique_ptr< fml::Mapping > | OpenAssetAsMapping (std::string asset_name) const =0 |
virtual std::string | GetWindowTitle () const =0 |
fml::Status | SetCapabilities (const std::shared_ptr< Capabilities > &capabilities) |
bool | WillRenderSomething () const |
Returns true if OpenPlaygroundHere will actually render anything. More... | |
GLProcAddressResolver | CreateGLProcAddressResolver () const |
VKProcAddressResolver | CreateVKProcAddressResolver () const |
void | SetGPUDisabled (bool disabled) const |
Mark the GPU as unavilable. More... | |
Static Public Member Functions | |
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 | |
virtual bool | ShouldKeepRendering () const |
void | SetWindowSize (ISize size) |
Protected Attributes | |
const PlaygroundSwitches | switches_ |
Definition at line 48 of file playground.h.
using impeller::Playground::GLProcAddressResolver = std::function<void*(const char* proc_name)> |
Definition at line 118 of file playground.h.
using impeller::Playground::RenderCallback = std::function<bool(RenderTarget& render_target)> |
Definition at line 81 of file playground.h.
using impeller::Playground::SinglePassCallback = std::function<bool(RenderPass& pass)> |
Definition at line 50 of file playground.h.
using impeller::Playground::VKProcAddressResolver = std::function<void*(void* instance, const char* proc_name)> |
Definition at line 121 of file playground.h.
|
explicit |
Definition at line 84 of file playground.cc.
References impeller::InitializeGLFWOnce(), impeller::SetupSwiftshaderOnce(), switches_, and impeller::PlaygroundSwitches::use_swiftshader.
|
virtualdefault |
Playground::GLProcAddressResolver impeller::Playground::CreateGLProcAddressResolver | ( | ) | const |
Definition at line 520 of file playground.cc.
Referenced by impeller::interop::testing::PlaygroundTest::CreateContext().
std::shared_ptr< Texture > impeller::Playground::CreateTextureCubeForFixture | ( | std::array< const char *, 6 > | fixture_names | ) | const |
Definition at line 458 of file playground.cc.
References impeller::DeviceBuffer::AsBufferView(), DecodeImageRGBA(), impeller::TextureDescriptor::format, impeller::kDevicePrivate, impeller::kR8G8B8A8UNormInt, impeller::kTextureCube, LoadFixtureImageCompressed(), impeller::TextureDescriptor::mip_count, OpenAssetAsMapping(), impeller::TextureDescriptor::size, impeller::TextureDescriptor::storage_mode, impeller::TextureDescriptor::type, and VALIDATION_LOG.
std::shared_ptr< Texture > impeller::Playground::CreateTextureForFixture | ( | const char * | fixture_name, |
bool | enable_mipmapping = false |
||
) | const |
Definition at line 446 of file playground.cc.
References CreateTextureForMapping(), and OpenAssetAsMapping().
|
static |
Definition at line 433 of file playground.cc.
References impeller::CreateTextureForDecompressedImage(), DecodeImageRGBA(), and LoadFixtureImageCompressed().
Referenced by impeller::DlPlayground::CreateDlImageForFixture(), impeller::GoldenPlaygroundTest::CreateTextureForFixture(), and CreateTextureForFixture().
Playground::VKProcAddressResolver impeller::Playground::CreateVKProcAddressResolver | ( | ) | const |
Definition at line 525 of file playground.cc.
Referenced by impeller::interop::testing::PlaygroundTest::CreateContext().
|
static |
Definition at line 372 of file playground.cc.
References VALIDATION_LOG.
Referenced by CreateTextureCubeForFixture(), CreateTextureForMapping(), and impeller::interop::testing::PlaygroundTest::OpenAssetAsHPPTexture().
Point impeller::Playground::GetContentScale | ( | ) | const |
Definition at line 189 of file playground.cc.
Referenced by impeller::testing::CanRenderConicalGradientWithDithering(), impeller::testing::CanRenderSweepGradientWithDithering(), and impeller::testing::MaskBlurVariantTest().
std::shared_ptr< Context > impeller::Playground::GetContext | ( | ) | const |
Definition at line 91 of file playground.cc.
Referenced by impeller::DlPlayground::CreateDlImageForFixture(), impeller::EntityPlayground::GetContentContext(), impeller::interop::testing::PlaygroundTest::GetInteropContext(), impeller::testing::RendererDartTest::GetIsolate(), impeller::testing::BlendFilterContentsTest::MakeTexture(), impeller::testing::GaussianBlurFilterContentsTest::MakeTexture(), impeller::testing::MatrixFilterContentsTest::MakeTexture(), impeller::AiksPlayground::OpenPlaygroundHere(), impeller::DlPlayground::OpenPlaygroundHere(), impeller::EntityPlayground::OpenPlaygroundHere(), OpenPlaygroundHere(), impeller::RuntimeStagePlayground::RegisterStage(), and impeller::testing::RendererDartTest::RenderDartToPlayground().
Point impeller::Playground::GetCursorPosition | ( | ) | const |
Definition at line 181 of file playground.cc.
Scalar impeller::Playground::GetSecondsElapsed | ( | ) | const |
Get the amount of time elapsed from the start of the playground's execution.
Definition at line 193 of file playground.cc.
ISize impeller::Playground::GetWindowSize | ( | ) | const |
Definition at line 185 of file playground.cc.
Referenced by impeller::testing::RendererDartTest::GetRenderedTextureFromDart(), OpenPlaygroundHere(), and impeller::testing::RendererDartTest::RunDartFunctionWithWindowSize().
|
pure virtual |
Implemented in impeller::PlaygroundTest, and impeller::ComputePlaygroundTest.
Referenced by OpenPlaygroundHere().
bool impeller::Playground::IsPlaygroundEnabled | ( | ) | const |
Definition at line 147 of file playground.cc.
References impeller::PlaygroundSwitches::enable_playground, and switches_.
Referenced by impeller::testing::RendererDartTest::RenderDartToPlayground().
|
static |
Definition at line 361 of file playground.cc.
References impeller::CompressedImageSkia::Create(), and VALIDATION_LOG.
Referenced by CreateTextureCubeForFixture(), CreateTextureForMapping(), and impeller::interop::testing::PlaygroundTest::OpenAssetAsHPPTexture().
std::shared_ptr< Context > impeller::Playground::MakeContext | ( | ) | const |
Definition at line 95 of file playground.cc.
|
pure virtual |
Implemented in impeller::PlaygroundTest, and impeller::ComputePlaygroundTest.
Referenced by CreateTextureCubeForFixture(), and CreateTextureForFixture().
bool impeller::Playground::OpenPlaygroundHere | ( | const RenderCallback & | render_callback | ) |
Definition at line 201 of file playground.cc.
References impeller::HostBuffer::Create(), impeller::android::testing::CreateContext(), impeller::PlaygroundSwitches::enable_playground, impeller::RenderTarget::GetColorAttachment(), GetWindowSize(), GetWindowTitle(), ImGui_ImplImpeller_Init(), ImGui_ImplImpeller_RenderDrawData(), ImGui_ImplImpeller_Shutdown(), impeller::kLoad, impeller::kStore, impeller::Attachment::load_action, impeller::TSize< T >::Max(), impeller::PlaygroundKeyCallback(), impeller::RenderTarget::SetColorAttachment(), impeller::RenderTarget::SetDepthAttachment(), impeller::RenderTarget::SetStencilAttachment(), SetWindowSize(), ShouldKeepRendering(), switches_, VALIDATION_LOG, and x.
Referenced by impeller::AiksPlayground::OpenPlaygroundHere(), impeller::DlPlayground::OpenPlaygroundHere(), impeller::EntityPlayground::OpenPlaygroundHere(), impeller::interop::testing::PlaygroundTest::OpenPlaygroundHere(), OpenPlaygroundHere(), impeller::testing::RendererDartTest::RenderDartToPlayground(), and impeller::testing::TEST_P().
bool impeller::Playground::OpenPlaygroundHere | ( | SinglePassCallback | pass_callback | ) |
Definition at line 334 of file playground.cc.
References GetContext(), and OpenPlaygroundHere().
fml::Status impeller::Playground::SetCapabilities | ( | const std::shared_ptr< Capabilities > & | capabilities | ) |
Definition at line 511 of file playground.cc.
void impeller::Playground::SetGPUDisabled | ( | bool | disabled | ) | const |
Mark the GPU as unavilable.
Only supported on the Metal backend.
Definition at line 530 of file playground.cc.
References value.
void impeller::Playground::SetupContext | ( | PlaygroundBackend | backend, |
const PlaygroundSwitches & | switches | ||
) |
Definition at line 125 of file playground.cc.
References impeller::PlaygroundImpl::Create(), and SupportsBackend().
Referenced by impeller::ComputePlaygroundTest::SetUp(), and impeller::PlaygroundTest::SetUp().
void impeller::Playground::SetupWindow | ( | ) |
Definition at line 138 of file playground.cc.
Referenced by impeller::ComputePlaygroundTest::SetUp(), and impeller::PlaygroundTest::SetUp().
|
protected |
Definition at line 503 of file playground.cc.
Referenced by OpenPlaygroundHere().
|
protectedvirtual |
Definition at line 507 of file playground.cc.
Referenced by OpenPlaygroundHere().
|
static |
Definition at line 164 of file playground.cc.
References impeller::gShouldOpenNewPlaygrounds.
Referenced by impeller::ComputePlaygroundTest::SetUp(), and impeller::PlaygroundTest::SetUp().
|
static |
Definition at line 101 of file playground.cc.
References impeller::PlaygroundImplVK::IsVulkanDriverPresent(), impeller::kMetal, impeller::kOpenGLES, and impeller::kVulkan.
Referenced by impeller::ComputePlaygroundTest::SetUp(), impeller::PlaygroundTest::SetUp(), and SetupContext().
void impeller::Playground::TeardownWindow | ( | ) |
Definition at line 151 of file playground.cc.
Referenced by impeller::ComputePlaygroundTest::TearDown(), and impeller::PlaygroundTest::TearDown().
bool impeller::Playground::WillRenderSomething | ( | ) | const |
Returns true if OpenPlaygroundHere
will actually render anything.
Definition at line 516 of file playground.cc.
References impeller::PlaygroundSwitches::enable_playground, and switches_.
|
protected |
Definition at line 131 of file playground.h.
Referenced by impeller::interop::testing::PlaygroundTest::CreateContext(), impeller::PlaygroundTest::GetWindowTitle(), IsPlaygroundEnabled(), OpenPlaygroundHere(), impeller::DlPlayground::OpenPlaygroundHere(), impeller::EntityPlayground::OpenPlaygroundHere(), Playground(), impeller::ComputePlaygroundTest::SetUp(), impeller::PlaygroundTest::SetUp(), and WillRenderSomething().