[Tizen] Support to get raw pixel informations of framebuffer for old driver device
[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 public: // Framebuffer Capture
317   void CaptureRenderingResult(Graphics::Framebuffer& framebuffer, CallbackBase* capturedCallback, uint8_t* capturedBuffer) override;
318
319 public:
320   [[nodiscard]] Integration::GlAbstraction* GetGL() const
321   {
322     if(mIsShuttingDown)
323     {
324       return nullptr;
325     }
326     return mGlAbstraction;
327   }
328
329   [[nodiscard]] Internal::Adaptor::GraphicsInterface* GetGraphicsInterface() const
330   {
331     return mGraphics;
332   }
333
334   // Internal
335   void AddTexture(GLES::Texture& texture);
336
337   /**
338    * @brief Adds buffer to the creation queue
339    * @param buffer
340    */
341   void AddBuffer(GLES::Buffer& buffer);
342
343   /**
344    * @brief Adds framebuffer to the creation queue
345    * @param buffer
346    */
347   void AddFramebuffer(GLES::Framebuffer& framebuffer);
348
349   /**
350    * @brief Pushes Bufer to the discard queue
351    *
352    * Function is called from the UniquePtr custom deleter.
353    *
354    * @param[in] texture Pointer to the texture
355    */
356   void DiscardResource(GLES::Texture* texture)
357   {
358     mDiscardTextureQueue.push(texture);
359   }
360
361   /**
362    * @brief Pushes Buffer to the discard queue
363    *
364    * Function is called from the UniquePtr custom deleter.
365    *
366    * @param[in] buffer Pointer to the buffer object
367    */
368   void DiscardResource(GLES::Buffer* buffer)
369   {
370     mDiscardBufferQueue.push(buffer);
371   }
372
373   /**
374    * @brief Pushes framebuffer to the discard queue
375    *
376    * Function is called from the UniquePtr custom deleter.
377    *
378    * @param[in] framebuffer Pointer to the framebuffer object
379    */
380   void DiscardResource(GLES::Framebuffer* framebuffer)
381   {
382     mDiscardFramebufferQueue.push(framebuffer);
383   }
384
385   /**
386    * @brief Pushes Program to the discard queue
387    *
388    * Function is called from the UniquePtr custom deleter.
389    *
390    * @param[in] program Pointer to the program
391    */
392   void DiscardResource(GLES::Program* program)
393   {
394     mDiscardProgramQueue.push(program);
395   }
396
397   /**
398    * @brief Pushes RenderPass to the discard queue
399    *
400    * Function is called from the UniquePtr custom deleter.
401    *
402    * @param[in] program Pointer to the RenderPass
403    */
404   void DiscardResource(GLES::RenderPass* renderPass)
405   {
406     mDiscardRenderPassQueue.push(renderPass);
407   }
408
409   /**
410    * @brief Pushes RenderTarget to the discard queue
411    *
412    * Function is called from the UniquePtr custom deleter.
413    *
414    * @param[in] program Pointer to the RenderTarget
415    */
416   void DiscardResource(GLES::RenderTarget* renderTarget)
417   {
418     mDiscardRenderTargetQueue.push(renderTarget);
419   }
420
421   /**
422    * @brief Pushes Shader to the discard queue
423    *
424    * Function is called from the UniquePtr custom deleter.
425    *
426    * @param[in] program Pointer to the Shader
427    */
428   void DiscardResource(GLES::Shader* shader)
429   {
430     mDiscardShaderQueue.push(shader);
431   }
432
433   /**
434    * @brief Pushes CommandBuffer to the discard queue
435    *
436    * Function is called from the UniquePtr custom deleter.
437    *
438    * @param[in] program Pointer to the CommandBuffer
439    */
440   void DiscardResource(GLES::CommandBuffer* commandBuffer)
441   {
442     mDiscardCommandBufferQueue.push(commandBuffer);
443   }
444
445   /**
446    * @brief Pushes Sampler to the discard queue
447    *
448    * Function is called from the UniquePtr custom deleter.
449    *
450    * @param[in] program Pointer to the Sampler
451    */
452   void DiscardResource(GLES::Sampler* sampler)
453   {
454     mDiscardSamplerQueue.push(sampler);
455   }
456
457   /**
458    * @brief Pushes Pipeline to the discard queue
459    *
460    * Function is called from the UniquePtr custom deleter.
461    *
462    * @param[in] program Pointer to the pipeline
463    */
464   void DiscardResource(GLES::Pipeline* pipeline)
465   {
466     mDiscardPipelineQueue.push(pipeline);
467   }
468
469   /**
470    * @brief Flushes all pending updates
471    *
472    * Function flushes all pending resource constructions,
473    * executes command buffers and empties discard queues.
474    */
475   void Flush()
476   {
477     if(!mCreateTextureQueue.empty() ||
478        !mCreateBufferQueue.empty() ||
479        !mCreateFramebufferQueue.empty() ||
480        !mTextureUpdateRequests.empty() ||
481        !mTextureMipmapGenerationRequests.empty())
482     {
483       mGraphics->ActivateResourceContext();
484     }
485
486     // Process creations
487     ProcessCreateQueues();
488
489     // Process updates
490     ProcessTextureUpdateQueue();
491
492     // Process texture mipmap generation requests
493     ProcessTextureMipmapGenerationQueue();
494
495     // Process main command queue
496     ProcessCommandQueues();
497
498     // Reset texture cache in the contexts while destroying textures
499     ResetTextureCache();
500
501     // Reset buffer cache in the contexts while destroying buffers
502     ResetBufferCache();
503
504     // Process discards
505     ProcessDiscardQueues();
506
507     // Flush pipeline cache to remove unused pipelines
508     if(mPipelineCache)
509     {
510       mPipelineCache->FlushCache();
511     }
512   }
513
514   // Test update to tick controller, usually it will run own thread
515   void ProcessDiscardQueues();
516
517   /**
518    * @brief Processes a create queue for type specified
519    *
520    * @param[in,out] queue Reference to the create queue
521    */
522   template<class T>
523   void ProcessCreateQueue(T& queue)
524   {
525     while(!queue.empty())
526     {
527       auto* object = queue.front();
528       queue.pop();
529
530       // Initialize texture
531       if(!object->InitializeResource())
532       {
533         // TODO: handle error
534       }
535     }
536   }
537
538   /**
539    * @brief Processes a discard queue for type specified
540    *
541    * @param[in,out] queue Reference to the discard queue
542    */
543   template<class U, class T>
544   void ProcessDiscardQueue(T& queue)
545   {
546     while(!queue.empty())
547     {
548       auto* object = const_cast<U*>(queue.front());
549
550       // Destroy
551       object->DestroyResource();
552
553       // Free
554       auto* clbk = object->GetCreateInfo().allocationCallbacks;
555       if(clbk)
556       {
557         // Call destructor
558         object->~U();
559
560         // Free memory
561         clbk->freeCallback(object, clbk->userData);
562       }
563       else
564       {
565         delete object;
566       }
567       queue.pop();
568     }
569   }
570
571   /**
572    * @brief Processes a discard queue for pipeline
573    *
574    * @param[in,out] queue Reference to the create queue
575    */
576   void ProcessDiscardQueue(std::queue<GLES::Pipeline*>& queue)
577   {
578     while(!queue.empty())
579     {
580       auto* object = const_cast<GLES::Pipeline*>(queue.front());
581
582       // Inform the contexts to invalidate the pipeline if cached
583       if(mContext)
584       {
585         mContext->InvalidateCachedPipeline(object);
586       }
587
588       for(auto&& context : mSurfaceContexts)
589       {
590         if(context.second)
591         {
592           context.second->InvalidateCachedPipeline(object);
593         }
594       }
595
596       // Destroy
597       object->DestroyResource();
598
599       // Free
600       auto* clbk = object->GetCreateInfo().allocationCallbacks;
601       if(clbk)
602       {
603         // Call destructor
604         using GLESPipeline = GLES::Pipeline;
605         object->~GLESPipeline();
606
607         // Free memory
608         clbk->freeCallback(object, clbk->userData);
609       }
610       else
611       {
612         delete object;
613       }
614       queue.pop();
615     }
616   }
617
618   /**
619    * @brief Processes all resource create queues
620    */
621   void ProcessCreateQueues();
622
623   /**
624    * @brief Process command queues and buffers
625    */
626   void ProcessCommandQueues();
627
628   /**
629    * @brief Executes all pending texture updates
630    */
631   void ProcessTextureUpdateQueue();
632
633   /**
634    * @brief Executes all pending texture mipmap generation
635    */
636   void ProcessTextureMipmapGenerationQueue();
637
638   /**
639    * @brief Returns program custom parameter
640    *
641    * This function can be used as a backdoor in order to retrieve
642    * certain data out of implementation
643    *
644    * @param[in] program Valid Program object
645    * @param parameterId Integer id of parameter
646    * @param outData Output data
647    * @return True if parameter retrieved
648    */
649   bool GetProgramParameter(Graphics::Program& program, uint32_t parameterId, void* outData) override;
650
651   /**
652    * @brief Returns pipeline cache object
653    *
654    * @return Valid pipeline cache object
655    */
656   [[nodiscard]] GLES::PipelineCache& GetPipelineCache() const;
657
658   /**
659    * @brief Returns runtime supported GLES version
660    *
661    * @return GLES version enum
662    */
663   GLES::GLESVersion GetGLESVersion() const
664   {
665     return mGLESVersion;
666   }
667
668   /**
669    * @brief Sets runtime supported GLES version
670    *
671    * @param[in] glesVersion The runtime supported GLES version
672    */
673   void SetGLESVersion(GLES::GLESVersion glesVersion)
674   {
675     mGLESVersion = glesVersion;
676   }
677
678   bool IsShuttingDown() const
679   {
680     return mIsShuttingDown;
681   }
682
683   /**
684    * @brief Reset texture cache in the contexts
685    */
686   void ResetTextureCache()
687   {
688     if(mContext)
689     {
690       mContext->GetGLStateCache().ResetTextureCache();
691     }
692
693     for(auto& context : mSurfaceContexts)
694     {
695       if(context.second)
696       {
697         context.second->GetGLStateCache().ResetTextureCache();
698       }
699     }
700   }
701
702   /**
703    * @brief Reset buffer cache in the contexts
704    */
705   void ResetBufferCache()
706   {
707     if(mContext)
708     {
709       mContext->GetGLStateCache().ResetBufferCache();
710     }
711
712     for(auto& context : mSurfaceContexts)
713     {
714       if(context.second)
715       {
716         context.second->GetGLStateCache().ResetBufferCache();
717       }
718     }
719   }
720
721   void ProcessCommandBuffer(const GLES::CommandBuffer& commandBuffer);
722
723   // Resolves presentation
724   void ResolvePresentRenderTarget(GLES::RenderTarget* renderTarget);
725
726   /**
727    * Invoked after all rendering has finished. Used to clean up sync resources
728    */
729   void PostRender();
730
731   /**
732    * Creates a GLES context for the given render surface
733    *
734    * @param[in] surface The surface whose GLES context to be created.
735    */
736   void CreateSurfaceContext(Dali::RenderSurfaceInterface* surface);
737
738   /**
739    * Deletes a GLES context
740    *
741    * @param[in] surface The surface whose GLES context to be deleted.
742    */
743   void DeleteSurfaceContext(Dali::RenderSurfaceInterface* surface);
744
745   /**
746    * Activate the resource context (shared surfaceless context)
747    */
748   void ActivateResourceContext();
749
750   /**
751    * Activate the surface context
752    *
753    * @param[in] surface The surface whose context to be switched to.
754    */
755   void ActivateSurfaceContext(Dali::RenderSurfaceInterface* surface);
756
757   /**
758    * @brief Returns the current context
759    *
760    * @return the current context
761    */
762   GLES::Context* GetCurrentContext() const
763   {
764     return mCurrentContext;
765   }
766
767   /**
768    * @brief Returns EGL shared context
769    *
770    * @return valid EGL shared context
771    */
772   void* GetSharedContext() const
773   {
774     return mSharedContext;
775   }
776
777   GLES::SyncPool& GetSyncPool()
778   {
779     return mSyncPool;
780   }
781
782 private:
783   Integration::GlAbstraction*              mGlAbstraction{nullptr};
784   Integration::GlContextHelperAbstraction* mGlContextHelperAbstraction{nullptr};
785
786   Internal::Adaptor::EglSyncImplementation* mEglSyncImplementation{nullptr};
787   Internal::Adaptor::GraphicsInterface*     mGraphics{nullptr}; // Pointer to owning structure via interface.
788
789   std::queue<GLES::Texture*> mCreateTextureQueue;  ///< Create queue for texture resource
790   std::queue<GLES::Texture*> mDiscardTextureQueue; ///< Discard queue for texture resource
791
792   std::queue<GLES::Buffer*> mCreateBufferQueue;  ///< Create queue for buffer resource
793   std::queue<GLES::Buffer*> mDiscardBufferQueue; ///< Discard queue for buffer resource
794
795   std::queue<GLES::Program*>             mDiscardProgramQueue;       ///< Discard queue for program resource
796   std::queue<GLES::Pipeline*>            mDiscardPipelineQueue;      ///< Discard queue of pipelines
797   std::queue<GLES::RenderPass*>          mDiscardRenderPassQueue;    ///< Discard queue for renderpass resource
798   std::queue<GLES::RenderTarget*>        mDiscardRenderTargetQueue;  ///< Discard queue for rendertarget resource
799   std::queue<GLES::Shader*>              mDiscardShaderQueue;        ///< Discard queue of shaders
800   std::queue<GLES::Sampler*>             mDiscardSamplerQueue;       ///< Discard queue of samplers
801   std::queue<const GLES::CommandBuffer*> mDiscardCommandBufferQueue; ///< Discard queue of command buffers
802   std::queue<GLES::Framebuffer*>         mCreateFramebufferQueue;    ///< Create queue for framebuffer resource
803   std::queue<GLES::Framebuffer*>         mDiscardFramebufferQueue;   ///< Discard queue for framebuffer resource
804
805   std::queue<GLES::CommandBuffer*> mCommandQueue; ///< we may have more in the future
806
807   using TextureUpdateRequest = std::pair<TextureUpdateInfo, TextureUpdateSourceInfo>;
808   std::queue<TextureUpdateRequest> mTextureUpdateRequests;
809
810   std::queue<const GLES::Texture*> mTextureMipmapGenerationRequests; ///< Queue for texture mipmap generation requests
811
812   GLES::Context*                 mCurrentContext{nullptr}; ///< The current context
813   std::unique_ptr<GLES::Context> mContext{nullptr};        ///< Context object handling command buffers execution
814   using SurfaceContextPair = std::pair<Dali::RenderSurfaceInterface*, std::unique_ptr<GLES::Context>>;
815   std::vector<SurfaceContextPair> mSurfaceContexts; ///< Vector of surface context objects handling command buffers execution
816
817   std::unique_ptr<GLES::PipelineCache> mPipelineCache{nullptr}; ///< Internal pipeline cache
818
819   GLES::GLESVersion mGLESVersion{GLES::GLESVersion::GLES_20}; ///< Runtime supported GLES version
820   uint32_t          mTextureUploadTotalCPUMemoryUsed{0u};
821
822   bool mIsShuttingDown{false}; ///< Indicates whether the controller is shutting down
823
824   std::queue<const GLES::CommandBuffer*> mPresentationCommandBuffers{}; ///< Queue of reusable command buffers used by presentation engine
825
826   void* mSharedContext{nullptr}; ///< Shared EGL context
827
828   GLES::TextureDependencyChecker mTextureDependencyChecker; // Checks if FBO textures need syncing
829   GLES::SyncPool                 mSyncPool;
830 };
831
832 } // namespace Graphics
833
834 } // namespace Dali
835
836 #endif //DALI_EGL_GRAPHICS_CONTROLLER_H