17 std::unique_ptr<ProcTableGLES> gl,
18 const std::vector<std::shared_ptr<fml::Mapping>>& shader_libraries,
19 bool enable_gpu_tracing) {
20 return std::shared_ptr<ContextGLES>(
21 new ContextGLES(std::move(gl), shader_libraries, enable_gpu_tracing));
24ContextGLES::ContextGLES(
25 std::unique_ptr<ProcTableGLES> gl,
26 const std::vector<std::shared_ptr<fml::Mapping>>& shader_libraries_mappings,
27 bool enable_gpu_tracing) {
28 reactor_ = std::make_shared<ReactorGLES>(std::move(gl));
29 if (!reactor_->IsValid()) {
36 auto library = std::shared_ptr<ShaderLibraryGLES>(
37 new ShaderLibraryGLES(shader_libraries_mappings));
38 if (!library->IsValid()) {
42 shader_library_ = std::move(library);
48 std::shared_ptr<PipelineLibraryGLES>(
new PipelineLibraryGLES(reactor_));
54 std::shared_ptr<AllocatorGLES>(
new AllocatorGLES(reactor_));
55 if (!resource_allocator_->IsValid()) {
61 device_capabilities_ = reactor_->GetProcTable().GetCapabilities();
66 std::shared_ptr<SamplerLibraryGLES>(
new SamplerLibraryGLES(
67 device_capabilities_->SupportsDecalSamplerAddressMode()));
71 command_queue_ = std::make_shared<CommandQueue>();
86 const std::shared_ptr<ReactorGLES::Worker>& worker) {
90 return reactor_->AddWorker(worker);
97 return reactor_->RemoveWorker(
id);
108 return reactor_->GetProcTable().GetDescription()->GetString();
113 return resource_allocator_;
118 return shader_library_;
123 return sampler_library_;
128 return pipeline_library_;
133 return std::shared_ptr<CommandBufferGLES>(
140 return device_capabilities_;
145 return command_queue_;
std::string DescribeGpuModel() const override
const ReactorGLES::Ref & GetReactor() const
std::shared_ptr< CommandBuffer > CreateCommandBuffer() const override
Create a new command buffer. Command buffers can be used to encode graphics, blit,...
std::shared_ptr< Allocator > GetResourceAllocator() const override
Returns the allocator used to create textures and buffers on the device.
static std::shared_ptr< ContextGLES > Create(std::unique_ptr< ProcTableGLES > gl, const std::vector< std::shared_ptr< fml::Mapping > > &shader_libraries, bool enable_gpu_tracing)
BackendType GetBackendType() const override
Get the graphics backend of an Impeller context.
std::shared_ptr< CommandQueue > GetCommandQueue() const override
Return the graphics queue for submitting command buffers.
bool RemoveReactorWorker(ReactorGLES::WorkerID id)
bool IsValid() const override
Determines if a context is valid. If the caller ever receives an invalid context, they must discard i...
void Shutdown() override
Force all pending asynchronous work to finish. This is achieved by deleting all owned concurrent mess...
std::shared_ptr< ShaderLibrary > GetShaderLibrary() const override
Returns the library of shaders used to specify the programmable stages of a pipeline.
std::shared_ptr< SamplerLibrary > GetSamplerLibrary() const override
Returns the library of combined image samplers used in shaders.
std::shared_ptr< PipelineLibrary > GetPipelineLibrary() const override
Returns the library of pipelines used by render or compute commands.
std::optional< ReactorGLES::WorkerID > AddReactorWorker(const std::shared_ptr< ReactorGLES::Worker > &worker)
const std::shared_ptr< const Capabilities > & GetCapabilities() const override
Get the capabilities of Impeller context. All optionally supported feature of the platform,...
std::shared_ptr< ReactorGLES > Ref
const ProcTable & GetProcTable()