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__RENDER_NODE_UTIL_H
17 #define RENDER_RENDER__RENDER_NODE_UTIL_H
18 
19 #include <cstdint>
20 
21 #include <base/containers/array_view.h>
22 #include <render/datastore/render_data_store_render_pods.h>
23 #include <render/device/pipeline_state_desc.h>
24 #include <render/namespace.h>
25 #include <render/nodecontext/intf_pipeline_descriptor_set_binder.h>
26 #include <render/nodecontext/intf_render_node_util.h>
27 #include <render/render_data_structures.h>
28 
29 RENDER_BEGIN_NAMESPACE()
30 struct RenderableList;
31 struct PipelineLayout;
32 class IRenderNodeContextManager;
33 
34 class RenderNodeUtil final : public IRenderNodeUtil {
35 public:
36     explicit RenderNodeUtil(IRenderNodeContextManager& renderNodeContextMgr);
37     ~RenderNodeUtil() override = default;
38 
39     RenderNodeHandles::InputRenderPass CreateInputRenderPass(
40         const RenderNodeGraphInputs::InputRenderPass& renderPass) const override;
41     RenderNodeHandles::InputResources CreateInputResources(
42         const RenderNodeGraphInputs::InputResources& inputResources) const override;
43 
44     RenderPass CreateRenderPass(const RenderNodeHandles::InputRenderPass& renderPass) const override;
45     PipelineLayout CreatePipelineLayout(const RenderHandle& shaderHandle) const override;
46 
47     DescriptorCounts GetDescriptorCounts(const PipelineLayout& pipelineLayout) const override;
48     DescriptorCounts GetDescriptorCounts(const BASE_NS::array_view<DescriptorSetLayoutBinding> bindings) const override;
49 
50     IPipelineDescriptorSetBinder::Ptr CreatePipelineDescriptorSetBinder(
51         const PipelineLayout& pipelineLayout) const override;
52 
53     void BindResourcesToBinder(const RenderNodeHandles::InputResources& resources,
54         IPipelineDescriptorSetBinder& pipelineDescriptorSetBinder) const override;
55 
56     ViewportDesc CreateDefaultViewport(const RenderPass& renderPass) const override;
57     ScissorDesc CreateDefaultScissor(const RenderPass& renderPass) const override;
58 
59     RenderPostProcessConfiguration GetRenderPostProcessConfiguration(
60         const PostProcessConfiguration& input) const override;
61     RenderPostProcessConfiguration GetRenderPostProcessConfiguration(
62         const IRenderDataStorePostProcess::GlobalFactors& globalFactors) const override;
63 
64     bool HasChangeableResources(const RenderNodeGraphInputs::InputRenderPass& renderPass) const override;
65     bool HasChangeableResources(const RenderNodeGraphInputs::InputResources& resources) const override;
66 
67 private:
68     IRenderNodeContextManager& renderNodeContextMgr_;
69 };
70 RENDER_END_NAMESPACE()
71 
72 #endif // CORE__RENDER__RENDER_NODE_SCENE_UTIL_H
73