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);
100bool ContextGLES::IsValid()
const {
104void ContextGLES::Shutdown() {}
107std::string ContextGLES::DescribeGpuModel()
const {
108 return reactor_->GetProcTable().GetDescription()->GetString();
112std::shared_ptr<Allocator> ContextGLES::GetResourceAllocator()
const {
113 return resource_allocator_;
117std::shared_ptr<ShaderLibrary> ContextGLES::GetShaderLibrary()
const {
118 return shader_library_;
122std::shared_ptr<SamplerLibrary> ContextGLES::GetSamplerLibrary()
const {
123 return sampler_library_;
127std::shared_ptr<PipelineLibrary> ContextGLES::GetPipelineLibrary()
const {
128 return pipeline_library_;
132std::shared_ptr<CommandBuffer> ContextGLES::CreateCommandBuffer()
const {
133 return std::shared_ptr<CommandBufferGLES>(
134 new CommandBufferGLES(weak_from_this(), reactor_));
138const std::shared_ptr<const Capabilities>& ContextGLES::GetCapabilities()
140 return device_capabilities_;
144std::shared_ptr<CommandQueue> ContextGLES::GetCommandQueue()
const {
145 return command_queue_;
const ReactorGLES::Ref & GetReactor() const
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.
bool RemoveReactorWorker(ReactorGLES::WorkerID id)
std::optional< ReactorGLES::WorkerID > AddReactorWorker(const std::shared_ptr< ReactorGLES::Worker > &worker)
std::shared_ptr< ReactorGLES > Ref
const ProcTable & GetProcTable()