16 static std::once_flag sOnceFlag;
17 std::call_once(sOnceFlag, []() {
18 std::map<std::string, void*> proc_map;
19 #define IMPELLER_HPP_PROC(name) \
20 proc_map[#name] = reinterpret_cast<void*>(&name);
22 #undef IMPELLER_HPP_PROC
24 [&](
auto name) {
return proc_map.at(name); });
43 FML_CHECK(
false) <<
"Metal not yet implemented.";
49 [](
const char* proc_name,
void* user_data) ->
void* {
51 user_data))(proc_name);
55 &playground_gl_proc_address_callback));
58 FML_CHECK(
false) <<
"Vulkan not yet implemented.";
70 auto impeller_surface = std::make_shared<impeller::Surface>(target);
71 auto surface = Create<Surface>(*context.Get(), impeller_surface);
75 return callback(context, surface);
80 if (interop_context_) {
81 return interop_context_;
83 auto context = Create<Context>(
GetContext(),
nullptr);
87 interop_context_ = std::move(context);
88 return interop_context_;
bool OpenPlaygroundHere(const RenderCallback &render_callback)
GLProcAddressResolver CreateGLProcAddressResolver() const
std::shared_ptr< Context > GetContext() const
std::function< void *(const char *proc_name)> GLProcAddressResolver
PlaygroundBackend GetBackend() const
ScopedObject< Context > CreateContext() const
ScopedObject< Context > GetInteropContext()
~PlaygroundTest() override
std::function< bool(const ScopedObject< Context > &context, const ScopedObject< Surface > &surface)> InteropPlaygroundCallback
bool OpenPlaygroundHere(InteropPlaygroundCallback callback)
void *IMPELLER_NULLABLE(* ImpellerProcAddressCallback)(const char *IMPELLER_NONNULL proc_name, void *IMPELLER_NULLABLE user_data)
#define IMPELLER_HPP_EACH_PROC(PROC)
ProcTable gGlobalProcTable
IMPELLER_EXTERN_C uint32_t ImpellerGetVersion()
IMPELLER_EXTERN_C ImpellerContext ImpellerContextCreateOpenGLESNew(uint32_t version, ImpellerProcAddressCallback gl_proc_address_callback, void *gl_proc_address_callback_user_data)
bool Initialize(const std::function< void *(const char *function_name)> &resolver)