[Vulkan] Working build
[platform/core/uifw/dali-core.git] / dali / graphics-api / graphics-api-render-command.h
1 #ifndef DALI_GRAPHICS_API_RENDER_COMMAND_H
2 #define DALI_GRAPHICS_API_RENDER_COMMAND_H
3
4 /*
5  * Copyright (c) 2018 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 <tuple>
23 #include <utility>
24 #include <vector>
25
26 // INTERNAL INCLUDES
27 #include <dali/graphics-api/graphics-api-generic-buffer.h>
28 #include <dali/graphics-api/utility/utility-builder.h>
29 #include <dali/graphics-api/utility/utility-strong-type.h>
30
31 namespace Dali
32 {
33 namespace Graphics
34 {
35 namespace API
36 {
37 using PrimitiveCount = Utility::StrongType<size_t, struct PrimitiveCountTag>;
38 using BufferInfo     = std::unique_ptr<GenericBufferBase>;
39 using BufferList     = Utility::StrongType<std::vector<BufferInfo>, struct BufferListTag>;
40
41 /**
42  * @brief Interface class for RenderCommand types in the graphics API.
43  */
44 class RenderCommand final
45 {
46 public:
47   RenderCommand( PrimitiveCount primitiveCount, BufferList&& bufferList )
48   : mPrimitiveCount{primitiveCount}, mBufferList{std::move( bufferList )}
49   {
50   }
51
52   // derived types should not be moved direcly to prevent slicing
53   RenderCommand( RenderCommand&& ) = default;
54   RenderCommand& operator=( RenderCommand&& ) = default;
55
56   // not copyable
57   RenderCommand( const RenderCommand& ) = delete;
58   RenderCommand& operator=( const RenderCommand& ) = delete;
59
60   ~RenderCommand() = default;
61
62   PrimitiveCount GetPrimitiveCount() const
63   {
64     return mPrimitiveCount;
65   }
66
67   const BufferList& GetBufferList() const
68   {
69     return mBufferList;
70   }
71
72 private:
73   PrimitiveCount mPrimitiveCount;
74   BufferList     mBufferList;
75 };
76
77 using RenderCommandBuilder = Utility::Builder<RenderCommand, PrimitiveCount, BufferList>;
78
79 } // namespace API
80 } // namespace Graphics
81 } // namespace Dali
82
83 #endif // DALI_GRAPHICS_API_RENDER_COMMAND_H