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_CREATE_GPU_IMAGES_H 17 #define RENDER_RENDER__NODE__RENDER_NODE_CREATE_GPU_IMAGES_H 18 19 #include <base/containers/string.h> 20 #include <base/containers/vector.h> 21 #include <base/util/uid.h> 22 #include <render/device/gpu_resource_desc.h> 23 #include <render/namespace.h> 24 #include <render/nodecontext/intf_render_node.h> 25 #include <render/render_data_structures.h> 26 #include <render/resource_handle.h> 27 28 RENDER_BEGIN_NAMESPACE() 29 class IRenderCommandList; 30 class IRenderNodeContextManager; 31 struct RenderNodeGraphInputs; 32 33 class RenderNodeCreateGpuImages final : public IRenderNode { 34 public: 35 RenderNodeCreateGpuImages() = default; 36 ~RenderNodeCreateGpuImages() 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 { "9942031e-c80c-4d38-ae08-65555592b4df" }; 44 static constexpr char const* TYPE_NAME = "RenderNodeCreateGpuImages"; 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 struct DependencyList { 51 bool format { false }; 52 bool size { false }; 53 bool mipCount { false }; 54 bool layerCount { false }; 55 bool sampleCount { false }; 56 float sizeScale { 1.0f }; 57 }; 58 59 private: 60 IRenderNodeContextManager* renderNodeContextMgr_ { nullptr }; 61 62 void ParseRenderNodeInputs(); 63 64 struct JsonInputs { 65 BASE_NS::vector<RenderNodeGraphInputs::RenderNodeGraphGpuImageDesc> gpuImageDescs; 66 }; 67 JsonInputs jsonInputs_; 68 69 struct Names { 70 BASE_NS::string globalName; 71 BASE_NS::string shareName; 72 }; 73 BASE_NS::vector<Names> names_; 74 BASE_NS::vector<GpuImageDesc> descs_; 75 BASE_NS::vector<RenderHandleReference> resourceHandles_; 76 77 BASE_NS::vector<RenderHandle> dependencyHandles_; 78 BASE_NS::vector<DependencyList> dependencyList_; 79 }; 80 RENDER_END_NAMESPACE() 81 82 #endif // CORE__RENDER__NODE__RENDER_NODE_CREATE_GPU_IMAGES_H 83