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