Blender V4.3
vk_draw_indexed_indirect_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
9#pragma once
10
12#include "vk_node_info.hh"
13
15
28
34
36 : public VKNodeInfo<VKNodeType::DRAW_INDEXED_INDIRECT,
37 VKDrawIndexedIndirectCreateInfo,
38 VKDrawIndexedIndirectData,
39 VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
40 VKResourceType::IMAGE | VKResourceType::BUFFER> {
41 public:
49 template<typename Node> static void set_node_data(Node &node, const CreateInfo &create_info)
50 {
51 node.draw_indexed_indirect = create_info.node_data;
52 vk_pipeline_data_copy(node.draw_indexed_indirect.pipeline_data,
53 create_info.node_data.pipeline_data);
54 }
55
60 VKRenderGraphNodeLinks &node_links,
61 const CreateInfo &create_info) override
62 {
63 create_info.resources.build_links(resources, node_links);
64 vk_index_buffer_binding_build_links(resources, node_links, create_info.node_data.index_buffer);
66 resources, node_links, create_info.node_data.vertex_buffers);
67 ResourceWithStamp buffer_resource = resources.get_buffer(
68 create_info.node_data.indirect_buffer);
69 node_links.inputs.append({buffer_resource, VK_ACCESS_INDIRECT_COMMAND_READ_BIT});
70 }
71
76 Data &data,
77 VKBoundPipelines &r_bound_pipelines) override
78 {
80 data.pipeline_data,
81 r_bound_pipelines.graphics.pipeline,
82 VK_PIPELINE_BIND_POINT_GRAPHICS,
83 VK_SHADER_STAGE_ALL_GRAPHICS);
85 command_buffer, data.index_buffer, r_bound_pipelines.graphics.index_buffer);
87 command_buffer, data.vertex_buffers, r_bound_pipelines.graphics.vertex_buffers);
88 command_buffer.draw_indexed_indirect(
89 data.indirect_buffer, data.offset, data.draw_count, data.stride);
90 }
91
92 void free_data(Data &data)
93 {
94 vk_pipeline_data_free(data.pipeline_data);
95 }
96};
97} // namespace blender::gpu::render_graph
virtual void draw_indexed_indirect(VkBuffer buffer, VkDeviceSize offset, uint32_t draw_count, uint32_t stride)=0
void build_links(VKResourceStateTracker &resources, VKRenderGraphNodeLinks &node_links, const CreateInfo &create_info) override
static void set_node_data(Node &node, const CreateInfo &create_info)
void build_commands(VKCommandBufferInterface &command_buffer, Data &data, VKBoundPipelines &r_bound_pipelines) override
ResourceWithStamp get_buffer(VkBuffer vk_buffer) const
void vk_pipeline_data_copy(VKPipelineData &dst, const VKPipelineData &src)
void vk_index_buffer_binding_build_commands(VKCommandBufferInterface &command_buffer, const VKIndexBufferBinding &index_buffer_binding, VKIndexBufferBinding &r_bound_index_buffer)
void vk_index_buffer_binding_build_links(VKResourceStateTracker &resources, VKRenderGraphNodeLinks &node_links, const VKIndexBufferBinding &index_buffer_binding)
void vk_vertex_buffer_bindings_build_links(VKResourceStateTracker &resources, VKRenderGraphNodeLinks &node_links, const VKVertexBufferBindings &vertex_buffers)
void vk_pipeline_data_free(VKPipelineData &data)
void vk_vertex_buffer_bindings_build_commands(VKCommandBufferInterface &command_buffer, const VKVertexBufferBindings &vertex_buffer_bindings, VKVertexBufferBindings &r_bound_vertex_buffers)
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)
unsigned int uint32_t
Definition stdint.h:80
struct blender::gpu::render_graph::VKBoundPipelines::@660 graphics
void build_links(VKResourceStateTracker &resources, VKRenderGraphNodeLinks &node_links) const