Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
impeller::Playground Class Referenceabstract

#include <playground.h>

Inheritance diagram for impeller::Playground:
impeller::ComputePlaygroundTest impeller::PlaygroundTest impeller::AiksPlayground impeller::DlPlayground impeller::EntityPlayground impeller::RuntimeStagePlayground impeller::interop::testing::PlaygroundTest impeller::testing::RendererDartTest impeller::testing::BlendFilterContentsTest impeller::testing::GaussianBlurFilterContentsTest impeller::testing::MatrixFilterContentsTest impeller::testing::MorphologyFilterContentsTest

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
 
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< ContextGetContext () const
 
std::shared_ptr< ContextMakeContext () const
 
bool OpenPlaygroundHere (const 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
 
virtual std::unique_ptr< fml::MappingOpenAssetAsMapping (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.
 
GLProcAddressResolver CreateGLProcAddressResolver () const
 
VKProcAddressResolver CreateVKProcAddressResolver () const
 
void SetGPUDisabled (bool disabled) const
 Mark the GPU as unavilable.
 
RuntimeStageBackend GetRuntimeStageBackend () const
 

Static Public Member Functions

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

virtual bool ShouldKeepRendering () const
 
void SetWindowSize (ISize size)
 

Protected Attributes

const PlaygroundSwitches switches_
 

Detailed Description

Definition at line 36 of file playground.h.

Member Typedef Documentation

◆ GLProcAddressResolver

using impeller::Playground::GLProcAddressResolver = std::function<void*(const char* proc_name)>

Definition at line 108 of file playground.h.

◆ RenderCallback

using impeller::Playground::RenderCallback = std::function<bool(RenderTarget& render_target)>

Definition at line 71 of file playground.h.

◆ SinglePassCallback

using impeller::Playground::SinglePassCallback = std::function<bool(RenderPass& pass)>

Definition at line 38 of file playground.h.

◆ VKProcAddressResolver

using impeller::Playground::VKProcAddressResolver = std::function<void*(void* instance, const char* proc_name)>

Definition at line 111 of file playground.h.

Constructor & Destructor Documentation

◆ Playground()

impeller::Playground::Playground ( PlaygroundSwitches  switches)
explicit

Definition at line 89 of file playground.cc.

89 : switches_(switches) {
92}
const PlaygroundSwitches switches_
Definition playground.h:123
void SetupSwiftshaderOnce(bool use_swiftshader)
Find and setup the installable client driver for a locally built SwiftShader at known paths....
static void InitializeGLFWOnce()
Definition playground.cc:63

References impeller::InitializeGLFWOnce(), flutter::testing::SetupSwiftshaderOnce(), switches_, and impeller::PlaygroundSwitches::use_swiftshader.

◆ ~Playground()

impeller::Playground::~Playground ( )
virtualdefault

Member Function Documentation

◆ CreateGLProcAddressResolver()

Playground::GLProcAddressResolver impeller::Playground::CreateGLProcAddressResolver ( ) const

Definition at line 531 of file playground.cc.

532 {
533 return impl_->CreateGLProcAddressResolver();
534}

Referenced by impeller::interop::testing::PlaygroundTest::CreateContext().

◆ CreateTextureCubeForFixture()

std::shared_ptr< Texture > impeller::Playground::CreateTextureCubeForFixture ( std::array< const char *, 6 >  fixture_names) const

Definition at line 469 of file playground.cc.

470 {
471 std::array<DecompressedImage, 6> images;
472 for (size_t i = 0; i < fixture_names.size(); i++) {
473 auto image = DecodeImageRGBA(
475 if (!image.has_value()) {
476 return nullptr;
477 }
478 images[i] = image.value();
479 }
480
481 TextureDescriptor texture_descriptor;
482 texture_descriptor.storage_mode = StorageMode::kDevicePrivate;
483 texture_descriptor.type = TextureType::kTextureCube;
484 texture_descriptor.format = PixelFormat::kR8G8B8A8UNormInt;
485 texture_descriptor.size = images[0].GetSize();
486 texture_descriptor.mip_count = 1u;
487
488 auto texture =
489 context_->GetResourceAllocator()->CreateTexture(texture_descriptor);
490 if (!texture) {
491 VALIDATION_LOG << "Could not allocate texture cube.";
492 return nullptr;
493 }
494 texture->SetLabel("Texture cube");
495
496 auto cmd_buffer = context_->CreateCommandBuffer();
497 auto blit_pass = cmd_buffer->CreateBlitPass();
498 for (size_t i = 0; i < fixture_names.size(); i++) {
499 auto device_buffer = context_->GetResourceAllocator()->CreateBufferWithCopy(
500 *images[i].GetAllocation());
501 blit_pass->AddCopy(DeviceBuffer::AsBufferView(device_buffer), texture, {},
502 "", /*mip_level=*/0, /*slice=*/i);
503 }
504
505 if (!blit_pass->EncodeCommands() ||
506 !context_->GetCommandQueue()->Submit({std::move(cmd_buffer)}).ok()) {
507 VALIDATION_LOG << "Could not upload texture to device memory.";
508 return nullptr;
509 }
510
511 return texture;
512}
static BufferView AsBufferView(std::shared_ptr< DeviceBuffer > buffer)
Create a buffer view of this entire buffer.
static std::shared_ptr< CompressedImage > LoadFixtureImageCompressed(std::shared_ptr< fml::Mapping > mapping)
virtual std::unique_ptr< fml::Mapping > OpenAssetAsMapping(std::string asset_name) const =0
static std::optional< DecompressedImage > DecodeImageRGBA(const std::shared_ptr< CompressedImage > &compressed)
FlutterVulkanImage * image
FlTexture * texture
std::array< MockImage, 3 > images
uint32_t format
The VkFormat of the image (for example: VK_FORMAT_R8G8B8A8_UNORM).
Definition embedder.h:940
#define VALIDATION_LOG
Definition validation.h:91

References impeller::DeviceBuffer::AsBufferView(), DecodeImageRGBA(), impeller::TextureDescriptor::format, 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.

◆ CreateTextureForFixture()

std::shared_ptr< Texture > impeller::Playground::CreateTextureForFixture ( const char *  fixture_name,
bool  enable_mipmapping = false 
) const

Definition at line 457 of file playground.cc.

459 {
461 context_, OpenAssetAsMapping(fixture_name), enable_mipmapping);
462 if (texture == nullptr) {
463 return nullptr;
464 }
465 texture->SetLabel(fixture_name);
466 return texture;
467}
static std::shared_ptr< Texture > CreateTextureForMapping(const std::shared_ptr< Context > &context, std::shared_ptr< fml::Mapping > mapping, bool enable_mipmapping=false)

References CreateTextureForMapping(), OpenAssetAsMapping(), and texture.

◆ CreateTextureForMapping()

std::shared_ptr< Texture > impeller::Playground::CreateTextureForMapping ( const std::shared_ptr< Context > &  context,
std::shared_ptr< fml::Mapping mapping,
bool  enable_mipmapping = false 
)
static

Definition at line 444 of file playground.cc.

447 {
449 Playground::LoadFixtureImageCompressed(std::move(mapping)));
450 if (!image.has_value()) {
451 return nullptr;
452 }
454 enable_mipmapping);
455}
static std::shared_ptr< Texture > CreateTextureForDecompressedImage(const std::shared_ptr< Context > &context, DecompressedImage &decompressed_image, bool enable_mipmapping)
std::shared_ptr< ContextGLES > context

References context, impeller::CreateTextureForDecompressedImage(), DecodeImageRGBA(), image, and LoadFixtureImageCompressed().

Referenced by impeller::DlPlayground::CreateDlImageForFixture(), impeller::GoldenPlaygroundTest::CreateTextureForFixture(), and CreateTextureForFixture().

◆ CreateVKProcAddressResolver()

Playground::VKProcAddressResolver impeller::Playground::CreateVKProcAddressResolver ( ) const

Definition at line 536 of file playground.cc.

537 {
538 return impl_->CreateVKProcAddressResolver();
539}

Referenced by impeller::interop::testing::PlaygroundTest::CreateContext().

◆ DecodeImageRGBA()

std::optional< DecompressedImage > impeller::Playground::DecodeImageRGBA ( const std::shared_ptr< CompressedImage > &  compressed)
static

Definition at line 383 of file playground.cc.

384 {
385 if (compressed == nullptr) {
386 return std::nullopt;
387 }
388 // The decoded image is immediately converted into RGBA as that format is
389 // known to be supported everywhere. For image sources that don't need 32
390 // bit pixel strides, this is overkill. Since this is a test fixture we
391 // aren't necessarily trying to eke out memory savings here and instead
392 // favor simplicity.
393 auto image = compressed->Decode().ConvertToRGBA();
394 if (!image.IsValid()) {
395 VALIDATION_LOG << "Could not decode image.";
396 return std::nullopt;
397 }
398
399 return image;
400}

References image, and VALIDATION_LOG.

Referenced by CreateTextureCubeForFixture(), CreateTextureForMapping(), and impeller::interop::testing::PlaygroundTest::OpenAssetAsHPPTexture().

◆ GetContentScale()

Point impeller::Playground::GetContentScale ( ) const

◆ GetContext()

◆ GetCursorPosition()

Point impeller::Playground::GetCursorPosition ( ) const

Definition at line 188 of file playground.cc.

188 {
189 return cursor_position_;
190}

◆ GetRuntimeStageBackend()

RuntimeStageBackend impeller::Playground::GetRuntimeStageBackend ( ) const

Definition at line 545 of file playground.cc.

545 {
546 return impl_->GetRuntimeStageBackend();
547}

◆ GetSecondsElapsed()

Scalar impeller::Playground::GetSecondsElapsed ( ) const

Get the amount of time elapsed from the start of the playground's execution.

Definition at line 204 of file playground.cc.

204 {
205 return (fml::TimePoint::Now().ToEpochDelta() - start_time_).ToSecondsF();
206}
static TimePoint Now()
Definition time_point.cc:49

References fml::TimePoint::Now().

◆ GetWindowBounds()

IRect impeller::Playground::GetWindowBounds ( ) const

Definition at line 196 of file playground.cc.

196 {
197 return IRect::MakeSize(window_size_);
198}
static constexpr TRect MakeSize(const TSize< U > &size)
Definition rect.h:150

References impeller::TRect< T >::MakeSize().

◆ GetWindowSize()

ISize impeller::Playground::GetWindowSize ( ) const

◆ GetWindowTitle()

virtual std::string impeller::Playground::GetWindowTitle ( ) const
pure virtual

◆ IsPlaygroundEnabled()

bool impeller::Playground::IsPlaygroundEnabled ( ) const

◆ LoadFixtureImageCompressed()

std::shared_ptr< CompressedImage > impeller::Playground::LoadFixtureImageCompressed ( std::shared_ptr< fml::Mapping mapping)
static

Definition at line 372 of file playground.cc.

373 {
374 auto compressed_image = CompressedImageSkia::Create(std::move(mapping));
375 if (!compressed_image) {
376 VALIDATION_LOG << "Could not create compressed image.";
377 return nullptr;
378 }
379
380 return compressed_image;
381}
static std::shared_ptr< CompressedImage > Create(std::shared_ptr< const fml::Mapping > allocation)

References impeller::CompressedImageSkia::Create(), and VALIDATION_LOG.

Referenced by CreateTextureCubeForFixture(), CreateTextureForMapping(), and impeller::interop::testing::PlaygroundTest::OpenAssetAsHPPTexture().

◆ MakeContext()

std::shared_ptr< Context > impeller::Playground::MakeContext ( ) const

Definition at line 100 of file playground.cc.

100 {
101 // Playgrounds are already making a context for each test, so we can just
102 // return the `context_`.
103 return context_;
104}

◆ OpenAssetAsMapping()

virtual std::unique_ptr< fml::Mapping > impeller::Playground::OpenAssetAsMapping ( std::string  asset_name) const
pure virtual

◆ OpenPlaygroundHere() [1/2]

bool impeller::Playground::OpenPlaygroundHere ( const RenderCallback render_callback)

Definition at line 212 of file playground.cc.

213 {
215 return true;
216 }
217
218 if (!render_callback) {
219 return true;
220 }
221
222 IMGUI_CHECKVERSION();
223 ImGui::CreateContext();
224 fml::ScopedCleanupClosure destroy_imgui_context(
225 []() { ImGui::DestroyContext(); });
226 ImGui::StyleColorsDark();
227
228 auto& io = ImGui::GetIO();
229 io.IniFilename = nullptr;
230 io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
231 io.ConfigWindowsResizeFromEdges = true;
232
233 auto window = reinterpret_cast<GLFWwindow*>(impl_->GetWindowHandle());
234 if (!window) {
235 return false;
236 }
237 ::glfwSetWindowTitle(window, GetWindowTitle().c_str());
238 ::glfwSetWindowUserPointer(window, this);
239 ::glfwSetWindowSizeCallback(
240 window, [](GLFWwindow* window, int width, int height) -> void {
241 auto playground =
242 reinterpret_cast<Playground*>(::glfwGetWindowUserPointer(window));
243 if (!playground) {
244 return;
245 }
246 playground->SetWindowSize(ISize{width, height}.Max({}));
247 });
248 ::glfwSetKeyCallback(window, &PlaygroundKeyCallback);
249 ::glfwSetCursorPosCallback(window, [](GLFWwindow* window, double x,
250 double y) {
251 reinterpret_cast<Playground*>(::glfwGetWindowUserPointer(window))
252 ->SetCursorPosition({static_cast<Scalar>(x), static_cast<Scalar>(y)});
253 });
254
255 ImGui_ImplGlfw_InitForOther(window, true);
256 fml::ScopedCleanupClosure shutdown_imgui([]() { ImGui_ImplGlfw_Shutdown(); });
257
258 ImGui_ImplImpeller_Init(context_);
259 fml::ScopedCleanupClosure shutdown_imgui_impeller(
260 []() { ImGui_ImplImpeller_Shutdown(); });
261
262 ImGui::SetNextWindowPos({10, 10});
263
264 ::glfwSetWindowSize(window, GetWindowSize().width, GetWindowSize().height);
265 ::glfwSetWindowPos(window, 200, 100);
266 ::glfwShowWindow(window);
267
268 while (true) {
269#if FML_OS_MACOSX
271#endif
272 ::glfwPollEvents();
273
274 if (::glfwWindowShouldClose(window)) {
275 return true;
276 }
277
278 ImGui_ImplGlfw_NewFrame();
279
280 auto surface = impl_->AcquireSurfaceFrame(context_);
281 RenderTarget render_target = surface->GetRenderTarget();
282
283 ImGui::NewFrame();
284 ImGui::DockSpaceOverViewport(0, ImGui::GetMainViewport(),
285 ImGuiDockNodeFlags_PassthruCentralNode);
286 bool result = render_callback(render_target);
287 ImGui::Render();
288
289 // Render ImGui overlay.
290 {
291 auto buffer = context_->CreateCommandBuffer();
292 if (!buffer) {
293 VALIDATION_LOG << "Could not create command buffer.";
294 return false;
295 }
296 buffer->SetLabel("ImGui Command Buffer");
297
298 auto color0 = render_target.GetColorAttachment(0);
299 color0.load_action = LoadAction::kLoad;
300 if (color0.resolve_texture) {
301 color0.texture = color0.resolve_texture;
302 color0.resolve_texture = nullptr;
303 color0.store_action = StoreAction::kStore;
304 }
305 render_target.SetColorAttachment(color0, 0);
306 render_target.SetStencilAttachment(std::nullopt);
307 render_target.SetDepthAttachment(std::nullopt);
308
309 auto pass = buffer->CreateRenderPass(render_target);
310 if (!pass) {
311 VALIDATION_LOG << "Could not create render pass.";
312 return false;
313 }
314 pass->SetLabel("ImGui Render Pass");
315 if (!host_buffer_) {
316 host_buffer_ = HostBuffer::Create(
317 context_->GetResourceAllocator(), context_->GetIdleWaiter(),
318 context_->GetCapabilities()->GetMinimumUniformAlignment());
319 }
320
321 ImGui_ImplImpeller_RenderDrawData(ImGui::GetDrawData(), *pass,
322 *host_buffer_);
323
324 pass->EncodeCommands();
325
326 if (!context_->GetCommandQueue()->Submit({buffer}).ok()) {
327 return false;
328 }
329 }
330
331 if (!result || !surface->Present()) {
332 return false;
333 }
334
335 if (!ShouldKeepRendering()) {
336 break;
337 }
338 }
339
340 ::glfwHideWindow(window);
341
342 return true;
343}
Wraps a closure that is invoked in the destructor unless released by the caller.
Definition closure.h:32
static std::shared_ptr< HostBuffer > Create(const std::shared_ptr< Allocator > &allocator, const std::shared_ptr< const IdleWaiter > &idle_waiter, size_t minimum_uniform_alignment)
Playground(PlaygroundSwitches switches)
Definition playground.cc:89
virtual bool ShouldKeepRendering() const
ISize GetWindowSize() const
virtual std::string GetWindowTitle() const =0
int32_t x
GLFWwindow * window
Definition main.cc:60
VkSurfaceKHR surface
Definition main.cc:65
void ImGui_ImplImpeller_RenderDrawData(ImDrawData *draw_data, impeller::RenderPass &render_pass, impeller::HostBuffer &host_buffer)
bool ImGui_ImplImpeller_Init(const std::shared_ptr< impeller::Context > &context)
void ImGui_ImplImpeller_Shutdown()
double y
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set profile Make the profiler discard new samples once the profiler sample buffer is full When this flag is not the profiler sample buffer is used as a ring buffer
Definition switch_defs.h:98
float Scalar
Definition scalar.h:19
static void PlaygroundKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
ISize64 ISize
Definition size.h:162
int32_t height
int32_t width
constexpr TSize Max(const TSize &o) const
Definition size.h:97

References impeller::HostBuffer::Create(), impeller::PlaygroundSwitches::enable_playground, impeller::RenderTarget::GetColorAttachment(), 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, switches_, VALIDATION_LOG, width, window, x, and y.

Referenced by impeller::AiksPlayground::OpenPlaygroundHere(), impeller::DlPlayground::OpenPlaygroundHere(), impeller::EntityPlayground::OpenPlaygroundHere(), impeller::EntityPlayground::OpenPlaygroundHere(), impeller::interop::testing::PlaygroundTest::OpenPlaygroundHere(), OpenPlaygroundHere(), impeller::testing::RendererDartTest::RenderDartToPlayground(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), and impeller::testing::TEST_P().

◆ OpenPlaygroundHere() [2/2]

bool impeller::Playground::OpenPlaygroundHere ( SinglePassCallback  pass_callback)

Definition at line 345 of file playground.cc.

345 {
346 return OpenPlaygroundHere(
347 [context = GetContext(), &pass_callback](RenderTarget& render_target) {
348 auto buffer = context->CreateCommandBuffer();
349 if (!buffer) {
350 return false;
351 }
352 buffer->SetLabel("Playground Command Buffer");
353
354 auto pass = buffer->CreateRenderPass(render_target);
355 if (!pass) {
356 return false;
357 }
358 pass->SetLabel("Playground Render Pass");
359
360 if (!pass_callback(*pass)) {
361 return false;
362 }
363
364 pass->EncodeCommands();
365 if (!context->GetCommandQueue()->Submit({buffer}).ok()) {
366 return false;
367 }
368 return true;
369 });
370}
bool OpenPlaygroundHere(const RenderCallback &render_callback)
std::shared_ptr< Context > GetContext() const
Definition playground.cc:96

References context, GetContext(), and OpenPlaygroundHere().

◆ SetCapabilities()

fml::Status impeller::Playground::SetCapabilities ( const std::shared_ptr< Capabilities > &  capabilities)

Definition at line 522 of file playground.cc.

523 {
524 return impl_->SetCapabilities(capabilities);
525}

◆ SetGPUDisabled()

void impeller::Playground::SetGPUDisabled ( bool  disabled) const

Mark the GPU as unavilable.

Only supported on the Metal backend.

Definition at line 541 of file playground.cc.

541 {
542 impl_->SetGPUDisabled(value);
543}

References value.

◆ SetupContext()

void impeller::Playground::SetupContext ( PlaygroundBackend  backend,
const PlaygroundSwitches switches 
)

Definition at line 132 of file playground.cc.

133 {
134 FML_CHECK(SupportsBackend(backend));
135
136 impl_ = PlaygroundImpl::Create(backend, switches);
137 if (!impl_) {
138 FML_LOG(WARNING) << "PlaygroundImpl::Create failed.";
139 return;
140 }
141
142 context_ = impl_->GetContext();
143}
static bool SupportsBackend(PlaygroundBackend backend)
static std::unique_ptr< PlaygroundImpl > Create(PlaygroundBackend backend, PlaygroundSwitches switches)
#define FML_LOG(severity)
Definition logging.h:101
#define FML_CHECK(condition)
Definition logging.h:104

References impeller::PlaygroundImpl::Create(), FML_CHECK, FML_LOG, and SupportsBackend().

Referenced by impeller::ComputePlaygroundTest::SetUp(), and impeller::PlaygroundTest::SetUp().

◆ SetupWindow()

void impeller::Playground::SetupWindow ( )

Definition at line 145 of file playground.cc.

145 {
146 if (!context_) {
147 FML_LOG(WARNING) << "Asked to set up a window with no context (call "
148 "SetupContext first).";
149 return;
150 }
151 start_time_ = fml::TimePoint::Now().ToEpochDelta();
152}
constexpr TimeDelta ToEpochDelta() const
Definition time_point.h:52

References FML_LOG, fml::TimePoint::Now(), and fml::TimePoint::ToEpochDelta().

Referenced by impeller::ComputePlaygroundTest::SetUp(), and impeller::PlaygroundTest::SetUp().

◆ SetWindowSize()

void impeller::Playground::SetWindowSize ( ISize  size)
protected

Definition at line 514 of file playground.cc.

514 {
515 window_size_ = size;
516}
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size

Referenced by OpenPlaygroundHere().

◆ ShouldKeepRendering()

bool impeller::Playground::ShouldKeepRendering ( ) const
protectedvirtual

Definition at line 518 of file playground.cc.

518 {
519 return true;
520}

Referenced by OpenPlaygroundHere().

◆ ShouldOpenNewPlaygrounds()

bool impeller::Playground::ShouldOpenNewPlaygrounds ( )
static

Definition at line 171 of file playground.cc.

171 {
173}
static std::atomic_bool gShouldOpenNewPlaygrounds

References impeller::gShouldOpenNewPlaygrounds.

Referenced by impeller::ComputePlaygroundTest::SetUp(), and impeller::PlaygroundTest::SetUp().

◆ SupportsBackend()

bool impeller::Playground::SupportsBackend ( PlaygroundBackend  backend)
static

Definition at line 106 of file playground.cc.

106 {
107 switch (backend) {
110#if IMPELLER_ENABLE_METAL
111 return true;
112#else // IMPELLER_ENABLE_METAL
113 return false;
114#endif // IMPELLER_ENABLE_METAL
117#if IMPELLER_ENABLE_OPENGLES
118 return true;
119#else // IMPELLER_ENABLE_OPENGLES
120 return false;
121#endif // IMPELLER_ENABLE_OPENGLES
123#if IMPELLER_ENABLE_VULKAN
125#else // IMPELLER_ENABLE_VULKAN
126 return false;
127#endif // IMPELLER_ENABLE_VULKAN
128 }
130}
#define FML_UNREACHABLE()
Definition logging.h:128

References FML_UNREACHABLE, impeller::PlaygroundImplVK::IsVulkanDriverPresent(), impeller::kMetal, impeller::kMetalSDF, impeller::kOpenGLES, impeller::kOpenGLESSDF, and impeller::kVulkan.

Referenced by impeller::ComputePlaygroundTest::SetUp(), impeller::PlaygroundTest::SetUp(), and SetupContext().

◆ TeardownWindow()

void impeller::Playground::TeardownWindow ( )

Definition at line 158 of file playground.cc.

158 {
159 if (host_buffer_) {
160 host_buffer_.reset();
161 }
162 if (context_) {
163 context_->Shutdown();
164 }
165 context_.reset();
166 impl_.reset();
167}

Referenced by impeller::ComputePlaygroundTest::TearDown(), and impeller::PlaygroundTest::TearDown().

◆ WillRenderSomething()

bool impeller::Playground::WillRenderSomething ( ) const

Returns true if OpenPlaygroundHere will actually render anything.

Definition at line 527 of file playground.cc.

527 {
529}

References impeller::PlaygroundSwitches::enable_playground, and switches_.

Member Data Documentation

◆ switches_


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