22 std::unique_ptr<ProcTableGLES> gl,
23 const std::vector<std::shared_ptr<fml::Mapping>>& shader_libraries,
24 bool enable_gpu_tracing) {
25 return std::shared_ptr<ContextGLES>(
26 new ContextGLES(std::move(gl), shader_libraries, enable_gpu_tracing));
29 ContextGLES::ContextGLES(
30 std::unique_ptr<ProcTableGLES> gl,
31 const std::vector<std::shared_ptr<fml::Mapping>>& shader_libraries_mappings,
32 bool enable_gpu_tracing) {
33 reactor_ = std::make_shared<ReactorGLES>(std::move(gl));
34 if (!reactor_->IsValid()) {
41 auto library = std::shared_ptr<ShaderLibraryGLES>(
42 new ShaderLibraryGLES(shader_libraries_mappings));
43 if (!library->IsValid()) {
47 shader_library_ = std::move(library);
53 std::shared_ptr<PipelineLibraryGLES>(
new PipelineLibraryGLES(reactor_));
59 std::shared_ptr<AllocatorGLES>(
new AllocatorGLES(reactor_));
60 if (!resource_allocator_->IsValid()) {
66 device_capabilities_ = reactor_->GetProcTable().GetCapabilities();
71 std::shared_ptr<SamplerLibraryGLES>(
new SamplerLibraryGLES(
72 device_capabilities_->SupportsDecalSamplerAddressMode()));
76 command_queue_ = std::make_shared<CommandQueue>();
91 const std::shared_ptr<ReactorGLES::Worker>& worker) {
95 return reactor_->AddWorker(worker);
102 return reactor_->RemoveWorker(
id);
105 bool ContextGLES::IsValid()
const {
109 void ContextGLES::Shutdown() {}
112 std::string ContextGLES::DescribeGpuModel()
const {
113 return reactor_->GetProcTable().GetDescription()->GetString();
117 std::shared_ptr<Allocator> ContextGLES::GetResourceAllocator()
const {
118 return resource_allocator_;
122 std::shared_ptr<ShaderLibrary> ContextGLES::GetShaderLibrary()
const {
123 return shader_library_;
127 std::shared_ptr<SamplerLibrary> ContextGLES::GetSamplerLibrary()
const {
128 return sampler_library_;
132 std::shared_ptr<PipelineLibrary> ContextGLES::GetPipelineLibrary()
const {
133 return pipeline_library_;
137 std::shared_ptr<CommandBuffer> ContextGLES::CreateCommandBuffer()
const {
138 return std::shared_ptr<CommandBufferGLES>(
139 new CommandBufferGLES(weak_from_this(), reactor_));
143 const std::shared_ptr<const Capabilities>& ContextGLES::GetCapabilities()
145 return device_capabilities_;
149 std::shared_ptr<CommandQueue> ContextGLES::GetCommandQueue()
const {
150 return command_queue_;
154 void ContextGLES::ResetThreadLocalState()
const {
158 [[maybe_unused]]
auto result =
159 reactor_->AddOperation([](
const ReactorGLES& reactor) {
164 bool ContextGLES::EnqueueCommandBuffer(
165 std::shared_ptr<CommandBuffer> command_buffer) {
170 [[nodiscard]]
bool ContextGLES::FlushCommandBuffers() {
171 return reactor_->React();
175 bool ContextGLES::AddTrackingFence(
176 const std::shared_ptr<Texture>& texture)
const {
177 if (!reactor_->GetProcTable().FenceSync.IsAvailable()) {
static TextureGLES & Cast(Texture &base)
BackendType GetBackendType() const override
Get the graphics backend of an Impeller context.
bool RemoveReactorWorker(ReactorGLES::WorkerID id)
const std::shared_ptr< ReactorGLES > & 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)
std::optional< ReactorGLES::WorkerID > AddReactorWorker(const std::shared_ptr< ReactorGLES::Worker > &worker)
static void ResetGLState(const ProcTableGLES &gl)
void SetFence(HandleGLES fence)
Attach a sync fence to this texture that will be waited on before encoding a rendering operation that...
const ProcTable & GetProcTable()