• 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_FULLSCREEN_GENERIC_H
17 #define RENDER_NODE_RENDER_NODE_FULLSCREEN_GENERIC_H
18 
19 #include <base/util/uid.h>
20 #include <render/device/intf_shader_manager.h>
21 #include <render/namespace.h>
22 #include <render/nodecontext/intf_pipeline_descriptor_set_binder.h>
23 #include <render/nodecontext/intf_render_node.h>
24 #include <render/render_data_structures.h>
25 #include <render/resource_handle.h>
26 
27 RENDER_BEGIN_NAMESPACE()
28 class IRenderCommandList;
29 struct RenderNodeGraphInputs;
30 
31 class RenderNodeFullscreenGeneric final : public IRenderNode {
32 public:
33     RenderNodeFullscreenGeneric() = default;
34     ~RenderNodeFullscreenGeneric() override = default;
35 
36     void InitNode(IRenderNodeContextManager& renderNodeContextMgr) override;
37     void PreExecuteFrame() override;
38     void ExecuteFrame(IRenderCommandList& cmdList) override;
GetExecuteFlags()39     ExecuteFlags GetExecuteFlags() const override
40     {
41         return 0U;
42     }
43 
44     // for plugin / factory interface
45     static constexpr BASE_NS::Uid UID { "ea17a490-c3b7-453a-851f-79a20e324159" };
46     static constexpr const char* TYPE_NAME = "RenderNodeFullscreenGeneric";
47     static constexpr IRenderNode::BackendFlags BACKEND_FLAGS = IRenderNode::BackendFlagBits::BACKEND_FLAG_BITS_DEFAULT;
48     static constexpr IRenderNode::ClassType CLASS_TYPE = IRenderNode::ClassType::CLASS_TYPE_NODE;
49     static IRenderNode* Create();
50     static void Destroy(IRenderNode* instance);
51 
52 private:
53     IRenderNodeContextManager* renderNodeContextMgr_ { nullptr };
54 
55     void ParseRenderNodeInputs();
56     RenderHandle GetPsoHandle();
57 
58     // Json resources which might need re-fetching
59     struct JsonInputs {
60         RenderNodeGraphInputs::InputRenderPass renderPass;
61         RenderNodeGraphInputs::InputResources resources;
62 
63         RenderNodeGraphInputs::RenderDataStore renderDataStore;
64         RenderNodeGraphInputs::RenderDataStore renderDataStoreSpecialization;
65 
66         bool hasChangeableRenderPassHandles { false };
67         bool hasChangeableResourceHandles { false };
68     };
69     JsonInputs jsonInputs_;
70 
71     RenderNodeHandles::InputRenderPass inputRenderPass_;
72     RenderNodeHandles::InputResources inputResources_;
73     struct PipelineData {
74         IShaderManager::GraphicsShaderData gsd;
75         RenderHandle pso;
76     };
77     PipelineData pipelineData_;
78 
79     // data store push constant
80     bool useDataStorePushConstant_ { false };
81 
82     // data store shader specialization
83     bool useDataStoreShaderSpecialization_ { false };
84     struct ShaderSpecilizationData {
85         BASE_NS::vector<ShaderSpecialization::Constant> constants;
86         BASE_NS::vector<uint32_t> data;
87     };
88     ShaderSpecilizationData shaderSpecializationData_;
89 
90     IPipelineDescriptorSetBinder::Ptr pipelineDescriptorSetBinder_;
91 };
92 RENDER_END_NAMESPACE()
93 
94 #endif // CORE__RENDER__NODE__RENDER_NODE_FULLSCREEN_GENERIC_H
95