Using custom graphics deleter in test harness
[platform/core/uifw/dali-adaptor.git] / dali / internal / graphics / gles / 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 #include <dali/graphics-api/graphics-controller.h>
21
22 namespace Dali
23 {
24 namespace Integration
25 {
26 class GlAbstraction;
27 class GlSyncAbstraction;
28 class GlContextHelperAbstraction;
29 } // namespace Integration
30
31 namespace Graphics
32 {
33 /**
34  * EGL Implementation of the graphics controller.
35  *
36  * Temporarily holds the old GL abstractions whilst dali-core is migrated to the new API.
37  */
38 DALI_IMPORT_API class EglGraphicsController : public Graphics::Controller
39 {
40 public:
41   EglGraphicsController() = default;
42
43   ~EglGraphicsController() override = default;
44
45   /**
46    * Initialize the GLES abstraction. This can be called from the main thread.
47    */
48   void InitializeGLES(Integration::GlAbstraction& glAbstraction);
49
50   /**
51    * Initialize with a reference to the GL abstractions.
52    *
53    * Note, this is now executed in the render thread, after core initialization
54    */
55   void Initialize(Integration::GlSyncAbstraction&          glSyncAbstraction,
56                   Integration::GlContextHelperAbstraction& glContextHelperAbstraction);
57
58   Integration::GlAbstraction&              GetGlAbstraction() override;
59   Integration::GlSyncAbstraction&          GetGlSyncAbstraction() override;
60   Integration::GlContextHelperAbstraction& GetGlContextHelperAbstraction() override;
61
62   /**
63    * @copydoc Dali::Graphics::SubmitCommandBuffers()
64    */
65   void SubmitCommandBuffers(const SubmitInfo& submitInfo) override
66   {
67   }
68
69   /**
70    * @copydoc Dali::Graphics::PresentRenderTarget()
71    */
72   void PresentRenderTarget(RenderTarget* renderTarget) override
73   {
74   }
75
76   /**
77    * @copydoc Dali::Graphics::WaitIdle()
78    */
79   void WaitIdle() override
80   {
81   }
82
83   /**
84    * @copydoc Dali::Graphics::Pause()
85    */
86   void Pause() override
87   {
88   }
89
90   /**
91    * @copydoc Dali::Graphics::Resume()
92    */
93   void Resume() override
94   {
95   }
96
97   /**
98    * @copydoc Dali::Graphics::UpdateTextures()
99    */
100   void UpdateTextures(const std::vector<TextureUpdateInfo>&       updateInfoList,
101                       const std::vector<TextureUpdateSourceInfo>& sourceList) override
102   {
103   }
104
105   /**
106    * @copydoc Dali::Graphics::EnableDepthStencilBuffer()
107    */
108   bool EnableDepthStencilBuffer(bool enableDepth, bool enableStencil) override
109   {
110     return {};
111   }
112
113   /**
114    * @copydoc Dali::Graphics::RunGarbageCollector()
115    */
116   void RunGarbageCollector(size_t numberOfDiscardedRenderers) override
117   {
118   }
119
120   /**
121    * @copydoc Dali::Graphics::DiscardUnusedResources()
122    */
123   void DiscardUnusedResources() override
124   {
125   }
126
127   /**
128    * @copydoc Dali::Graphics::IsDiscardQueueEmpty()
129    */
130   bool IsDiscardQueueEmpty() override
131   {
132     return {};
133   }
134
135   /**
136    * @copydoc Dali::Graphics::IsDrawOnResumeRequired()
137    */
138   bool IsDrawOnResumeRequired() override
139   {
140     return {};
141   }
142
143   /**
144    * @copydoc Dali::Graphics::CreateBuffer()
145    */
146   Graphics::UniquePtr<Buffer> CreateBuffer(const BufferCreateInfo& bufferCreateInfo, Graphics::UniquePtr<Buffer>&& oldBuffer) override
147   {
148     return nullptr;
149   }
150
151   /**
152    * @copydoc Dali::Graphics::CreateCommandBuffer()
153    */
154   Graphics::UniquePtr<CommandBuffer> CreateCommandBuffer(const CommandBufferCreateInfo& commandBufferCreateInfo, Graphics::UniquePtr<CommandBuffer>&& oldCommandBuffer) override
155   {
156     return nullptr;
157   }
158
159   /**
160    * @copydoc Dali::Graphics::CreateRenderPass()
161    */
162   Graphics::UniquePtr<RenderPass> CreateRenderPass(const RenderPassCreateInfo& renderPassCreateInfo, Graphics::UniquePtr<RenderPass>&& oldRenderPass) override
163   {
164     return nullptr;
165   }
166
167   /**
168    * @copydoc Dali::Graphics::CreateTexture()
169    */
170   Graphics::UniquePtr<Texture> CreateTexture(const TextureCreateInfo& textureCreateInfo, Graphics::UniquePtr<Texture>&& oldTexture) override
171   {
172     return nullptr;
173   }
174
175   /**
176    * @copydoc Dali::Graphics::CreateFramebuffer()
177    */
178   Graphics::UniquePtr<Framebuffer> CreateFramebuffer(const FramebufferCreateInfo& framebufferCreateInfo, Graphics::UniquePtr<Framebuffer>&& oldFramebuffer) override
179   {
180     return nullptr;
181   }
182
183   /**
184    * @copydoc Dali::Graphics::CreatePipeline()
185    */
186   Graphics::UniquePtr<Pipeline> CreatePipeline(const PipelineCreateInfo& pipelineCreateInfo, Graphics::UniquePtr<Pipeline>&& oldPipeline) override
187   {
188     return nullptr;
189   }
190
191   /**
192    * @copydoc Dali::Graphics::CreateShader()
193    */
194   Graphics::UniquePtr<Shader> CreateShader(const ShaderCreateInfo& shaderCreateInfo, Graphics::UniquePtr<Shader>&& oldShader) override
195   {
196     return nullptr;
197   }
198
199   /**
200    * @copydoc Dali::Graphics::CreateSampler()
201    */
202   Graphics::UniquePtr<Sampler> CreateSampler(const SamplerCreateInfo& samplerCreateInfo, Graphics::UniquePtr<Sampler>&& oldSampler) override
203   {
204     return nullptr;
205   }
206
207   /**
208    * @copydoc Dali::Graphics::CreateRenderTarget()
209    */
210   Graphics::UniquePtr<RenderTarget> CreateRenderTarget(const RenderTargetCreateInfo& renderTargetCreateInfo, Graphics::UniquePtr<RenderTarget>&& oldRenderTarget) override
211   {
212     return nullptr;
213   }
214
215   /**
216    * @copydoc Dali::Graphics::MapBufferRange()
217    */
218   Graphics::UniquePtr<Memory> MapBufferRange(const MapBufferInfo& mapInfo) override
219   {
220     return nullptr;
221   }
222
223   /**
224    * @copydoc Dali::Graphics::MapTextureRange()
225    */
226   Graphics::UniquePtr<Memory> MapTextureRange(const MapTextureInfo& mapInfo) override
227   {
228     return nullptr;
229   }
230
231   /**
232    * @copydoc Dali::Graphics::UnmapMemory()
233    */
234   void UnmapMemory(Graphics::UniquePtr<Memory> memory) override
235   {
236   }
237   /**
238    * @copydoc Dali::Graphics::GetTextureMemoryRequirements()
239    */
240   MemoryRequirements GetTextureMemoryRequirements(Texture& texture) const override
241   {
242     return {};
243   }
244
245   /**
246    * @copydoc Dali::Graphics::GetBufferMemoryRequirements()
247    */
248   MemoryRequirements GetBufferMemoryRequirements(Buffer& buffer) const override
249   {
250     return {};
251   }
252
253   /**
254    * @copydoc Dali::Graphics::GetTextureProperties()
255    */
256   const TextureProperties& GetTextureProperties(const Texture& texture) override
257   {
258     // for compiler not to moan
259     static TextureProperties dummy{};
260     return dummy;
261   }
262
263   /**
264    * @copydoc Dali::Graphics::PipelineEquals()
265    */
266   [[nodiscard]] bool PipelineEquals(const Pipeline& pipeline0, const Pipeline& pipeline1) const override
267   {
268     return {};
269   }
270
271   [[nodiscard]] Integration::GlAbstraction* GetGL() const
272   {
273     return mGlAbstraction;
274   }
275
276 private:
277   Integration::GlAbstraction*              mGlAbstraction{nullptr};
278   Integration::GlSyncAbstraction*          mGlSyncAbstraction{nullptr};
279   Integration::GlContextHelperAbstraction* mGlContextHelperAbstraction{nullptr};
280 };
281
282 } // namespace Graphics
283
284 } // namespace Dali
285
286 #endif //DALI_EGL_GRAPHICS_CONTROLLER_H