[Tizen] Change GetTextureProperties
[platform/core/uifw/dali-adaptor.git] / dali / internal / graphics / gles-impl / egl-graphics-controller.h
1 #ifndef DALI_EGL_GRAPHICS_CONTROLLER_H
2 #define DALI_EGL_GRAPHICS_CONTROLLER_H
3
4 /*
5  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 // EXTERNAL INCLUDES
21 #include <dali/graphics-api/graphics-controller.h>
22 #include <queue>
23
24 // INTERNAL INCLUDES
25 #include <dali/integration-api/graphics-sync-abstraction.h>
26 #include <dali/internal/graphics/common/graphics-interface.h>
27 #include <dali/internal/graphics/gles-impl/gles-context.h>
28 #include <dali/internal/graphics/gles-impl/gles-graphics-buffer.h>
29 #include <dali/internal/graphics/gles-impl/gles-graphics-command-buffer.h>
30 #include <dali/internal/graphics/gles-impl/gles-graphics-framebuffer.h>
31 #include <dali/internal/graphics/gles-impl/gles-graphics-pipeline-cache.h>
32 #include <dali/internal/graphics/gles-impl/gles-graphics-pipeline.h>
33 #include <dali/internal/graphics/gles-impl/gles-graphics-reflection.h>
34 #include <dali/internal/graphics/gles-impl/gles-graphics-sampler.h>
35 #include <dali/internal/graphics/gles-impl/gles-graphics-shader.h>
36 #include <dali/internal/graphics/gles-impl/gles-graphics-texture.h>
37 #include <dali/internal/graphics/gles-impl/gles-graphics-types.h>
38 #include <dali/internal/graphics/gles-impl/gles-sync-pool.h>
39 #include <dali/internal/graphics/gles-impl/gles-texture-dependency-checker.h>
40 #include <dali/internal/graphics/gles-impl/gles2-graphics-memory.h>
41
42 namespace Dali
43 {
44 namespace Integration
45 {
46 class GlAbstraction;
47 class GlContextHelperAbstraction;
48 } // namespace Integration
49
50 namespace Graphics
51 {
52 namespace GLES
53 {
54 class CommandBuffer;
55 class PipelineCache;
56 class SyncPool;
57 class TextureDependencyChecker;
58 } // namespace GLES
59
60 /**
61  * EGL Implementation of the graphics controller.
62  *
63  * Temporarily holds the old GL abstractions whilst dali-core is migrated to the new API.
64  */
65 class EglGraphicsController : public Graphics::Controller
66 {
67 public:
68   /**
69    * @brief Constructor
70    */
71   EglGraphicsController();
72
73   /**
74    * @brief Destructor
75    */
76   ~EglGraphicsController() override;
77
78   /**
79    * Initialize the GLES abstraction. This can be called from the main thread.
80    */
81   void InitializeGLES(Integration::GlAbstraction& glAbstraction);
82
83   /**
84    * Initialize with a reference to the GL abstractions.
85    *
86    * Note, this is now executed in the render thread, after core initialization
87    */
88   void Initialize(Integration::GraphicsSyncAbstraction&    syncImplementation,
89                   Integration::GlContextHelperAbstraction& glContextHelperAbstraction,
90                   Internal::Adaptor::GraphicsInterface&    graphicsInterface);
91
92   Integration::GlAbstraction&               GetGlAbstraction() override;
93   Integration::GlContextHelperAbstraction&  GetGlContextHelperAbstraction() override;
94   Internal::Adaptor::EglSyncImplementation& GetEglSyncImplementation();
95
96   /**
97    * @copydoc Dali::Graphics::SubmitCommandBuffers()
98    */
99   void SubmitCommandBuffers(const SubmitInfo& submitInfo) override;
100
101   /**
102    * @copydoc Dali::Graphics::PresentRenderTarget()
103    */
104   void PresentRenderTarget(RenderTarget* renderTarget) override;
105
106   /**
107    * @copydoc Dali::Graphics::WaitIdle()
108    */
109   void WaitIdle() override
110   {
111   }
112
113   /**
114    * @copydoc Dali::Graphics::Pause()
115    */
116   void Pause() override
117   {
118   }
119
120   /**
121    * @copydoc Dali::Graphics::Resume()
122    */
123   void Resume() override
124   {
125   }
126
127   /**
128    * @copydoc Dali::Graphics::Shutdown()
129    */
130   void Shutdown() override
131   {
132     mIsShuttingDown = true;
133
134     // Final flush
135     Flush();
136
137     if(mContext)
138     {
139       mContext->GlContextDestroyed();
140     }
141
142     for(auto&& context : mSurfaceContexts)
143     {
144       if(context.second)
145       {
146         context.second->GlContextDestroyed();
147       }
148     }
149   }
150
151   /**
152    * @copydoc Dali::Graphics::Destroy()
153    */
154   void Destroy() override
155   {
156   }
157
158   /**
159    * @copydoc Dali::Graphics::UpdateTextures()
160    */
161   void UpdateTextures(const std::vector<TextureUpdateInfo>&       updateInfoList,
162                       const std::vector<TextureUpdateSourceInfo>& sourceList) override;
163
164   /**
165    * @copydoc Dali::Graphics::GenerateTextureMipmaps()
166    */
167   void GenerateTextureMipmaps(const Texture& texture) override;
168
169   /**
170    * @copydoc Dali::Graphics::EnableDepthStencilBuffer()
171    */
172   bool EnableDepthStencilBuffer(bool enableDepth, bool enableStencil) override
173   {
174     return {};
175   }
176
177   /**
178    * @copydoc Dali::Graphics::RunGarbageCollector()
179    */
180   void RunGarbageCollector(size_t numberOfDiscardedRenderers) override
181   {
182   }
183
184   /**
185    * @copydoc Dali::Graphics::DiscardUnusedResources()
186    */
187   void DiscardUnusedResources() override
188   {
189   }
190
191   /**
192    * @copydoc Dali::Graphics::IsDiscardQueueEmpty()
193    */
194   bool IsDiscardQueueEmpty() override
195   {
196     return {};
197   }
198
199   /**
200    * @copydoc Dali::Graphics::IsDrawOnResumeRequired()
201    */
202   bool IsDrawOnResumeRequired() override
203   {
204     return {};
205   }
206
207   /**
208    * @copydoc Dali::Graphics::CreateBuffer()
209    */
210   Graphics::UniquePtr<Buffer> CreateBuffer(const BufferCreateInfo& bufferCreateInfo, Graphics::UniquePtr<Buffer>&& oldBuffer) override;
211
212   /**
213    * @copydoc Dali::Graphics::CreateCommandBuffer()
214    */
215   Graphics::UniquePtr<CommandBuffer> CreateCommandBuffer(const CommandBufferCreateInfo& commandBufferCreateInfo, Graphics::UniquePtr<CommandBuffer>&& oldCommandBuffer) override;
216
217   /**
218    * @copydoc Dali::Graphics::CreateRenderPass()
219    */
220   Graphics::UniquePtr<RenderPass> CreateRenderPass(const RenderPassCreateInfo& renderPassCreateInfo, Graphics::UniquePtr<RenderPass>&& oldRenderPass) override;
221
222   /**
223    * @copydoc Dali::Graphics::CreateTexture()
224    */
225   Graphics::UniquePtr<Texture> CreateTexture(const TextureCreateInfo& textureCreateInfo, Graphics::UniquePtr<Texture>&& oldTexture) override;
226
227   /**
228    * @copydoc Dali::Graphics::CreateFramebuffer()
229    */
230   Graphics::UniquePtr<Framebuffer> CreateFramebuffer(const FramebufferCreateInfo& framebufferCreateInfo, Graphics::UniquePtr<Framebuffer>&& oldFramebuffer) override;
231
232   /**
233    * @copydoc Dali::Graphics::CreatePipeline()
234    */
235   Graphics::UniquePtr<Pipeline> CreatePipeline(const PipelineCreateInfo& pipelineCreateInfo, Graphics::UniquePtr<Pipeline>&& oldPipeline) override;
236
237   /**
238    * @copydoc Dali::Graphics::CreateProgram()
239    */
240   Graphics::UniquePtr<Program> CreateProgram(const ProgramCreateInfo& programCreateInfo, UniquePtr<Program>&& oldProgram) override;
241
242   /**
243    * @copydoc Dali::Graphics::CreateShader()
244    */
245   Graphics::UniquePtr<Shader> CreateShader(const ShaderCreateInfo& shaderCreateInfo, Graphics::UniquePtr<Shader>&& oldShader) override;
246
247   /**
248    * @copydoc Dali::Graphics::CreateSampler()
249    */
250   Graphics::UniquePtr<Sampler> CreateSampler(const SamplerCreateInfo& samplerCreateInfo, Graphics::UniquePtr<Sampler>&& oldSampler) override;
251
252   /**
253    * @copydoc Dali::Graphics::CreateRenderTarget()
254    */
255   Graphics::UniquePtr<RenderTarget> CreateRenderTarget(const RenderTargetCreateInfo& renderTargetCreateInfo, Graphics::UniquePtr<RenderTarget>&& oldRenderTarget) override;
256
257   /**
258    * @copydoc Dali::Graphics::CreateSyncObject()
259    */
260   Graphics::UniquePtr<SyncObject> CreateSyncObject(const SyncObjectCreateInfo&       syncObjectCreateInfo,
261                                                    Graphics::UniquePtr<SyncObject>&& oldSyncObject) override;
262
263   /**
264    * @copydoc Dali::Graphics::MapBufferRange()
265    */
266   Graphics::UniquePtr<Memory> MapBufferRange(const MapBufferInfo& mapInfo) override;
267
268   /**
269    * @copydoc Dali::Graphics::MapTextureRange()
270    */
271   Graphics::UniquePtr<Memory> MapTextureRange(const MapTextureInfo& mapInfo) override
272   {
273     return nullptr;
274   }
275
276   /**
277    * @copydoc Dali::Graphics::UnmapMemory()
278    */
279   void UnmapMemory(Graphics::UniquePtr<Memory> memory) override
280   {
281   }
282   /**
283    * @copydoc Dali::Graphics::GetTextureMemoryRequirements()
284    */
285   MemoryRequirements GetTextureMemoryRequirements(Texture& texture) const override
286   {
287     return {};
288   }
289
290   /**
291    * @copydoc Dali::Graphics::GetBufferMemoryRequirements()
292    */
293   MemoryRequirements GetBufferMemoryRequirements(Buffer& buffer) const override
294   {
295     return {};
296   }
297
298   /**
299    * @copydoc Dali::Graphics::GetTextureProperties()
300    */
301   TextureProperties GetTextureProperties(const Texture& texture) override;
302
303   /**
304    * @copydoc Dali::Graphics::Controller::GetPipelineReflection()
305    */
306   [[nodiscard]] const Reflection& GetProgramReflection(const Graphics::Program& program) override;
307
308   /**
309    * @copydoc Dali::Graphics::PipelineEquals()
310    */
311   [[nodiscard]] bool PipelineEquals(const Pipeline& pipeline0, const Pipeline& pipeline1) const override
312   {
313     return {};
314   }
315
316   [[nodiscard]] Integration::GlAbstraction* GetGL() const
317   {
318     if(mIsShuttingDown)
319     {
320       return nullptr;
321     }
322     return mGlAbstraction;
323   }
324
325   [[nodiscard]] Internal::Adaptor::GraphicsInterface* GetGraphicsInterface() const
326   {
327     return mGraphics;
328   }
329
330   // Internal
331   void AddTexture(GLES::Texture& texture);
332
333   /**
334    * @brief Adds buffer to the creation queue
335    * @param buffer
336    */
337   void AddBuffer(GLES::Buffer& buffer);
338
339   /**
340    * @brief Adds framebuffer to the creation queue
341    * @param buffer
342    */
343   void AddFramebuffer(GLES::Framebuffer& framebuffer);
344
345   /**
346    * @brief Pushes Bufer to the discard queue
347    *
348    * Function is called from the UniquePtr custom deleter.
349    *
350    * @param[in] texture Pointer to the texture
351    */
352   void DiscardResource(GLES::Texture* texture)
353   {
354     mDiscardTextureQueue.push(texture);
355   }
356
357   /**
358    * @brief Pushes Buffer to the discard queue
359    *
360    * Function is called from the UniquePtr custom deleter.
361    *
362    * @param[in] buffer Pointer to the buffer object
363    */
364   void DiscardResource(GLES::Buffer* buffer)
365   {
366     mDiscardBufferQueue.push(buffer);
367   }
368
369   /**
370    * @brief Pushes framebuffer to the discard queue
371    *
372    * Function is called from the UniquePtr custom deleter.
373    *
374    * @param[in] framebuffer Pointer to the framebuffer object
375    */
376   void DiscardResource(GLES::Framebuffer* framebuffer)
377   {
378     mDiscardFramebufferQueue.push(framebuffer);
379   }
380
381   /**
382    * @brief Pushes Program to the discard queue
383    *
384    * Function is called from the UniquePtr custom deleter.
385    *
386    * @param[in] program Pointer to the program
387    */
388   void DiscardResource(GLES::Program* program)
389   {
390     mDiscardProgramQueue.push(program);
391   }
392
393   /**
394    * @brief Pushes RenderPass to the discard queue
395    *
396    * Function is called from the UniquePtr custom deleter.
397    *
398    * @param[in] program Pointer to the RenderPass
399    */
400   void DiscardResource(GLES::RenderPass* renderPass)
401   {
402     mDiscardRenderPassQueue.push(renderPass);
403   }
404
405   /**
406    * @brief Pushes RenderTarget to the discard queue
407    *
408    * Function is called from the UniquePtr custom deleter.
409    *
410    * @param[in] program Pointer to the RenderTarget
411    */
412   void DiscardResource(GLES::RenderTarget* renderTarget)
413   {
414     mDiscardRenderTargetQueue.push(renderTarget);
415   }
416
417   /**
418    * @brief Pushes Shader to the discard queue
419    *
420    * Function is called from the UniquePtr custom deleter.
421    *
422    * @param[in] program Pointer to the Shader
423    */
424   void DiscardResource(GLES::Shader* shader)
425   {
426     mDiscardShaderQueue.push(shader);
427   }
428
429   /**
430    * @brief Pushes CommandBuffer to the discard queue
431    *
432    * Function is called from the UniquePtr custom deleter.
433    *
434    * @param[in] program Pointer to the CommandBuffer
435    */
436   void DiscardResource(GLES::CommandBuffer* commandBuffer)
437   {
438     mDiscardCommandBufferQueue.push(commandBuffer);
439   }
440
441   /**
442    * @brief Pushes Sampler to the discard queue
443    *
444    * Function is called from the UniquePtr custom deleter.
445    *
446    * @param[in] program Pointer to the Sampler
447    */
448   void DiscardResource(GLES::Sampler* sampler)
449   {
450     mDiscardSamplerQueue.push(sampler);
451   }
452
453   /**
454    * @brief Pushes Pipeline to the discard queue
455    *
456    * Function is called from the UniquePtr custom deleter.
457    *
458    * @param[in] program Pointer to the pipeline
459    */
460   void DiscardResource(GLES::Pipeline* pipeline)
461   {
462     mDiscardPipelineQueue.push(pipeline);
463   }
464
465   /**
466    * @brief Flushes all pending updates
467    *
468    * Function flushes all pending resource constructions,
469    * executes command buffers and empties discard queues.
470    */
471   void Flush()
472   {
473     if(!mCreateTextureQueue.empty() ||
474        !mCreateBufferQueue.empty() ||
475        !mCreateFramebufferQueue.empty() ||
476        !mTextureUpdateRequests.empty() ||
477        !mTextureMipmapGenerationRequests.empty())
478     {
479       mGraphics->ActivateResourceContext();
480     }
481
482     // Process creations
483     ProcessCreateQueues();
484
485     // Process updates
486     ProcessTextureUpdateQueue();
487
488     // Process texture mipmap generation requests
489     ProcessTextureMipmapGenerationQueue();
490
491     // Process main command queue
492     ProcessCommandQueues();
493
494     // Reset texture cache in the contexts while destroying textures
495     ResetTextureCache();
496
497     // Reset buffer cache in the contexts while destroying buffers
498     ResetBufferCache();
499
500     // Process discards
501     ProcessDiscardQueues();
502
503     // Flush pipeline cache to remove unused pipelines
504     if(mPipelineCache)
505     {
506       mPipelineCache->FlushCache();
507     }
508   }
509
510   // Test update to tick controller, usually it will run own thread
511   void ProcessDiscardQueues();
512
513   /**
514    * @brief Processes a create queue for type specified
515    *
516    * @param[in,out] queue Reference to the create queue
517    */
518   template<class T>
519   void ProcessCreateQueue(T& queue)
520   {
521     while(!queue.empty())
522     {
523       auto* object = queue.front();
524       queue.pop();
525
526       // Initialize texture
527       if(!object->InitializeResource())
528       {
529         // TODO: handle error
530       }
531     }
532   }
533
534   /**
535    * @brief Processes a discard queue for type specified
536    *
537    * @param[in,out] queue Reference to the discard queue
538    */
539   template<class U, class T>
540   void ProcessDiscardQueue(T& queue)
541   {
542     while(!queue.empty())
543     {
544       auto* object = const_cast<U*>(queue.front());
545
546       // Destroy
547       object->DestroyResource();
548
549       // Free
550       auto* clbk = object->GetCreateInfo().allocationCallbacks;
551       if(clbk)
552       {
553         // Call destructor
554         object->~U();
555
556         // Free memory
557         clbk->freeCallback(object, clbk->userData);
558       }
559       else
560       {
561         delete object;
562       }
563       queue.pop();
564     }
565   }
566
567   /**
568    * @brief Processes a discard queue for pipeline
569    *
570    * @param[in,out] queue Reference to the create queue
571    */
572   void ProcessDiscardQueue(std::queue<GLES::Pipeline*>& queue)
573   {
574     while(!queue.empty())
575     {
576       auto* object = const_cast<GLES::Pipeline*>(queue.front());
577
578       // Inform the contexts to invalidate the pipeline if cached
579       if(mContext)
580       {
581         mContext->InvalidateCachedPipeline(object);
582       }
583
584       for(auto&& context : mSurfaceContexts)
585       {
586         if(context.second)
587         {
588           context.second->InvalidateCachedPipeline(object);
589         }
590       }
591
592       // Destroy
593       object->DestroyResource();
594
595       // Free
596       auto* clbk = object->GetCreateInfo().allocationCallbacks;
597       if(clbk)
598       {
599         // Call destructor
600         using GLESPipeline = GLES::Pipeline;
601         object->~GLESPipeline();
602
603         // Free memory
604         clbk->freeCallback(object, clbk->userData);
605       }
606       else
607       {
608         delete object;
609       }
610       queue.pop();
611     }
612   }
613
614   /**
615    * @brief Processes all resource create queues
616    */
617   void ProcessCreateQueues();
618
619   /**
620    * @brief Process command queues and buffers
621    */
622   void ProcessCommandQueues();
623
624   /**
625    * @brief Executes all pending texture updates
626    */
627   void ProcessTextureUpdateQueue();
628
629   /**
630    * @brief Executes all pending texture mipmap generation
631    */
632   void ProcessTextureMipmapGenerationQueue();
633
634   /**
635    * @brief Returns program custom parameter
636    *
637    * This function can be used as a backdoor in order to retrieve
638    * certain data out of implementation
639    *
640    * @param[in] program Valid Program object
641    * @param parameterId Integer id of parameter
642    * @param outData Output data
643    * @return True if parameter retrieved
644    */
645   bool GetProgramParameter(Graphics::Program& program, uint32_t parameterId, void* outData) override;
646
647   /**
648    * @brief Returns pipeline cache object
649    *
650    * @return Valid pipeline cache object
651    */
652   [[nodiscard]] GLES::PipelineCache& GetPipelineCache() const;
653
654   /**
655    * @brief Returns runtime supported GLES version
656    *
657    * @return GLES version enum
658    */
659   GLES::GLESVersion GetGLESVersion() const
660   {
661     return mGLESVersion;
662   }
663
664   /**
665    * @brief Sets runtime supported GLES version
666    *
667    * @param[in] glesVersion The runtime supported GLES version
668    */
669   void SetGLESVersion(GLES::GLESVersion glesVersion)
670   {
671     mGLESVersion = glesVersion;
672   }
673
674   bool IsShuttingDown() const
675   {
676     return mIsShuttingDown;
677   }
678
679   /**
680    * @brief Reset texture cache in the contexts
681    */
682   void ResetTextureCache()
683   {
684     if(mContext)
685     {
686       mContext->GetGLStateCache().ResetTextureCache();
687     }
688
689     for(auto& context : mSurfaceContexts)
690     {
691       if(context.second)
692       {
693         context.second->GetGLStateCache().ResetTextureCache();
694       }
695     }
696   }
697
698   /**
699    * @brief Reset buffer cache in the contexts
700    */
701   void ResetBufferCache()
702   {
703     if(mContext)
704     {
705       mContext->GetGLStateCache().ResetBufferCache();
706     }
707
708     for(auto& context : mSurfaceContexts)
709     {
710       if(context.second)
711       {
712         context.second->GetGLStateCache().ResetBufferCache();
713       }
714     }
715   }
716
717   void ProcessCommandBuffer(const GLES::CommandBuffer& commandBuffer);
718
719   // Resolves presentation
720   void ResolvePresentRenderTarget(GLES::RenderTarget* renderTarget);
721
722   /**
723    * Invoked after all rendering has finished. Used to clean up sync resources
724    */
725   void PostRender();
726
727   /**
728    * Creates a GLES context for the given render surface
729    *
730    * @param[in] surface The surface whose GLES context to be created.
731    */
732   void CreateSurfaceContext(Dali::RenderSurfaceInterface* surface);
733
734   /**
735    * Deletes a GLES context
736    *
737    * @param[in] surface The surface whose GLES context to be deleted.
738    */
739   void DeleteSurfaceContext(Dali::RenderSurfaceInterface* surface);
740
741   /**
742    * Activate the resource context (shared surfaceless context)
743    */
744   void ActivateResourceContext();
745
746   /**
747    * Activate the surface context
748    *
749    * @param[in] surface The surface whose context to be switched to.
750    */
751   void ActivateSurfaceContext(Dali::RenderSurfaceInterface* surface);
752
753   /**
754    * @brief Returns the current context
755    *
756    * @return the current context
757    */
758   GLES::Context* GetCurrentContext() const
759   {
760     return mCurrentContext;
761   }
762
763   /**
764    * @brief Returns EGL shared context
765    *
766    * @return valid EGL shared context
767    */
768   void* GetSharedContext() const
769   {
770     return mSharedContext;
771   }
772
773   GLES::SyncPool& GetSyncPool()
774   {
775     return mSyncPool;
776   }
777
778 private:
779   Integration::GlAbstraction*              mGlAbstraction{nullptr};
780   Integration::GlContextHelperAbstraction* mGlContextHelperAbstraction{nullptr};
781
782   Internal::Adaptor::EglSyncImplementation* mEglSyncImplementation{nullptr};
783   Internal::Adaptor::GraphicsInterface*     mGraphics{nullptr}; // Pointer to owning structure via interface.
784
785   std::queue<GLES::Texture*> mCreateTextureQueue;  ///< Create queue for texture resource
786   std::queue<GLES::Texture*> mDiscardTextureQueue; ///< Discard queue for texture resource
787
788   std::queue<GLES::Buffer*> mCreateBufferQueue;  ///< Create queue for buffer resource
789   std::queue<GLES::Buffer*> mDiscardBufferQueue; ///< Discard queue for buffer resource
790
791   std::queue<GLES::Program*>             mDiscardProgramQueue;       ///< Discard queue for program resource
792   std::queue<GLES::Pipeline*>            mDiscardPipelineQueue;      ///< Discard queue of pipelines
793   std::queue<GLES::RenderPass*>          mDiscardRenderPassQueue;    ///< Discard queue for renderpass resource
794   std::queue<GLES::RenderTarget*>        mDiscardRenderTargetQueue;  ///< Discard queue for rendertarget resource
795   std::queue<GLES::Shader*>              mDiscardShaderQueue;        ///< Discard queue of shaders
796   std::queue<GLES::Sampler*>             mDiscardSamplerQueue;       ///< Discard queue of samplers
797   std::queue<const GLES::CommandBuffer*> mDiscardCommandBufferQueue; ///< Discard queue of command buffers
798   std::queue<GLES::Framebuffer*>         mCreateFramebufferQueue;    ///< Create queue for framebuffer resource
799   std::queue<GLES::Framebuffer*>         mDiscardFramebufferQueue;   ///< Discard queue for framebuffer resource
800
801   std::queue<GLES::CommandBuffer*> mCommandQueue; ///< we may have more in the future
802
803   using TextureUpdateRequest = std::pair<TextureUpdateInfo, TextureUpdateSourceInfo>;
804   std::queue<TextureUpdateRequest> mTextureUpdateRequests;
805
806   std::queue<const GLES::Texture*> mTextureMipmapGenerationRequests; ///< Queue for texture mipmap generation requests
807
808   GLES::Context*                 mCurrentContext{nullptr}; ///< The current context
809   std::unique_ptr<GLES::Context> mContext{nullptr};        ///< Context object handling command buffers execution
810   using SurfaceContextPair = std::pair<Dali::RenderSurfaceInterface*, std::unique_ptr<GLES::Context>>;
811   std::vector<SurfaceContextPair> mSurfaceContexts; ///< Vector of surface context objects handling command buffers execution
812
813   std::unique_ptr<GLES::PipelineCache> mPipelineCache{nullptr}; ///< Internal pipeline cache
814
815   GLES::GLESVersion mGLESVersion{GLES::GLESVersion::GLES_20}; ///< Runtime supported GLES version
816   uint32_t          mTextureUploadTotalCPUMemoryUsed{0u};
817
818   bool mIsShuttingDown{false}; ///< Indicates whether the controller is shutting down
819
820   std::queue<const GLES::CommandBuffer*> mPresentationCommandBuffers{}; ///< Queue of reusable command buffers used by presentation engine
821
822   void* mSharedContext{nullptr}; ///< Shared EGL context
823
824   GLES::TextureDependencyChecker mTextureDependencyChecker; // Checks if FBO textures need syncing
825   GLES::SyncPool                 mSyncPool;
826 };
827
828 } // namespace Graphics
829
830 } // namespace Dali
831
832 #endif //DALI_EGL_GRAPHICS_CONTROLLER_H