• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 CORE__RENDER__NODE__RENDER_NODE_CREATE_DEFAULT_CAMERA_GPU_IMAGES_H
17 #define CORE__RENDER__NODE__RENDER_NODE_CREATE_DEFAULT_CAMERA_GPU_IMAGES_H
18 
19 #include <base/containers/string.h>
20 #include <base/containers/vector.h>
21 #include <base/util/uid.h>
22 #include <core/namespace.h>
23 #include <render/device/gpu_resource_desc.h>
24 #include <render/nodecontext/intf_render_node.h>
25 #include <render/resource_handle.h>
26 
27 #include "render/render_node_scene_util.h"
28 
CORE3D_BEGIN_NAMESPACE()29 CORE3D_BEGIN_NAMESPACE()
30 class RenderNodeCreateDefaultCameraGpuImages final : public RENDER_NS::IRenderNode {
31 public:
32     RenderNodeCreateDefaultCameraGpuImages() = default;
33     ~RenderNodeCreateDefaultCameraGpuImages() override = default;
34 
35     void InitNode(RENDER_NS::IRenderNodeContextManager& renderNodeContextMgr) override;
36     void PreExecuteFrame() override;
37     void ExecuteFrame(RENDER_NS::IRenderCommandList& cmdList) override {};
38     ExecuteFlags GetExecuteFlags() const override
39     {
40         // no work in execute
41         return IRenderNode::ExecuteFlagBits::EXECUTE_FLAG_BITS_DO_NOT_EXECUTE;
42     }
43 
44     // for plugin / factory interface
45     static constexpr BASE_NS::Uid UID { "c694a5bd-c6f6-4167-9b61-cf481632c171" };
46     static constexpr char const* TYPE_NAME = "RenderNodeCreateDefaultCameraGpuImages";
47     static constexpr IRenderNode::BackendFlags BACKEND_FLAGS = IRenderNode::BackendFlagBits::BACKEND_FLAG_BITS_DEFAULT;
48     static constexpr IRenderNode::ClassType CLASS_TYPE = IRenderNode::ClassType::CLASS_TYPE_NODE;
49     static IRenderNode* Create();
50     static void Destroy(IRenderNode* instance);
51 
52 private:
53     void ParseRenderNodeInputs();
54     void UpdateRenderTargets();
55 
56     RENDER_NS::IRenderNodeContextManager* renderNodeContextMgr_ { nullptr };
57 
58     static constexpr uint64_t INVALID_CAM_ID { 0xFFFFFFFFffffffff };
59     struct JsonInputs {
60         BASE_NS::vector<RENDER_NS::RenderNodeGraphInputs::RenderNodeGraphGpuImageDesc> gpuImageDescs;
61 
62         BASE_NS::string customCameraName;
63         uint64_t customCameraId { INVALID_CAM_ID };
64     };
65     JsonInputs jsonInputs_;
66 
67     SceneRenderDataStores stores_;
68 
69     BASE_NS::vector<RENDER_NS::RenderNodeGraphInputs::RenderNodeGraphGpuImageDesc> descs_;
70     BASE_NS::vector<RENDER_NS::RenderHandleReference> resourceHandles_;
71 };
72 CORE3D_END_NAMESPACE()
73 
74 #endif // CORE__RENDER__NODE__RENDER_NODE_CREATE_DEFAULT_CAMERA_GPU_IMAGES_H
75