1 /* 2 * Copyright (C) 2023 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; 38 39 // for plugin / factory interface 40 static constexpr BASE_NS::Uid UID { "ea17a490-c3b7-453a-851f-79a20e324159" }; 41 static constexpr char const* TYPE_NAME = "RenderNodeFullscreenGeneric"; 42 static constexpr IRenderNode::BackendFlags BACKEND_FLAGS = IRenderNode::BackendFlagBits::BACKEND_FLAG_BITS_DEFAULT; 43 static constexpr IRenderNode::ClassType CLASS_TYPE = IRenderNode::ClassType::CLASS_TYPE_NODE; 44 static IRenderNode* Create(); 45 static void Destroy(IRenderNode* instance); 46 47 private: 48 IRenderNodeContextManager* renderNodeContextMgr_ { nullptr }; 49 50 void ParseRenderNodeInputs(); 51 RenderHandle GetPsoHandle(IRenderNodeContextManager& renderNodeContextMgr); 52 53 // Json resources which might need re-fetching 54 struct JsonInputs { 55 RenderNodeGraphInputs::InputRenderPass renderPass; 56 RenderNodeGraphInputs::InputResources resources; 57 58 RenderNodeGraphInputs::RenderDataStore renderDataStore; 59 RenderNodeGraphInputs::RenderDataStore renderDataStoreSpecialization; 60 61 bool hasChangeableRenderPassHandles { false }; 62 bool hasChangeableResourceHandles { false }; 63 }; 64 JsonInputs jsonInputs_; 65 66 RenderNodeHandles::InputRenderPass inputRenderPass_; 67 RenderNodeHandles::InputResources inputResources_; 68 RenderHandle shader_; 69 PipelineLayout pipelineLayout_; 70 RenderHandle psoHandle_; 71 72 // data store push constant 73 bool useDataStorePushConstant_ { false }; 74 75 // data store shader specialization 76 bool useDataStoreShaderSpecialization_ { false }; 77 struct ShaderSpecilizationData { 78 BASE_NS::vector<ShaderSpecialization::Constant> constants; 79 BASE_NS::vector<uint32_t> data; 80 }; 81 ShaderSpecilizationData shaderSpecializationData_; 82 83 IPipelineDescriptorSetBinder::Ptr pipelineDescriptorSetBinder_; 84 }; 85 RENDER_END_NAMESPACE() 86 87 #endif // CORE__RENDER__NODE__RENDER_NODE_FULLSCREEN_GENERIC_H 88