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