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