• 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 RENDER_NODE_RENDER_NODE_BLOOM_H
17 #define RENDER_NODE_RENDER_NODE_BLOOM_H
18 
19 #include <postprocesses/render_post_process_bloom_node.h>
20 
21 #include <base/util/uid.h>
22 #include <render/datastore/render_data_store_render_pods.h>
23 #include <render/namespace.h>
24 #include <render/nodecontext/intf_render_node.h>
25 #include <render/nodecontext/intf_render_post_process.h>
26 #include <render/nodecontext/intf_render_post_process_node.h>
27 #include <render/render_data_structures.h>
28 
29 RENDER_BEGIN_NAMESPACE()
30 class IRenderCommandList;
31 class IRenderNodeContextManager;
32 class IPipelineDescriptorSetBinder;
33 class IRenderNodeRenderDataStoreManager;
34 struct RenderNodeGraphInputs;
35 
36 class RenderNodeBloom final : public IRenderNode {
37 public:
38     RenderNodeBloom() = default;
39     ~RenderNodeBloom() override = default;
40 
41     void InitNode(IRenderNodeContextManager& renderNodeContextMgr) override;
42     void PreExecuteFrame() override;
43     void ExecuteFrame(IRenderCommandList& cmdList) override;
44 
45     ExecuteFlags GetExecuteFlags() const override;
46 
47     // for plugin / factory interface
48     static constexpr BASE_NS::Uid UID { "cc25f8bd-bad6-48f9-8cb2-af24681643b6" };
49     static constexpr const char* TYPE_NAME = "RenderNodeBloom";
50     static constexpr IRenderNode::BackendFlags BACKEND_FLAGS = IRenderNode::BackendFlagBits::BACKEND_FLAG_BITS_DEFAULT;
51     static constexpr IRenderNode::ClassType CLASS_TYPE = IRenderNode::ClassType::CLASS_TYPE_NODE;
52     static IRenderNode* Create();
53     static void Destroy(IRenderNode* instance);
54 
55 private:
56     IRenderNodeContextManager* renderNodeContextMgr_ { nullptr };
57 
58     void ParseRenderNodeInputs();
59     void CreatePostProcessInterface();
60     void ProcessPostProcessConfiguration(const IRenderNodeRenderDataStoreManager& dataStoreMgr);
61 
62     // Json resources which might need re-fetching
63     struct JsonInputs {
64         RenderNodeGraphInputs::InputResources resources;
65         RenderNodeGraphInputs::RenderDataStore renderDataStore;
66 
67         bool hasChangeableResourceHandles { false };
68     };
69     JsonInputs jsonInputs_;
70     RenderNodeHandles::InputRenderPass inputRenderPass_;
71     RenderNodeHandles::InputResources inputResources_;
72 
73     struct PostProcessInterfaces {
74         IRenderPostProcess::Ptr postProcess;
75         IRenderPostProcessNode::Ptr postProcessNode;
76     };
77     PostProcessInterfaces ppRenderBloomInterface_;
78 
79     PostProcessConfiguration ppConfig_;
80 
81     bool valid_ { false };
82 };
83 RENDER_END_NAMESPACE()
84 
85 #endif // RENDER_NODE_RENDER_NODE_BLOOM_H
86