[Vulkan] Basic Vulkan backend
[platform/core/uifw/dali-core.git] / dali / graphics / vulkan / vulkan-command-pool.h
1 #ifndef DALI_GRAPHICS_VULKAN_COMMANDPOOL
2 #define DALI_GRAPHICS_VULKAN_COMMANDPOOL
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 // INTERNAL INCLUDES
22 #include <dali/graphics/vulkan/vulkan-types.h>
23
24 namespace Dali
25 {
26 namespace Graphics
27 {
28 namespace Vulkan
29 {
30
31 class Graphics;
32 class CommandBuffer;
33
34 using CommandPoolHandle = Handle<class CommandPool>;
35
36 class CommandPool : public VkManaged
37 {
38
39 public:
40
41   /**
42    *
43    * @param graphics
44    * @param createInfo
45    * @return
46    */
47   static CommandPoolHandle New( Graphics& graphics, const vk::CommandPoolCreateInfo& createInfo );
48
49   /**
50    *
51    * @param graphics
52    * @return
53    */
54   static CommandPoolHandle New( Graphics& graphics );
55
56   ~CommandPool() override;
57
58   /**
59    *
60    * @return
61    */
62   vk::CommandPool GetPool() const;
63
64   /**
65    *
66    * @return
67    */
68   Graphics& GetGraphics() const;
69
70   /**
71    *
72    * @param allocateInfo
73    * @return
74    */
75   Handle<CommandBuffer> NewCommandBuffer( const vk::CommandBufferAllocateInfo& allocateInfo );
76
77   /**
78    *
79    * @param isPrimary
80    * @return
81    */
82   Handle<CommandBuffer> NewCommandBuffer( bool isPrimary = true );
83
84 public:
85
86   bool OnDestroy() override;
87
88 private:
89
90   CommandPool();
91
92   CommandPool( Graphics& graphics, const vk::CommandPoolCreateInfo& createInfo );
93
94   class Impl;
95   std::unique_ptr<Impl> mImpl;
96
97 };
98
99
100 } // namespace Vulkan
101 } // namespace Graphics
102 } // namespace Dali
103
104 #endif // DALI_GRAPHICS_VULKAN_COMMANDPOOL