Blender V4.3
vk_node_info.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#pragma once
10
14#include "vk_common.hh"
15#include "vk_pipeline_data.hh"
16
18
48
49BLI_INLINE std::ostream &operator<<(std::ostream &os, const VKNodeType node_type)
50{
51 switch (node_type) {
53 os << "UNUSED";
54 break;
56 os << "BEGIN_QUERY";
57 break;
59 os << "BEGIN_RENDERING";
60 break;
62 os << "END_QUERY";
63 break;
65 os << "END_RENDERING";
66 break;
68 os << "CLEAR_ATTACHMENTS";
69 break;
71 os << "CLEAR_COLOR_IMAGE";
72 break;
74 os << "CLEAR_DEPTH_STENCIL_IMAGE";
75 break;
77 os << "FILL_BUFFER";
78 break;
80 os << "COPY_BUFFER";
81 break;
83 os << "COPY_IMAGE";
84 break;
86 os << "COPY_IMAGE_TO_BUFFER";
87 break;
89 os << "COPY_BUFFER_TO_IMAGE";
90 break;
92 os << "BLIT_IMAGE";
93 break;
95 os << "DISPATCH";
96 break;
98 os << "DISPATCH_INDIRECT";
99 break;
100 case VKNodeType::DRAW:
101 os << "DRAW";
102 break;
104 os << "DRAW_INDEXED";
105 break;
107 os << "DRAW_INDEXED_INDIRECT";
108 break;
110 os << "DRAW_INDIRECT";
111 break;
113 os << "RESET_QUERY_POOL";
114 break;
116 os << "SYNCHRONIZATION";
117 break;
119 os << "UPDATE_BUFFER";
120 break;
122 os << "UPDATE_MIPMAPS";
123 break;
124 }
125 return os;
126}
127
137
143
154template<VKNodeType NodeType,
155 typename NodeCreateInfo,
156 typename NodeData,
157 VkPipelineStageFlags PipelineStage,
158 VKResourceType ResourceUsages>
159class VKNodeInfo : public NonCopyable {
160
161 public:
162 using CreateInfo = NodeCreateInfo;
163 using Data = NodeData;
164
170 static constexpr VKNodeType node_type = NodeType;
171
176 static constexpr VkPipelineStageFlags pipeline_stage = PipelineStage;
177
182 static constexpr VKResourceType resource_usages = ResourceUsages;
183
194 template<typename Node> static void set_node_data(Node &node, const CreateInfo &create_info);
195
199 virtual void build_links(VKResourceStateTracker &resources,
200 VKRenderGraphNodeLinks &node_links,
201 const CreateInfo &create_info) = 0;
202
209 virtual void build_commands(VKCommandBufferInterface &command_buffer,
210 Data &data,
211 VKBoundPipelines &r_bound_pipelines) = 0;
212};
213} // namespace blender::gpu::render_graph
#define BLI_INLINE
#define ELEM(...)
static constexpr VKNodeType node_type
static void set_node_data(Node &node, const CreateInfo &create_info)
virtual void build_commands(VKCommandBufferInterface &command_buffer, Data &data, VKBoundPipelines &r_bound_pipelines)=0
virtual void build_links(VKResourceStateTracker &resources, VKRenderGraphNodeLinks &node_links, const CreateInfo &create_info)=0
static constexpr VKResourceType resource_usages
static constexpr VkPipelineStageFlags pipeline_stage
BLI_INLINE std::ostream & operator<<(std::ostream &os, const VKNodeType node_type)
BLI_INLINE bool node_type_is_rendering(VKNodeType node_type)
BLI_INLINE bool node_type_is_within_rendering(VKNodeType node_type)