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_STAGING_H 17 #define RENDER_RENDER__NODE__RENDER_NODE_STAGING_H 18 19 #include <render/device/intf_gpu_resource_manager.h> 20 #include <render/namespace.h> 21 #include <render/nodecontext/intf_render_node.h> 22 #include <render/render_data_structures.h> 23 24 #include "device/gpu_resource_manager.h" 25 26 RENDER_BEGIN_NAMESPACE() 27 class IRenderCommandList; 28 class IRenderNodeContextManager; 29 class IRenderNodeGpuResourceManager; 30 struct RenderNodeGraphInputs; 31 struct StagingDirectDataCopyConsumeStruct; 32 33 class RenderNodeStaging final : public IRenderNode { 34 public: 35 RenderNodeStaging() = default; 36 ~RenderNodeStaging() override = default; 37 38 void InitNode(IRenderNodeContextManager& renderNodeContextMgr) override; 39 void PreExecuteFrame() override; 40 void ExecuteFrame(IRenderCommandList& cmdList) override; 41 42 // for plugin / factory interface 43 static constexpr BASE_NS::Uid UID { "22a56820-befb-4e12-83ee-3cad3f685b0a" }; 44 static constexpr char const* TYPE_NAME = "CORE_RN_STAGING"; 45 static constexpr IRenderNode::BackendFlags BACKEND_FLAGS = IRenderNode::BackendFlagBits::BACKEND_FLAG_BITS_DEFAULT; 46 static constexpr IRenderNode::ClassType CLASS_TYPE = IRenderNode::ClassType::CLASS_TYPE_NODE; 47 static IRenderNode* Create(); 48 static void Destroy(IRenderNode* instance); 49 50 private: 51 IRenderNodeContextManager* renderNodeContextMgr_ { nullptr }; 52 53 void CopyHostToStaging( 54 const IRenderNodeGpuResourceManager& gpuResourceMgr, const StagingConsumeStruct& stagingData); 55 void CopyStagingToImages(IRenderCommandList& cmdList, const IRenderNodeGpuResourceManager& gpuResourceMgr, 56 const StagingConsumeStruct& stagingData, const StagingConsumeStruct& renderDataStoreStagingData); 57 void CopyStagingToBuffers(IRenderCommandList& cmdList, const StagingConsumeStruct& stagingData, 58 const StagingConsumeStruct& renderDataStoreStagingData); 59 void CopyImagesToBuffers(IRenderCommandList& cmdList, const IRenderNodeGpuResourceManager& gpuResourceMgr, 60 const StagingConsumeStruct& stagingData, const StagingConsumeStruct& renderDataStoreStagingData); 61 void CopyImagesToImages(IRenderCommandList& cmdList, const IRenderNodeGpuResourceManager& gpuResourceMgr, 62 const StagingConsumeStruct& stagingData, const StagingConsumeStruct& renderDataStoreStagingData); 63 64 BASE_NS::string dataStoreNameStaging_; 65 }; 66 RENDER_END_NAMESPACE() 67 68 #endif // CORE__RENDER__NODE__RENDER_NODE_STAGING_H 69