Blender V5.0
vk_dispatch_node.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
8
9#pragma once
10
13#include "vk_node_info.hh"
14
25
34
35class VKDispatchNode : public VKNodeInfo<VKNodeType::DISPATCH,
36 VKDispatchCreateInfo,
37 VKDispatchData,
38 VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
39 VKResourceType::IMAGE | VKResourceType::BUFFER> {
40 public:
48 template<typename Node, typename Storage>
49 static void set_node_data(Node &node, Storage & /* storage */, const CreateInfo &create_info)
50 {
51 node.dispatch = create_info.dispatch_node;
52 vk_pipeline_data_copy(node.dispatch.pipeline_data, create_info.dispatch_node.pipeline_data);
53 }
54
59 {
60 vk_pipeline_data_free(data.pipeline_data);
61 }
62
67 VKRenderGraphNodeLinks &node_links,
68 const CreateInfo &create_info) override
69 {
70 create_info.resources.build_links(resources, node_links);
71 }
72
77 Data &data,
78 VKBoundPipelines &r_bound_pipelines) override
79 {
81 data.pipeline_data,
82 r_bound_pipelines.compute,
83 VK_PIPELINE_BIND_POINT_COMPUTE,
84 VK_SHADER_STAGE_COMPUTE_BIT);
85 command_buffer.dispatch(data.group_count_x, data.group_count_y, data.group_count_z);
86 }
87};
88} // namespace blender::gpu::render_graph
BMesh const char void * data
NonCopyable(const NonCopyable &other)=delete
virtual void dispatch(uint32_t group_count_x, uint32_t group_count_y, uint32_t group_count_z)=0
void build_links(VKResourceStateTracker &resources, VKRenderGraphNodeLinks &node_links, const CreateInfo &create_info) override
void build_commands(VKCommandBufferInterface &command_buffer, Data &data, VKBoundPipelines &r_bound_pipelines) override
static void set_node_data(Node &node, Storage &, const CreateInfo &create_info)
void vk_pipeline_data_copy(VKPipelineData &dst, const VKPipelineData &src)
void vk_pipeline_data_free(VKPipelineData &data)
void vk_pipeline_data_build_commands(VKCommandBufferInterface &command_buffer, const VKPipelineData &pipeline_data, VKBoundPipeline &r_bound_pipeline, VkPipelineBindPoint vk_pipeline_bind_point, VkShaderStageFlags vk_shader_stage_flags)
VKDispatchCreateInfo(const VKResourceAccessInfo &resources)
void build_links(VKResourceStateTracker &resources, VKRenderGraphNodeLinks &node_links) const