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 CORE3D_RENDER__NODE__RENDER_COPY_HELPER_H 17 #define CORE3D_RENDER__NODE__RENDER_COPY_HELPER_H 18 19 #include <3d/namespace.h> 20 #include <render/nodecontext/intf_pipeline_descriptor_set_binder.h> 21 #include <render/nodecontext/intf_render_node.h> 22 #include <render/render_data_structures.h> 23 #include <render/resource_handle.h> 24 CORE3D_BEGIN_NAMESPACE()25CORE3D_BEGIN_NAMESPACE() 26 class RenderCopyHelper final { 27 public: 28 RenderCopyHelper() = default; 29 ~RenderCopyHelper() = default; 30 31 struct CopyInfo { 32 RENDER_NS::RenderHandle input; 33 RENDER_NS::RenderHandle output; 34 RENDER_NS::RenderHandle sampler; // if not given linear clamp is used 35 }; 36 void Init(RENDER_NS::IRenderNodeContextManager& renderNodeContextMgr, const CopyInfo& copyInfo); 37 void PreExecute(RENDER_NS::IRenderNodeContextManager& renderNodeContextMgr, const CopyInfo& copyInfo); 38 void Execute(RENDER_NS::IRenderNodeContextManager& renderNodeContextMgr, RENDER_NS::IRenderCommandList& cmdList); 39 40 RENDER_NS::DescriptorCounts GetDescriptorCounts() const; 41 42 private: 43 CopyInfo copyInfo_; 44 struct RenderDataHandles { 45 RENDER_NS::RenderHandle shader; 46 RENDER_NS::PipelineLayout pipelineLayout; 47 RENDER_NS::RenderHandle pso; 48 RENDER_NS::RenderHandle sampler; 49 }; 50 RenderDataHandles renderData_; 51 52 RENDER_NS::IDescriptorSetBinder::Ptr binder_; 53 }; 54 CORE3D_END_NAMESPACE() 55 56 #endif // CORE3D_RENDER__NODE__RENDER_COPY_HELPER_H 57