9 #include "flutter/fml/logging.h"
13 #if IMPELLER_ENABLE_OPENGLES
14 #include "impeller/entity/gles/entity_shaders_gles.h"
15 #include "impeller/entity/gles/framebuffer_blend_shaders_gles.h"
17 #endif // IMPELLER_ENABLE_OPENGLES
27 std::shared_ptr<BackendData> backend_data)
29 backend_data_(
std::move(backend_data)) {}
41 #if IMPELLER_ENABLE_OPENGLES
46 ReactorWorker() : thread_id_(
std::this_thread::get_id()) {}
49 ~ReactorWorker()
override =
default;
52 bool CanReactorReactOnCurrentThreadNow(
54 return thread_id_ == std::this_thread::get_id();
58 std::thread::id thread_id_;
60 FML_DISALLOW_COPY_AND_ASSIGN(ReactorWorker);
63 #endif // IMPELLER_ENABLE_OPENGLES
66 std::function<
void*(
const char* gl_proc_name)> proc_address_callback) {
67 #if IMPELLER_ENABLE_OPENGLES
68 auto proc_table = std::make_unique<ProcTableGLES>(
70 if (!proc_table || !proc_table->IsValid()) {
74 std::vector<std::shared_ptr<fml::Mapping>> shader_mappings = {
75 std::make_shared<fml::NonOwnedMapping>(
76 impeller_entity_shaders_gles_data,
77 impeller_entity_shaders_gles_length),
78 std::make_shared<fml::NonOwnedMapping>(
79 impeller_framebuffer_blend_shaders_gles_data,
80 impeller_framebuffer_blend_shaders_gles_length),
82 auto impeller_context =
84 if (!impeller_context) {
88 auto reactor_worker = std::make_shared<ReactorWorker>();
89 auto worker_id = impeller_context->AddReactorWorker(reactor_worker);
90 if (!worker_id.has_value()) {
95 Create<Context>(std::move(impeller_context), std::move(reactor_worker));
96 if (!context->IsValid()) {
101 #else // IMPELLER_ENABLE_OPENGLES
102 VALIDATION_LOG <<
"This build does not support OpenGL ES contexts.";
104 #endif // IMPELLER_ENABLE_OPENGLES