• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef API_RENDER_IRENDER_DATA_STORE_RENDER_POST_PROCESSES_H
17 #define API_RENDER_IRENDER_DATA_STORE_RENDER_POST_PROCESSES_H
18 
19 #include <cstdint>
20 
21 #include <base/containers/array_view.h>
22 #include <base/containers/vector.h>
23 #include <base/math/vector.h>
24 #include <base/util/uid.h>
25 #include <render/datastore/intf_render_data_store.h>
26 #include <render/namespace.h>
27 #include <render/nodecontext/intf_render_post_process.h>
28 
RENDER_BEGIN_NAMESPACE()29 RENDER_BEGIN_NAMESPACE()
30 /** @ingroup group_render_irenderdatastorerenderpostprocesses */
31 /** IRenderDataStoreRenderPostProcesses interface.
32  * Internally synchronized.
33  *
34  * Post process mapper for rendering
35  * One needs to Implement IRenderPostProcess interface
36  *
37  * Usage:
38  * AddData() from client side.
39  * GetData() in render node.
40  * Data needs to be added every frame (cleared automatically)
41  */
42 class IRenderDataStoreRenderPostProcesses : public IRenderDataStore {
43 public:
44     static constexpr BASE_NS::Uid UID { "ae33858f-31f9-4c8b-9386-5d542a9ee018" };
45 
46     struct PostProcessData {
47         /** Unique id for the post process effect
48          * Use the same every frame
49          * There can multiple post processes with the same post process with different id
50          * There can be multiple post processes with the same post process with the same id
51          */
52         uint64_t id { ~0ULL };
53         /** Post process effect interface pointer
54          */
55         IRenderPostProcess::Ptr postProcess;
56     };
57     /** Container for post process pipeline
58      */
59     struct PostProcessPipeline {
60         /** All post processes
61          */
62         BASE_NS::vector<PostProcessData> postProcesses;
63     };
64 
65     /** Add data for rendering
66      * @param data All render post processes.
67      */
68     virtual void AddData(BASE_NS::string_view name, BASE_NS::array_view<const PostProcessData> data) = 0;
69 
70     /** Get all rendering data.
71      * @param name Name of the post process pipeline
72      * @return Returns post process pipeline for the given name
73      */
74     virtual PostProcessPipeline GetData(BASE_NS::string_view name) const = 0;
75 
76 protected:
77     virtual ~IRenderDataStoreRenderPostProcesses() override = default;
78     IRenderDataStoreRenderPostProcesses() = default;
79 };
80 RENDER_END_NAMESPACE()
81 
82 #endif // API_RENDER_IRENDER_DATA_STORE_RENDER_POST_PROCESSES_H
83