#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 (PlaygroundBackend backend, const PlaygroundSwitches &switches) | |
| virtual | ~Playground () |
| bool | IsPlaygroundEnabled () const |
| Point | GetCursorPosition () const |
| ISize | GetWindowSize () const |
| IRect | GetWindowBounds () const |
| Point | GetContentScale () const |
| Scalar | GetSecondsElapsed () const |
| Get the amount of time elapsed from the start of the playground's execution. | |
| std::shared_ptr< Context > | GetContext () const |
| std::shared_ptr< Context > | MakeContext () const |
| ContentContext & | GetContentContext () const |
| std::shared_ptr< TypographerContext > | GetTypographerContext () const |
| bool | ShouldWriteGoldenImage () |
| Whether this instance will write a golden image of the output from |OpenPlaygroundHere|. | |
| void | SetEnableWriteGolden (bool write_golden) |
| Sets a particular test to either write a golden or not, false by default. | |
| bool | OpenPlaygroundHere (const RenderCallback &render_callback) |
| bool | OpenPlaygroundHere (const 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) |
| GLProcAddressResolver | CreateGLProcAddressResolver () const |
| VKProcAddressResolver | CreateVKProcAddressResolver () const |
| void | SetGPUDisabled (bool disabled) const |
| Mark the GPU as unavilable. | |
| RuntimeStageBackend | GetRuntimeStageBackend () const |
| bool | InitializePipelineDescriptorForRendering (PipelineDescriptor &desc) const |
| Initializes the provided |PipelineDescriptor| with appropriate default values to match the conditions under which a pipeline will be rendered. | |
Static Public Member Functions | |
| static void | OnTearDownTestEnvironment () |
| 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 | |
| void | TearDownContextData () |
| virtual bool | ShouldKeepRendering () const |
| virtual void | EnsureContextIsUnique () |
| Make sure that when the context is later created that it will not be shared with any other playgrounds. | |
| bool | PlatformSupportsWideGamutTests () const |
| Returns true if the platform can support wide gamuts. | |
| bool | RenderingSupportsMSAA () const |
| Returns true if the rendering path supports MSAA rendering. | |
| SampleCount | GetDefaultSampleCount () const |
| Returns the default sample count of the rendering path. | |
| virtual bool | EnsureContextSupportsWideGamut () |
| Make sure that when the context is later created that it will support wide gamuts if the platform supports it. Returns whether the platform supports wide gamut. | |
| const PlaygroundSwitches & | GetSwitches () const |
| Return an unmodifiable reference to the current switches. The switches might change at the start of a test as it has a brief opportunity to call any of the Ensure* methods that define the environment it expects, but should be stable by the time any subsequent methods that might perform work are called. | |
| void | SetTypographerContext (std::shared_ptr< TypographerContext > typographer_context) |
| void | SetWindowSize (ISize size) |
| virtual testing::GoldenDigestManager * | GetGoldenDigestManager () const |
Definition at line 42 of file playground.h.
| using impeller::Playground::GLProcAddressResolver = std::function<void*(const char* proc_name)> |
Definition at line 119 of file playground.h.
| using impeller::Playground::RenderCallback = std::function<bool(RenderTarget& render_target)> |
Definition at line 77 of file playground.h.
| using impeller::Playground::SinglePassCallback = std::function<bool(RenderPass& pass)> |
Definition at line 44 of file playground.h.
| using impeller::Playground::VKProcAddressResolver = std::function<void*(void* instance, const char* proc_name)> |
Definition at line 122 of file playground.h.
|
explicit |
Definition at line 125 of file playground.cc.
References flutter::testing::SetupSwiftshaderOnce(), and impeller::PlaygroundSwitches::use_swiftshader.
|
virtualdefault |
| Playground::GLProcAddressResolver impeller::Playground::CreateGLProcAddressResolver | ( | ) | const |
Definition at line 775 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 716 of file playground.cc.
References impeller::DeviceBuffer::AsBufferView(), DecodeImageRGBA(), impeller::TextureDescriptor::format, GetContext(), i, image, images, impeller::kDevicePrivate, impeller::kR8G8B8A8UNormInt, impeller::kTextureCube, LoadFixtureImageCompressed(), impeller::TextureDescriptor::mip_count, OpenAssetAsMapping(), impeller::TextureDescriptor::size, impeller::TextureDescriptor::storage_mode, texture, 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 704 of file playground.cc.
References CreateTextureForMapping(), GetContext(), OpenAssetAsMapping(), and texture.
|
static |
Definition at line 691 of file playground.cc.
References context, impeller::CreateTextureForDecompressedImage(), DecodeImageRGBA(), image, and LoadFixtureImageCompressed().
Referenced by impeller::DlPlayground::CreateDlImageForFixture(), impeller::GoldenPlaygroundTest::CreateTextureForFixture(), and CreateTextureForFixture().
| Playground::VKProcAddressResolver impeller::Playground::CreateVKProcAddressResolver | ( | ) | const |
Definition at line 780 of file playground.cc.
Referenced by impeller::interop::testing::PlaygroundTest::CreateContext().
|
static |
Definition at line 630 of file playground.cc.
References image, and VALIDATION_LOG.
Referenced by CreateTextureCubeForFixture(), CreateTextureForMapping(), and impeller::interop::testing::PlaygroundTest::OpenAssetAsHPPTexture().
|
protectedvirtual |
Make sure that when the context is later created that it will not be shared with any other playgrounds.
Must be called before any other method except for the Ensure family of methods.
Definition at line 134 of file playground.cc.
References impeller::PlaygroundSwitches::can_share_context, and FML_CHECK.
|
protectedvirtual |
Make sure that when the context is later created that it will support wide gamuts if the platform supports it. Returns whether the platform supports wide gamut.
Must be called before any other method except for the Ensure family of methods.
Callers should abort (such as via GTEST_SKIP) if the method returns false if their behavior depends on the wide gamut support.
Definition at line 190 of file playground.cc.
References impeller::PlaygroundSwitches::enable_wide_gamut, FML_CHECK, and PlatformSupportsWideGamutTests().
| ContentContext & impeller::Playground::GetContentContext | ( | ) | const |
Definition at line 219 of file playground.cc.
References FML_CHECK, GetContext(), and GetTypographerContext().
Referenced by impeller::testing::BlendFilterContentsTest::MakeTexture(), impeller::testing::GaussianBlurFilterContentsTest::MakeTexture(), impeller::testing::MatrixFilterContentsTest::MakeTexture(), impeller::testing::MorphologyFilterContentsTest::MakeTexture(), impeller::EntityPlayground::OpenPlaygroundHere(), and impeller::EntityPlayground::OpenPlaygroundHere().
| Point impeller::Playground::GetContentScale | ( | ) | const |
Definition at line 348 of file playground.cc.
Referenced by impeller::testing::CanRenderConicalGradientWithDithering(), impeller::testing::CanRenderSweepGradientWithDithering(), impeller::DlPlayground::MakeScreenshot(), and impeller::testing::MaskBlurVariantTest().
| std::shared_ptr< Context > impeller::Playground::GetContext | ( | ) | const |
Definition at line 199 of file playground.cc.
Referenced by impeller::DlPlayground::CreateDlImageForFixture(), CreateTextureCubeForFixture(), CreateTextureForFixture(), impeller::testing::DrawCompressedTextureGolden(), impeller::testing::DrawManuallyMippedTextureGolden(), GetContentContext(), impeller::interop::testing::PlaygroundTest::GetInteropContext(), impeller::testing::RendererDartTest::GetIsolate(), impeller::DlPlayground::MakeScreenshot(), impeller::testing::BlendFilterContentsTest::MakeTexture(), impeller::testing::GaussianBlurFilterContentsTest::MakeTexture(), impeller::testing::MatrixFilterContentsTest::MakeTexture(), impeller::testing::MorphologyFilterContentsTest::MakeTexture(), impeller::AiksPlayground::OpenPlaygroundHere(), OpenPlaygroundHere(), OpenPlaygroundHere(), impeller::DlPlayground::OpenPlaygroundHere(), impeller::RuntimeStagePlayground::RegisterStage(), and impeller::testing::RendererDartTest::RenderDartToPlayground().
| Point impeller::Playground::GetCursorPosition | ( | ) | const |
Definition at line 336 of file playground.cc.
|
protected |
Returns the default sample count of the rendering path.
Definition at line 175 of file playground.cc.
References impeller::kCount1, impeller::kCount4, and RenderingSupportsMSAA().
Referenced by InitializePipelineDescriptorForRendering().
|
protectedvirtual |
Reimplemented in impeller::PlaygroundTest.
Definition at line 121 of file playground.cc.
Referenced by OpenPlaygroundHere().
| RuntimeStageBackend impeller::Playground::GetRuntimeStageBackend | ( | ) | const |
Definition at line 789 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 352 of file playground.cc.
References fml::TimePoint::Now().
|
inlineprotected |
Return an unmodifiable reference to the current switches. The switches might change at the start of a test as it has a brief opportunity to call any of the Ensure* methods that define the environment it expects, but should be stable by the time any subsequent methods that might perform work are called.
Definition at line 183 of file playground.h.
Referenced by impeller::interop::testing::PlaygroundTest::CreateContext(), and impeller::PlaygroundTest::GetWindowTitle().
| std::shared_ptr< TypographerContext > impeller::Playground::GetTypographerContext | ( | ) | const |
Definition at line 228 of file playground.cc.
References impeller::TypographerContextSkia::Make().
Referenced by GetContentContext(), and impeller::DlPlayground::MakeScreenshot().
| IRect impeller::Playground::GetWindowBounds | ( | ) | const |
Definition at line 344 of file playground.cc.
References impeller::TRect< T >::MakeSize().
| ISize impeller::Playground::GetWindowSize | ( | ) | const |
Definition at line 340 of file playground.cc.
Referenced by impeller::testing::RendererDartTest::GetRenderedTextureFromDart(), impeller::DlPlayground::MakeScreenshot(), OpenPlaygroundHere(), and impeller::testing::RendererDartTest::RunDartFunctionWithWindowSize().
|
pure virtual |
Implemented in impeller::ComputePlaygroundTest, and impeller::PlaygroundTest.
Referenced by OpenPlaygroundHere().
| bool impeller::Playground::InitializePipelineDescriptorForRendering | ( | PipelineDescriptor & | desc | ) | const |
Initializes the provided |PipelineDescriptor| with appropriate default values to match the conditions under which a pipeline will be rendered.
Definition at line 179 of file playground.cc.
References impeller::PipelineDescriptor::ClearDepthAttachment(), impeller::PipelineDescriptor::ClearStencilAttachments(), GetDefaultSampleCount(), and impeller::PipelineDescriptor::SetSampleCount().
Referenced by impeller::testing::CreateDefaultPipeline(), impeller::testing::DrawCompressedTextureGolden(), and impeller::testing::DrawManuallyMippedTextureGolden().
| bool impeller::Playground::IsPlaygroundEnabled | ( | ) | const |
Definition at line 297 of file playground.cc.
References impeller::PlaygroundSwitches::enable_playground.
Referenced by impeller::testing::BlendModeTest(), impeller::EntityPlayground::OpenPlaygroundHere(), impeller::EntityPlayground::OpenPlaygroundHere(), and impeller::testing::RendererDartTest::RenderDartToPlayground().
|
static |
Definition at line 619 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 206 of file playground.cc.
References impeller::PlaygroundSwitches::can_share_context, and FML_CHECK.
|
static |
Definition at line 115 of file playground.cc.
|
pure virtual |
Implemented in impeller::ComputePlaygroundTest, and impeller::PlaygroundTest.
Referenced by CreateTextureCubeForFixture(), and CreateTextureForFixture().
| bool impeller::Playground::OpenPlaygroundHere | ( | const RenderCallback & | render_callback | ) |
Definition at line 445 of file playground.cc.
References context, impeller::HostBuffer::Create(), impeller::PlaygroundSwitches::enable_playground, FML_CHECK, impeller::RenderTarget::GetColorAttachment(), GetContext(), GetGoldenDigestManager(), GetWindowSize(), GetWindowTitle(), height, 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(), surface, VALIDATION_LOG, width, window, x, and y.
Referenced by impeller::testing::DrawCompressedTextureGolden(), impeller::testing::DrawManuallyMippedTextureGolden(), impeller::AiksPlayground::OpenPlaygroundHere(), OpenPlaygroundHere(), impeller::DlPlayground::OpenPlaygroundHere(), impeller::EntityPlayground::OpenPlaygroundHere(), impeller::EntityPlayground::OpenPlaygroundHere(), impeller::interop::testing::PlaygroundTest::OpenPlaygroundHere(), impeller::testing::RendererDartTest::RenderDartToPlayground(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), and impeller::testing::TEST_P().
| bool impeller::Playground::OpenPlaygroundHere | ( | const SinglePassCallback & | pass_callback | ) |
Definition at line 592 of file playground.cc.
References context, GetContext(), and OpenPlaygroundHere().
|
protected |
Returns true if the platform can support wide gamuts.
Definition at line 139 of file playground.cc.
References impeller::kMetal, impeller::kMetalSDF, impeller::kOpenGLES, impeller::kOpenGLESSDF, and impeller::kVulkan.
Referenced by EnsureContextSupportsWideGamut().
|
protected |
Returns true if the rendering path supports MSAA rendering.
Definition at line 155 of file playground.cc.
References impeller::kMetal, impeller::kMetalSDF, impeller::kOpenGLES, impeller::kOpenGLESSDF, and impeller::kVulkan.
Referenced by GetDefaultSampleCount().
| fml::Status impeller::Playground::SetCapabilities | ( | const std::shared_ptr< Capabilities > & | capabilities | ) |
Definition at line 770 of file playground.cc.
| void impeller::Playground::SetEnableWriteGolden | ( | bool | write_golden | ) |
Sets a particular test to either write a golden or not, false by default.
Definition at line 364 of file playground.cc.
Referenced by impeller::PlaygroundTest::SetUp().
| void impeller::Playground::SetGPUDisabled | ( | bool | disabled | ) | const |
Mark the GPU as unavilable.
Only supported on the Metal backend.
Definition at line 785 of file playground.cc.
References value.
|
protected |
Definition at line 235 of file playground.cc.
References FML_CHECK.
|
protected |
Definition at line 762 of file playground.cc.
Referenced by OpenPlaygroundHere().
|
protectedvirtual |
Definition at line 766 of file playground.cc.
Referenced by OpenPlaygroundHere().
|
static |
Definition at line 319 of file playground.cc.
References impeller::gShouldOpenNewPlaygrounds.
Referenced by impeller::ComputePlaygroundTest::SetUp(), and impeller::PlaygroundTest::SetUp().
| bool impeller::Playground::ShouldWriteGoldenImage | ( | ) |
Whether this instance will write a golden image of the output from |OpenPlaygroundHere|.
Definition at line 360 of file playground.cc.
|
static |
Definition at line 242 of file playground.cc.
References FML_UNREACHABLE, impeller::PlaygroundImplVK::IsVulkanDriverPresent(), impeller::kMetal, impeller::kMetalSDF, impeller::kOpenGLES, impeller::kOpenGLESSDF, and impeller::kVulkan.
Referenced by impeller::ComputePlaygroundTest::SetUp(), and impeller::PlaygroundTest::SetUp().
|
protected |
Definition at line 301 of file playground.cc.
References FML_CHECK.
Referenced by impeller::ComputePlaygroundTest::TearDown(), and impeller::PlaygroundTest::TearDown().