[Vulkan] Basic Vulkan backend
[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
31 // frame buffer id
32 using FBID = uint32_t;
33
34 namespace Vulkan
35 {
36 class Graphics;
37 } // Vulkan
38 using GraphicsImpl = Vulkan::Graphics;
39
40 } // Graphics
41
42 namespace Integration
43 {
44 namespace Graphics
45 {
46 class SurfaceFactory;
47 class EXPORT_API Graphics final
48 {
49 public:
50
51
52   Graphics();
53   ~Graphics();
54
55   /**
56    *
57    * @param surfaceFactory
58    * @return
59    */
60   Dali::Graphics::FBID CreateSurface( std::unique_ptr<Dali::Integration::Graphics::SurfaceFactory> surfaceFactory );
61
62
63   /**
64    * When creating Graphics at least one surfaceFactory must be supplied ( no headless mode )
65    * @param surfaceFactory
66    * @return
67    */
68   Dali::Graphics::FBID Create( std::unique_ptr<Dali::Integration::Graphics::SurfaceFactory> surfaceFactory );
69
70   /**
71    * Prerender
72    */
73   void PreRender( Dali::Graphics::FBID framebufferId = 0u );
74
75   /*
76    * Postrender
77    */
78   void PostRender( Dali::Graphics::FBID framebufferId = 0u );
79
80   // this function is used only by the standalone test
81   template <class T>
82   T& GetImplementation() const
83   {
84     return static_cast<T&>(*mGraphicsImpl.get());
85   }
86
87 private:
88
89   std::unique_ptr<Dali::Graphics::GraphicsImpl> mGraphicsImpl;
90 };
91
92
93
94 /**
95  * fixme: dummy function to make sure the static library won't be discarded entirely during linking
96  */
97 EXPORT_API void IncludeThisLibrary();
98
99 } // Namespace Graphics
100 } // Namespace Integration
101 } // Namespace Dali
102
103 #endif // DALI_INTEGRATION_GRAPHICS_H