23 std::unique_ptr<ProcTableGLES> gl,
24 const std::vector<std::shared_ptr<fml::Mapping>>& shader_libraries,
25 bool enable_gpu_tracing) {
26 return std::shared_ptr<ContextGLES>(
new ContextGLES(
27 flags, std::move(gl), shader_libraries, enable_gpu_tracing));
30 ContextGLES::ContextGLES(
32 std::unique_ptr<ProcTableGLES> gl,
33 const std::vector<std::shared_ptr<fml::Mapping>>& shader_libraries_mappings,
34 bool enable_gpu_tracing)
36 reactor_ = std::make_shared<ReactorGLES>(std::move(gl));
37 if (!reactor_->IsValid()) {
44 auto library = std::shared_ptr<ShaderLibraryGLES>(
45 new ShaderLibraryGLES(shader_libraries_mappings));
46 if (!library->IsValid()) {
50 shader_library_ = std::move(library);
56 std::shared_ptr<PipelineLibraryGLES>(
new PipelineLibraryGLES(reactor_));
62 std::shared_ptr<AllocatorGLES>(
new AllocatorGLES(reactor_));
63 if (!resource_allocator_->IsValid()) {
69 device_capabilities_ = reactor_->GetProcTable().GetCapabilities();
74 std::shared_ptr<SamplerLibraryGLES>(
new SamplerLibraryGLES(
75 device_capabilities_->SupportsDecalSamplerAddressMode()));
79 command_queue_ = std::make_shared<CommandQueue>();
94 const std::shared_ptr<ReactorGLES::Worker>& worker) {
98 return reactor_->AddWorker(worker);
105 return reactor_->RemoveWorker(
id);
108 bool ContextGLES::IsValid()
const {
112 void ContextGLES::Shutdown() {}
115 std::string ContextGLES::DescribeGpuModel()
const {
116 return reactor_->GetProcTable().GetDescription()->GetString();
120 std::shared_ptr<Allocator> ContextGLES::GetResourceAllocator()
const {
121 return resource_allocator_;
125 std::shared_ptr<ShaderLibrary> ContextGLES::GetShaderLibrary()
const {
126 return shader_library_;
130 std::shared_ptr<SamplerLibrary> ContextGLES::GetSamplerLibrary()
const {
131 return sampler_library_;
135 std::shared_ptr<PipelineLibrary> ContextGLES::GetPipelineLibrary()
const {
136 return pipeline_library_;
140 std::shared_ptr<CommandBuffer> ContextGLES::CreateCommandBuffer()
const {
141 return std::shared_ptr<CommandBufferGLES>(
142 new CommandBufferGLES(weak_from_this(), reactor_));
146 const std::shared_ptr<const Capabilities>& ContextGLES::GetCapabilities()
148 return device_capabilities_;
152 std::shared_ptr<CommandQueue> ContextGLES::GetCommandQueue()
const {
153 return command_queue_;
157 void ContextGLES::ResetThreadLocalState()
const {
161 [[maybe_unused]]
auto result =
162 reactor_->AddOperation([](
const ReactorGLES& reactor) {
167 bool ContextGLES::EnqueueCommandBuffer(
168 std::shared_ptr<CommandBuffer> command_buffer) {
173 [[nodiscard]]
bool ContextGLES::FlushCommandBuffers() {
174 return reactor_->React();
178 bool ContextGLES::AddTrackingFence(
179 const std::shared_ptr<Texture>& texture)
const {
180 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(const Flags &flags, 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)
To do anything rendering related with Impeller, you need a context.
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()