| Flutter Impeller |

playground.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <array>
6 #include <memory>
7 #include <optional>
8 #include <sstream>
9
10 #include "fml/closure.h"
11 #include "fml/time/time_point.h"
12 #include "impeller/core/host_buffer.h"
13 #include "impeller/playground/image/backends/skia/compressed_image_skia.h"
14 #include "impeller/playground/image/decompressed_image.h"
15 #include "impeller/renderer/command_buffer.h"
16 #include "impeller/renderer/render_target.h"
17 #include "impeller/runtime_stage/runtime_stage.h"
18
19 #define GLFW_INCLUDE_NONE
20 #include "third_party/glfw/include/GLFW/glfw3.h"
21
22 #include "flutter/fml/paths.h"
23 #include "impeller/base/validation.h"
24 #include "impeller/core/allocator.h"
25 #include "impeller/core/formats.h"
26 #include "impeller/playground/backend/vulkan/swiftshader_utilities.h"
27 #include "impeller/playground/image/compressed_image.h"
28 #include "impeller/playground/imgui/imgui_impl_impeller.h"
29 #include "impeller/playground/playground.h"
30 #include "impeller/playground/playground_impl.h"
31 #include "impeller/renderer/context.h"
32 #include "impeller/renderer/render_pass.h"
33 #include "third_party/imgui/backends/imgui_impl_glfw.h"
34 #include "third_party/imgui/imgui.h"
35
36 #if FML_OS_MACOSX
37 #include "fml/platform/darwin/scoped_nsautorelease_pool.h"
38 #endif // FML_OS_MACOSX
39
40 #if IMPELLER_ENABLE_VULKAN
41 #include "impeller/playground/backend/vulkan/playground_impl_vk.h"
42 #endif // IMPELLER_ENABLE_VULKAN
43
44 namespace impeller {
45
46 std::string PlaygroundBackendToString(PlaygroundBackend backend) {
47 switch (backend) {
48 case PlaygroundBackend::kMetal:
49 return "Metal";
50 case PlaygroundBackend::kOpenGLES:
51 return "OpenGLES";
52 case PlaygroundBackend::kVulkan:
53 return "Vulkan";
54 }
55 FML_UNREACHABLE();
56 }
57
58 static void InitializeGLFWOnce() {
59 // This guard is a hack to work around a problem where glfwCreateWindow
60 // hangs when opening a second window after GLFW has been reinitialized (for
61 // example, when flipping through multiple playground tests).
62 //
63 // Explanation:
64 // * glfwCreateWindow calls [NSApp run], which begins running the event
65 // loop on the current thread.
66 // * GLFW then immediately stops the loop when
67 // applicationDidFinishLaunching is fired.
68 // * applicationDidFinishLaunching is only ever fired once during the
69 // application's lifetime, so subsequent calls to [NSApp run] will always
70 // hang with this setup.
71 // * glfwInit resets the flag that guards against [NSApp run] being
72 // called a second time, which causes the subsequent `glfwCreateWindow`
73 // to hang indefinitely in the event loop, because
74 // applicationDidFinishLaunching is never fired.
75 static std::once_flag sOnceInitializer;
76 std::call_once(sOnceInitializer, []() {
77 ::glfwSetErrorCallback([](int code, const char* description) {
78 FML_LOG(ERROR) << "GLFW Error '" << description << "' (" << code << ").";
79 });
80 FML_CHECK(::glfwInit() == GLFW_TRUE);
81 });
82 }
83
84 Playground::Playground(PlaygroundSwitches switches) : switches_(switches) {
85 InitializeGLFWOnce();
86 SetupSwiftshaderOnce(switches_.use_swiftshader);
87 }
88
89 Playground::~Playground() = default;
90
91 std::shared_ptr<Context> Playground::GetContext() const {
92 return context_;
93 }
94
95 std::shared_ptr<Context> Playground::MakeContext() const {
96 // Playgrounds are already making a context for each test, so we can just
97 // return the `context_`.
98 return context_;
99 }
100
101 bool Playground::SupportsBackend(PlaygroundBackend backend) {
102 switch (backend) {
103 case PlaygroundBackend::kMetal:
104 #if IMPELLER_ENABLE_METAL
105 return true;
106 #else // IMPELLER_ENABLE_METAL
107 return false;
108 #endif // IMPELLER_ENABLE_METAL
109 case PlaygroundBackend::kOpenGLES:
110 #if IMPELLER_ENABLE_OPENGLES
111 return true;
112 #else // IMPELLER_ENABLE_OPENGLES
113 return false;
114 #endif // IMPELLER_ENABLE_OPENGLES
115 case PlaygroundBackend::kVulkan:
116 #if IMPELLER_ENABLE_VULKAN
117 return PlaygroundImplVK::IsVulkanDriverPresent();
118 #else // IMPELLER_ENABLE_VULKAN
119 return false;
120 #endif // IMPELLER_ENABLE_VULKAN
121 }
122 FML_UNREACHABLE();
123 }
124
125 void Playground::SetupContext(PlaygroundBackend backend,
126 const PlaygroundSwitches& switches) {
127 FML_CHECK(SupportsBackend(backend));
128
129 impl_ = PlaygroundImpl::Create(backend, switches);
130 if (!impl_) {
131 FML_LOG(WARNING) << "PlaygroundImpl::Create failed.";
132 return;
133 }
134
135 context_ = impl_->GetContext();
136 }
137
138 void Playground::SetupWindow() {
139 if (!context_) {
140 FML_LOG(WARNING) << "Asked to set up a window with no context (call "
141 "SetupContext first).";
142 return;
143 }
144 start_time_ = fml::TimePoint::Now().ToEpochDelta();
145 }
146
147 bool Playground::IsPlaygroundEnabled() const {
148 return switches_.enable_playground;
149 }
150
151 void Playground::TeardownWindow() {
152 if (host_buffer_) {
153 host_buffer_.reset();
154 }
155 if (context_) {
156 context_->Shutdown();
157 }
158 context_.reset();
159 impl_.reset();
160 }
161
162 static std::atomic_bool gShouldOpenNewPlaygrounds = true;
163
164 bool Playground::ShouldOpenNewPlaygrounds() {
165 return gShouldOpenNewPlaygrounds;
166 }
167
168 static void PlaygroundKeyCallback(GLFWwindow* window,
169 int key,
170 int scancode,
171 int action,
172 int mods) {
173 if ((key == GLFW_KEY_ESCAPE) && action == GLFW_RELEASE) {
174 if (mods & (GLFW_MOD_CONTROL | GLFW_MOD_SUPER | GLFW_MOD_SHIFT)) {
175 gShouldOpenNewPlaygrounds = false;
176 }
177 ::glfwSetWindowShouldClose(window, GLFW_TRUE);
178 }
179 }
180
181 Point Playground::GetCursorPosition() const {
182 return cursor_position_;
183 }
184
185 ISize Playground::GetWindowSize() const {
186 return window_size_;
187 }
188
189 Point Playground::GetContentScale() const {
190 return impl_->GetContentScale();
191 }
192
193 Scalar Playground::GetSecondsElapsed() const {
194 return (fml::TimePoint::Now().ToEpochDelta() - start_time_).ToSecondsF();
195 }
196
197 void Playground::SetCursorPosition(Point pos) {
198 cursor_position_ = pos;
199 }
200
201 bool Playground::OpenPlaygroundHere(
202 const Playground::RenderCallback& render_callback) {
203 if (!switches_.enable_playground) {
204 return true;
205 }
206
207 if (!render_callback) {
208 return true;
209 }
210
211 IMGUI_CHECKVERSION();
212 ImGui::CreateContext();
213 fml::ScopedCleanupClosure destroy_imgui_context(
214 []() { ImGui::DestroyContext(); });
215 ImGui::StyleColorsDark();
216
217 auto& io = ImGui::GetIO();
218 io.IniFilename = nullptr;
219 io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
220 io.ConfigWindowsResizeFromEdges = true;
221
222 auto window = reinterpret_cast<GLFWwindow*>(impl_->GetWindowHandle());
223 if (!window) {
224 return false;
225 }
226 ::glfwSetWindowTitle(window, GetWindowTitle().c_str());
227 ::glfwSetWindowUserPointer(window, this);
228 ::glfwSetWindowSizeCallback(
229 window, [](GLFWwindow* window, int width, int height) -> void {
230 auto playground =
231 reinterpret_cast<Playground*>(::glfwGetWindowUserPointer(window));
232 if (!playground) {
233 return;
234 }
235 playground->SetWindowSize(ISize{width, height}.Max({}));
236 });
237 ::glfwSetKeyCallback(window, &PlaygroundKeyCallback);
238 ::glfwSetCursorPosCallback(window, [](GLFWwindow* window, double x,
239 double y) {
240 reinterpret_cast<Playground*>(::glfwGetWindowUserPointer(window))
241 ->SetCursorPosition({static_cast<Scalar>(x), static_cast<Scalar>(y)});
242 });
243
244 ImGui_ImplGlfw_InitForOther(window, true);
245 fml::ScopedCleanupClosure shutdown_imgui([]() { ImGui_ImplGlfw_Shutdown(); });
246
247 ImGui_ImplImpeller_Init(context_);
248 fml::ScopedCleanupClosure shutdown_imgui_impeller(
249 []() { ImGui_ImplImpeller_Shutdown(); });
250
251 ImGui::SetNextWindowPos({10, 10});
252
253 ::glfwSetWindowSize(window, GetWindowSize().width, GetWindowSize().height);
254 ::glfwSetWindowPos(window, 200, 100);
255 ::glfwShowWindow(window);
256
257 while (true) {
258 #if FML_OS_MACOSX
259 fml::ScopedNSAutoreleasePool pool;
260 #endif
261 ::glfwPollEvents();
262
263 if (::glfwWindowShouldClose(window)) {
264 return true;
265 }
266
267 ImGui_ImplGlfw_NewFrame();
268
269 auto surface = impl_->AcquireSurfaceFrame(context_);
270 RenderTarget render_target = surface->GetRenderTarget();
271
272 ImGui::NewFrame();
273 ImGui::DockSpaceOverViewport(ImGui::GetMainViewport(),
274 ImGuiDockNodeFlags_PassthruCentralNode);
275 bool result = render_callback(render_target);
276 ImGui::Render();
277
278 // Render ImGui overlay.
279 {
280 auto buffer = context_->CreateCommandBuffer();
281 if (!buffer) {
282 VALIDATION_LOG << "Could not create command buffer.";
283 return false;
284 }
285 buffer->SetLabel("ImGui Command Buffer");
286
287 auto color0 = render_target.GetColorAttachment(0);
288 color0.load_action = LoadAction::kLoad;
289 if (color0.resolve_texture) {
290 color0.texture = color0.resolve_texture;
291 color0.resolve_texture = nullptr;
292 color0.store_action = StoreAction::kStore;
293 }
294 render_target.SetColorAttachment(color0, 0);
295 render_target.SetStencilAttachment(std::nullopt);
296 render_target.SetDepthAttachment(std::nullopt);
297
298 auto pass = buffer->CreateRenderPass(render_target);
299 if (!pass) {
300 VALIDATION_LOG << "Could not create render pass.";
301 return false;
302 }
303 pass->SetLabel("ImGui Render Pass");
304 if (!host_buffer_) {
305 host_buffer_ = HostBuffer::Create(context_->GetResourceAllocator(),
306 context_->GetIdleWaiter());
307 }
308
309 ImGui_ImplImpeller_RenderDrawData(ImGui::GetDrawData(), *pass,
310 *host_buffer_);
311
312 pass->EncodeCommands();
313
314 if (!context_->GetCommandQueue()->Submit({buffer}).ok()) {
315 return false;
316 }
317 }
318
319 if (!result || !surface->Present()) {
320 return false;
321 }
322
323 if (!ShouldKeepRendering()) {
324 break;
325 }
326 }
327
328 ::glfwHideWindow(window);
329
330 return true;
331 }
332
333 bool Playground::OpenPlaygroundHere(SinglePassCallback pass_callback) {
334 return OpenPlaygroundHere(
335 [context = GetContext(), &pass_callback](RenderTarget& render_target) {
336 auto buffer = context->CreateCommandBuffer();
337 if (!buffer) {
338 return false;
339 }
340 buffer->SetLabel("Playground Command Buffer");
341
342 auto pass = buffer->CreateRenderPass(render_target);
343 if (!pass) {
344 return false;
345 }
346 pass->SetLabel("Playground Render Pass");
347
348 if (!pass_callback(*pass)) {
349 return false;
350 }
351
352 pass->EncodeCommands();
353 if (!context->GetCommandQueue()->Submit({buffer}).ok()) {
354 return false;
355 }
356 return true;
357 });
358 }
359
360 std::shared_ptr<CompressedImage> Playground::LoadFixtureImageCompressed(
361 std::shared_ptr<fml::Mapping> mapping) {
362 auto compressed_image = CompressedImageSkia::Create(std::move(mapping));
363 if (!compressed_image) {
364 VALIDATION_LOG << "Could not create compressed image.";
365 return nullptr;
366 }
367
368 return compressed_image;
369 }
370
371 std::optional<DecompressedImage> Playground::DecodeImageRGBA(
372 const std::shared_ptr<CompressedImage>& compressed) {
373 if (compressed == nullptr) {
374 return std::nullopt;
375 }
376 // The decoded image is immediately converted into RGBA as that format is
377 // known to be supported everywhere. For image sources that don't need 32
378 // bit pixel strides, this is overkill. Since this is a test fixture we
379 // aren't necessarily trying to eke out memory savings here and instead
380 // favor simplicity.
381 auto image = compressed->Decode().ConvertToRGBA();
382 if (!image.IsValid()) {
383 VALIDATION_LOG << "Could not decode image.";
384 return std::nullopt;
385 }
386
387 return image;
388 }
389
390 static std::shared_ptr<Texture> CreateTextureForDecompressedImage(
391 const std::shared_ptr<Context>& context,
392 DecompressedImage& decompressed_image,
393 bool enable_mipmapping) {
394 TextureDescriptor texture_descriptor;
395 texture_descriptor.storage_mode = StorageMode::kDevicePrivate;
396 texture_descriptor.format = PixelFormat::kR8G8B8A8UNormInt;
397 texture_descriptor.size = decompressed_image.GetSize();
398 texture_descriptor.mip_count =
399 enable_mipmapping ? decompressed_image.GetSize().MipCount() : 1u;
400
401 auto texture =
402 context->GetResourceAllocator()->CreateTexture(texture_descriptor);
403 if (!texture) {
404 VALIDATION_LOG << "Could not allocate texture for fixture.";
405 return nullptr;
406 }
407
408 auto command_buffer = context->CreateCommandBuffer();
409 if (!command_buffer) {
410 FML_DLOG(ERROR) << "Could not create command buffer for mipmap generation.";
411 return nullptr;
412 }
413 command_buffer->SetLabel("Mipmap Command Buffer");
414
415 auto blit_pass = command_buffer->CreateBlitPass();
416 auto buffer_view = DeviceBuffer::AsBufferView(
417 context->GetResourceAllocator()->CreateBufferWithCopy(
418 *decompressed_image.GetAllocation()));
419 blit_pass->AddCopy(buffer_view, texture);
420 if (enable_mipmapping) {
421 blit_pass->SetLabel("Mipmap Blit Pass");
422 blit_pass->GenerateMipmap(texture);
423 }
424 blit_pass->EncodeCommands();
425 if (!context->GetCommandQueue()->Submit({command_buffer}).ok()) {
426 FML_DLOG(ERROR) << "Failed to submit blit pass command buffer.";
427 return nullptr;
428 }
429 return texture;
430 }
431
432 std::shared_ptr<Texture> Playground::CreateTextureForMapping(
433 const std::shared_ptr<Context>& context,
434 std::shared_ptr<fml::Mapping> mapping,
435 bool enable_mipmapping) {
436 auto image = Playground::DecodeImageRGBA(
437 Playground::LoadFixtureImageCompressed(std::move(mapping)));
438 if (!image.has_value()) {
439 return nullptr;
440 }
441 return CreateTextureForDecompressedImage(context, image.value(),
442 enable_mipmapping);
443 }
444
445 std::shared_ptr<Texture> Playground::CreateTextureForFixture(
446 const char* fixture_name,
447 bool enable_mipmapping) const {
448 auto texture = CreateTextureForMapping(
449 context_, OpenAssetAsMapping(fixture_name), enable_mipmapping);
450 if (texture == nullptr) {
451 return nullptr;
452 }
453 texture->SetLabel(fixture_name);
454 return texture;
455 }
456
457 std::shared_ptr<Texture> Playground::CreateTextureCubeForFixture(
458 std::array<const char*, 6> fixture_names) const {
459 std::array<DecompressedImage, 6> images;
460 for (size_t i = 0; i < fixture_names.size(); i++) {
461 auto image = DecodeImageRGBA(
462 LoadFixtureImageCompressed(OpenAssetAsMapping(fixture_names[i])));
463 if (!image.has_value()) {
464 return nullptr;
465 }
466 images[i] = image.value();
467 }
468
469 TextureDescriptor texture_descriptor;
470 texture_descriptor.storage_mode = StorageMode::kDevicePrivate;
471 texture_descriptor.type = TextureType::kTextureCube;
472 texture_descriptor.format = PixelFormat::kR8G8B8A8UNormInt;
473 texture_descriptor.size = images[0].GetSize();
474 texture_descriptor.mip_count = 1u;
475
476 auto texture =
477 context_->GetResourceAllocator()->CreateTexture(texture_descriptor);
478 if (!texture) {
479 VALIDATION_LOG << "Could not allocate texture cube.";
480 return nullptr;
481 }
482 texture->SetLabel("Texture cube");
483
484 auto cmd_buffer = context_->CreateCommandBuffer();
485 auto blit_pass = cmd_buffer->CreateBlitPass();
486 for (size_t i = 0; i < fixture_names.size(); i++) {
487 auto device_buffer = context_->GetResourceAllocator()->CreateBufferWithCopy(
488 *images[i].GetAllocation());
489 blit_pass->AddCopy(DeviceBuffer::AsBufferView(device_buffer), texture, {},
490 "", /*mip_level=*/0, /*slice=*/i);
491 }
492
493 if (!blit_pass->EncodeCommands() ||
494 !context_->GetCommandQueue()->Submit({std::move(cmd_buffer)}).ok()) {
495 VALIDATION_LOG << "Could not upload texture to device memory.";
496 return nullptr;
497 }
498
499 return texture;
500 }
501
502 void Playground::SetWindowSize(ISize size) {
503 window_size_ = size;
504 }
505
506 bool Playground::ShouldKeepRendering() const {
507 return true;
508 }
509
510 fml::Status Playground::SetCapabilities(
511 const std::shared_ptr<Capabilities>& capabilities) {
512 return impl_->SetCapabilities(capabilities);
513 }
514
515 bool Playground::WillRenderSomething() const {
516 return switches_.enable_playground;
517 }
518
519 Playground::GLProcAddressResolver Playground::CreateGLProcAddressResolver()
520 const {
521 return impl_->CreateGLProcAddressResolver();
522 }
523
524 Playground::VKProcAddressResolver Playground::CreateVKProcAddressResolver()
525 const {
526 return impl_->CreateVKProcAddressResolver();
527 }
528
529 } // namespace impeller
allocator.h
buffer_view
BufferView buffer_view
Definition: blit_command_gles.cc:152
impeller::CompressedImageSkia::Create
static std::shared_ptr< CompressedImage > Create(std::shared_ptr< const fml::Mapping > allocation)
Definition: compressed_image_skia.cc:18
impeller::DecompressedImage
Definition: decompressed_image.h:15
impeller::DecompressedImage::GetAllocation
const std::shared_ptr< const fml::Mapping > & GetAllocation() const
Definition: decompressed_image.cc:41
impeller::DecompressedImage::GetSize
const ISize & GetSize() const
Definition: decompressed_image.cc:33
impeller::DeviceBuffer::AsBufferView
static BufferView AsBufferView(std::shared_ptr< DeviceBuffer > buffer)
Create a buffer view of this entire buffer.
Definition: device_buffer.cc:18
impeller::HostBuffer::Create
static std::shared_ptr< HostBuffer > Create(const std::shared_ptr< Allocator > &allocator, const std::shared_ptr< const IdleWaiter > &idle_waiter)
Definition: host_buffer.cc:21
impeller::Playground
Definition: playground.h:48
impeller::Playground::Playground
Playground(PlaygroundSwitches switches)
Definition: playground.cc:84
impeller::Playground::OpenPlaygroundHere
bool OpenPlaygroundHere(const RenderCallback &render_callback)
Definition: playground.cc:201
impeller::Playground::MakeContext
std::shared_ptr< Context > MakeContext() const
Definition: playground.cc:95
impeller::Playground::IsPlaygroundEnabled
bool IsPlaygroundEnabled() const
Definition: playground.cc:147
impeller::Playground::ShouldKeepRendering
virtual bool ShouldKeepRendering() const
Definition: playground.cc:506
impeller::Playground::ShouldOpenNewPlaygrounds
static bool ShouldOpenNewPlaygrounds()
Definition: playground.cc:164
impeller::Playground::GetCursorPosition
Point GetCursorPosition() const
Definition: playground.cc:181
impeller::Playground::SetWindowSize
void SetWindowSize(ISize size)
Definition: playground.cc:502
impeller::Playground::LoadFixtureImageCompressed
static std::shared_ptr< CompressedImage > LoadFixtureImageCompressed(std::shared_ptr< fml::Mapping > mapping)
Definition: playground.cc:360
impeller::Playground::GetWindowSize
ISize GetWindowSize() const
Definition: playground.cc:185
impeller::Playground::SinglePassCallback
std::function< bool(RenderPass &pass)> SinglePassCallback
Definition: playground.h:50
impeller::Playground::SetupContext
void SetupContext(PlaygroundBackend backend, const PlaygroundSwitches &switches)
Definition: playground.cc:125
impeller::Playground::CreateGLProcAddressResolver
GLProcAddressResolver CreateGLProcAddressResolver() const
Definition: playground.cc:519
impeller::Playground::WillRenderSomething
bool WillRenderSomething() const
Returns true if OpenPlaygroundHere will actually render anything.
Definition: playground.cc:515
impeller::Playground::~Playground
virtual ~Playground()
impeller::Playground::GetWindowTitle
virtual std::string GetWindowTitle() const =0
impeller::Playground::OpenAssetAsMapping
virtual std::unique_ptr< fml::Mapping > OpenAssetAsMapping(std::string asset_name) const =0
impeller::Playground::RenderCallback
std::function< bool(RenderTarget &render_target)> RenderCallback
Definition: playground.h:81
impeller::Playground::TeardownWindow
void TeardownWindow()
Definition: playground.cc:151
impeller::Playground::switches_
const PlaygroundSwitches switches_
Definition: playground.h:126
impeller::Playground::GetContext
std::shared_ptr< Context > GetContext() const
Definition: playground.cc:91
impeller::Playground::SupportsBackend
static bool SupportsBackend(PlaygroundBackend backend)
Definition: playground.cc:101
impeller::Playground::SetupWindow
void SetupWindow()
Definition: playground.cc:138
impeller::Playground::CreateTextureForMapping
static std::shared_ptr< Texture > CreateTextureForMapping(const std::shared_ptr< Context > &context, std::shared_ptr< fml::Mapping > mapping, bool enable_mipmapping=false)
Definition: playground.cc:432
impeller::Playground::GetContentScale
Point GetContentScale() const
Definition: playground.cc:189
impeller::Playground::CreateTextureForFixture
std::shared_ptr< Texture > CreateTextureForFixture(const char *fixture_name, bool enable_mipmapping=false) const
Definition: playground.cc:445
impeller::Playground::GetSecondsElapsed
Scalar GetSecondsElapsed() const
Get the amount of time elapsed from the start of the playground's execution.
Definition: playground.cc:193
impeller::Playground::VKProcAddressResolver
std::function< void *(void *instance, const char *proc_name)> VKProcAddressResolver
Definition: playground.h:122
impeller::Playground::GLProcAddressResolver
std::function< void *(const char *proc_name)> GLProcAddressResolver
Definition: playground.h:118
impeller::Playground::DecodeImageRGBA
static std::optional< DecompressedImage > DecodeImageRGBA(const std::shared_ptr< CompressedImage > &compressed)
Definition: playground.cc:371
impeller::Playground::CreateTextureCubeForFixture
std::shared_ptr< Texture > CreateTextureCubeForFixture(std::array< const char *, 6 > fixture_names) const
Definition: playground.cc:457
impeller::Playground::SetCapabilities
fml::Status SetCapabilities(const std::shared_ptr< Capabilities > &capabilities)
Definition: playground.cc:510
impeller::Playground::CreateVKProcAddressResolver
VKProcAddressResolver CreateVKProcAddressResolver() const
Definition: playground.cc:524
impeller::PlaygroundImpl::Create
static std::unique_ptr< PlaygroundImpl > Create(PlaygroundBackend backend, PlaygroundSwitches switches)
Definition: playground_impl.cc:25
impeller::PlaygroundImplVK::IsVulkanDriverPresent
static bool IsVulkanDriverPresent()
Definition: playground_impl_vk.cc:224
impeller::RenderTarget
Definition: render_target.h:38
impeller::RenderTarget::GetColorAttachment
ColorAttachment GetColorAttachment(size_t index) const
Get the color attachment at [index].
Definition: render_target.cc:233
impeller::RenderTarget::SetColorAttachment
RenderTarget & SetColorAttachment(const ColorAttachment &attachment, size_t index)
Definition: render_target.cc:199
impeller::RenderTarget::SetDepthAttachment
RenderTarget & SetDepthAttachment(std::optional< DepthAttachment > attachment)
Definition: render_target.cc:213
impeller::RenderTarget::SetStencilAttachment
RenderTarget & SetStencilAttachment(std::optional< StencilAttachment > attachment)
Definition: render_target.cc:223
command_buffer.h
compressed_image.h
compressed_image_skia.h
formats.h
decompressed_image.h
x
int32_t x
Definition: dl_golden_unittests.cc:458
host_buffer.h
ImGui_ImplImpeller_RenderDrawData
void ImGui_ImplImpeller_RenderDrawData(ImDrawData *draw_data, impeller::RenderPass &render_pass, impeller::HostBuffer &host_buffer)
Definition: imgui_impl_impeller.cc:139
ImGui_ImplImpeller_Init
bool ImGui_ImplImpeller_Init(const std::shared_ptr< impeller::Context > &context)
Definition: imgui_impl_impeller.cc:57
ImGui_ImplImpeller_Shutdown
void ImGui_ImplImpeller_Shutdown()
Definition: imgui_impl_impeller.cc:132
imgui_impl_impeller.h
impeller::android::testing::CreateContext
std::shared_ptr< Context > CreateContext()
Definition: ahb_texture_source_vk_unittests.cc:19
impeller
Definition: allocation.cc:12
impeller::PlaygroundBackendToString
std::string PlaygroundBackendToString(PlaygroundBackend backend)
Definition: playground.cc:46
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::PlaygroundKeyCallback
static void PlaygroundKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
Definition: playground.cc:168
impeller::StorageMode::kDevicePrivate
@ kDevicePrivate
impeller::PixelFormat::kR8G8B8A8UNormInt
@ kR8G8B8A8UNormInt
impeller::InitializeGLFWOnce
static void InitializeGLFWOnce()
Definition: playground.cc:58
impeller::CreateTextureForDecompressedImage
static std::shared_ptr< Texture > CreateTextureForDecompressedImage(const std::shared_ptr< Context > &context, DecompressedImage &decompressed_image, bool enable_mipmapping)
Definition: playground.cc:390
impeller::gShouldOpenNewPlaygrounds
static std::atomic_bool gShouldOpenNewPlaygrounds
Definition: playground.cc:162
impeller::TextureType::kTextureCube
@ kTextureCube
impeller::PlaygroundBackend
PlaygroundBackend
Definition: playground.h:27
impeller::PlaygroundBackend::kOpenGLES
@ kOpenGLES
impeller::PlaygroundBackend::kMetal
@ kMetal
impeller::PlaygroundBackend::kVulkan
@ kVulkan
impeller::LoadAction::kLoad
@ kLoad
impeller::StoreAction::kStore
@ kStore
impeller::SetupSwiftshaderOnce
void SetupSwiftshaderOnce(bool use_swiftshader)
Find and setup the installable client driver for a locally built SwiftShader at known paths....
Definition: swiftshader_utilities.cc:54
playground.h
playground_impl.h
playground_impl_vk.h
render_pass.h
render_target.h
context.h
runtime_stage.h
impeller::Attachment::load_action
LoadAction load_action
Definition: formats.h:659
impeller::PlaygroundSwitches
Definition: switches.h:16
impeller::PlaygroundSwitches::enable_playground
bool enable_playground
Definition: switches.h:17
impeller::PlaygroundSwitches::use_swiftshader
bool use_swiftshader
Definition: switches.h:28
impeller::TPoint< Scalar >
impeller::TSize
Definition: size.h:25
impeller::TSize::Max
constexpr TSize Max(const TSize &o) const
Definition: size.h:97
impeller::TSize::MipCount
constexpr size_t MipCount() const
Return the mip count of the texture.
Definition: size.h:137
impeller::TextureDescriptor
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
Definition: texture_descriptor.h:38
impeller::TextureDescriptor::type
TextureType type
Definition: texture_descriptor.h:40
impeller::TextureDescriptor::size
ISize size
Definition: texture_descriptor.h:42
impeller::TextureDescriptor::storage_mode
StorageMode storage_mode
Definition: texture_descriptor.h:39
impeller::TextureDescriptor::mip_count
size_t mip_count
Definition: texture_descriptor.h:43
impeller::TextureDescriptor::format
PixelFormat format
Definition: texture_descriptor.h:41
swiftshader_utilities.h
validation.h
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91