[Vulkan] Basic Vulkan backend
[platform/core/uifw/dali-core.git] / dali / graphics / vulkan / gpu-memory / vulkan-gpu-memory-manager.h
1 #ifndef DALI_VULKAN_161117_GPU_MEMORY_MANAGER_H
2 #define DALI_VULKAN_161117_GPU_MEMORY_MANAGER_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 #include <dali/graphics/vulkan/vulkan-types.h>
22
23 namespace Dali
24 {
25 namespace Graphics
26 {
27 namespace Vulkan
28 {
29 using GpuMemoryAllocatorUID = uint32_t;
30 class Graphics;
31 class GpuMemoryAllocator;
32
33 class GpuMemoryManager
34 {
35 public:
36
37   static std::unique_ptr<GpuMemoryManager> New( Graphics& graphics );
38
39   /**
40    *
41    */
42   ~GpuMemoryManager();
43
44   /**
45    *
46    * @return
47    */
48   GpuMemoryAllocator& GetDefaultAllocator() const;
49
50   /**
51    *
52    * @param allocator
53    * @return
54    */
55   GpuMemoryAllocatorUID RegisterAllocator( std::unique_ptr<GpuMemoryAllocator> allocator );
56
57   /**
58    *
59    * @param allocatorHandle
60    * @return
61    */
62   bool UnregisterAllocator( GpuMemoryAllocatorUID allocatorHandle );
63
64   /**
65    *
66    * @return
67    */
68   Graphics& GetGraphics() const;
69
70 private:
71
72   GpuMemoryManager();
73
74   /**
75    *
76    */
77   GpuMemoryManager( Graphics& graphics );
78
79 private:
80
81   class Impl;
82   std::unique_ptr<Impl> mImpl;
83 };
84
85 }
86
87 }
88
89 }
90
91 #endif //DALI_VULKAN_161117_GPU_MEMORY_MANAGER_H