5#ifndef FLUTTER_IMPELLER_PLAYGROUND_PLAYGROUND_H_
6#define FLUTTER_IMPELLER_PLAYGROUND_PLAYGROUND_H_
29class GoldenDigestManager;
92 std::shared_ptr<fml::Mapping> mapping);
95 const std::shared_ptr<CompressedImage>& compressed);
98 const std::shared_ptr<Context>&
context,
99 std::shared_ptr<fml::Mapping> mapping,
100 bool enable_mipmapping =
false);
103 const char* fixture_name,
104 bool enable_mipmapping =
false)
const;
107 std::array<const char*, 6> fixture_names)
const;
112 std::string asset_name)
const = 0;
117 const std::shared_ptr<Capabilities>& capabilities);
123 std::function<
void*(
void*
instance,
const char* proc_name)>;
186 std::shared_ptr<TypographerContext> typographer_context);
193 static void InitializeGLFWOnce();
194 static std::atomic<bool> glfw_initialized_;
210 mutable std::unique_ptr<PlaygroundImpl> impl_;
211 mutable std::shared_ptr<Context> context_;
212 mutable std::unique_ptr<ContentContext> content_context_;
213 mutable std::shared_ptr<TypographerContext> typographer_context_;
215 Point cursor_position_;
217 std::shared_ptr<HostBuffer> host_buffer_;
218 bool should_write_golden_ =
false;
220 std::unique_ptr<PlaygroundImpl>& GetImpl()
const;
222 void SetupContext()
const;
226 void SetCursorPosition(
Point pos);
229 bool RenderImage(
const RenderCallback& render_callback,
bool write_image);
232 bool WriteGoldenImage(
const RenderTarget& render_target,
233 const std::string& postfix =
"");
235 Playground(
const Playground&) =
delete;
237 Playground& operator=(
const Playground&) =
delete;
bool OpenPlaygroundHere(const RenderCallback &render_callback)
std::shared_ptr< Context > MakeContext() const
bool IsPlaygroundEnabled() const
static void OnTearDownTestEnvironment()
virtual bool EnsureContextSupportsWideGamut()
Make sure that when the context is later created that it will support wide gamuts if the platform sup...
virtual bool ShouldKeepRendering() const
bool ShouldWriteGoldenImage()
Whether this instance will write a golden image of the output from |OpenPlaygroundHere|.
static bool ShouldOpenNewPlaygrounds()
bool PlatformSupportsWideGamutTests() const
Returns true if the platform can support wide gamuts.
Point GetCursorPosition() const
void SetWindowSize(ISize size)
static std::shared_ptr< CompressedImage > LoadFixtureImageCompressed(std::shared_ptr< fml::Mapping > mapping)
ISize GetWindowSize() const
bool RenderingSupportsMSAA() const
Returns true if the rendering path supports MSAA rendering.
std::function< bool(RenderPass &pass)> SinglePassCallback
GLProcAddressResolver CreateGLProcAddressResolver() const
RuntimeStageBackend GetRuntimeStageBackend() const
void TearDownContextData()
virtual std::string GetWindowTitle() const =0
ContentContext & GetContentContext() const
std::function< bool(RenderTarget &render_target)> RenderCallback
void SetGPUDisabled(bool disabled) const
Mark the GPU as unavilable.
std::shared_ptr< TypographerContext > GetTypographerContext() const
virtual testing::GoldenDigestManager * GetGoldenDigestManager() const
bool InitializePipelineDescriptorForRendering(PipelineDescriptor &desc) const
Initializes the provided |PipelineDescriptor| with appropriate default values to match the conditions...
std::shared_ptr< Context > GetContext() const
static bool SupportsBackend(PlaygroundBackend backend)
SampleCount GetDefaultSampleCount() const
Returns the default sample count of the rendering path.
static std::shared_ptr< Texture > CreateTextureForMapping(const std::shared_ptr< Context > &context, std::shared_ptr< fml::Mapping > mapping, bool enable_mipmapping=false)
virtual void EnsureContextIsUnique()
Make sure that when the context is later created that it will not be shared with any other playground...
IRect GetWindowBounds() const
const PlaygroundSwitches & GetSwitches() const
Return an unmodifiable reference to the current switches. The switches might change at the start of a...
virtual std::unique_ptr< fml::Mapping > OpenAssetAsMapping(std::string asset_name) const =0
Point GetContentScale() const
void SetEnableWriteGolden(bool write_golden)
Sets a particular test to either write a golden or not, false by default.
std::shared_ptr< Texture > CreateTextureForFixture(const char *fixture_name, bool enable_mipmapping=false) const
Scalar GetSecondsElapsed() const
Get the amount of time elapsed from the start of the playground's execution.
std::function< void *(void *instance, const char *proc_name)> VKProcAddressResolver
std::function< void *(const char *proc_name)> GLProcAddressResolver
void SetTypographerContext(std::shared_ptr< TypographerContext > typographer_context)
static std::optional< DecompressedImage > DecodeImageRGBA(const std::shared_ptr< CompressedImage > &compressed)
std::shared_ptr< Texture > CreateTextureCubeForFixture(std::array< const char *, 6 > fixture_names) const
fml::Status SetCapabilities(const std::shared_ptr< Capabilities > &capabilities)
VKProcAddressResolver CreateVKProcAddressResolver() const
Render passes encode render commands directed as one specific render target into an underlying comman...
std::string PlaygroundBackendToString(PlaygroundBackend backend)
std::shared_ptr< ContextGLES > context