[Vulkan] Image and Swapchain upgrade
[platform/core/uifw/dali-core.git] / dali / integration-api / graphics / graphics.h
1 #ifndef DALI_INTEGRATION_GRAPHICS_H
2 #define DALI_INTEGRATION_GRAPHICS_H
3
4 /*
5  * Copyright (c) 2017 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
21 // EXTERNAL INCLUDES
22 #include <memory>
23
24 #define EXPORT_API __attribute__ ((visibility ("default")))
25
26 namespace Dali
27 {
28 namespace Graphics
29 {
30 namespace API
31 {
32 class Controller;
33 }
34 // frame buffer id
35 using FBID = int32_t;
36
37 namespace Vulkan
38 {
39 class Graphics;
40 } // Vulkan
41 using GraphicsImpl = Vulkan::Graphics;
42
43 } // Graphics
44
45 namespace Integration
46 {
47 namespace Graphics
48 {
49 class SurfaceFactory;
50 class EXPORT_API Graphics final
51 {
52 public:
53
54
55   Graphics();
56   ~Graphics();
57
58   /**
59    *
60    * @param surfaceFactory
61    * @return
62    */
63   Dali::Graphics::FBID CreateSurface( std::unique_ptr<Dali::Integration::Graphics::SurfaceFactory> surfaceFactory );
64
65
66   /**
67    * When creating Graphics at least one surfaceFactory must be supplied ( no headless mode )
68    * @param surfaceFactory
69    * @return
70    */
71   Dali::Graphics::FBID Create( std::unique_ptr<Dali::Integration::Graphics::SurfaceFactory> surfaceFactory );
72
73   /**
74    * Prerender
75    */
76   void PreRender( Dali::Graphics::FBID framebufferId = 0u );
77
78   /*
79    * Postrender
80    */
81   void PostRender( Dali::Graphics::FBID framebufferId = 0u );
82
83   /**
84    * Returns controller object
85    * @return
86    */
87   Dali::Graphics::API::Controller& GetController();
88
89   // this function is used only by the standalone test
90   template <class T>
91   T& GetImplementation() const
92   {
93     return static_cast<T&>(*mGraphicsImpl.get());
94   }
95
96 private:
97
98   std::unique_ptr<Dali::Graphics::GraphicsImpl> mGraphicsImpl;
99 };
100
101
102
103 /**
104  * fixme: dummy function to make sure the static library won't be discarded entirely during linking
105  */
106 EXPORT_API void IncludeThisLibrary();
107
108 } // Namespace Graphics
109 } // Namespace Integration
110 } // Namespace Dali
111
112 #endif // DALI_INTEGRATION_GRAPHICS_H