Blender V5.0
vk_draw_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
8
9#pragma once
10
12#include "vk_node_info.hh"
13
15
27
33
34class VKDrawIndirectNode : public VKNodeInfo<VKNodeType::DRAW_INDIRECT,
35 VKDrawIndirectCreateInfo,
36 VKDrawIndirectData,
37 VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
38 VKResourceType::IMAGE | VKResourceType::BUFFER> {
39 public:
47 template<typename Node, typename Storage>
48 static void set_node_data(Node &node, Storage &storage, const CreateInfo &create_info)
49 {
50 node.storage_index = storage.draw_indirect.append_and_get_index(create_info.node_data);
51 vk_pipeline_data_copy(storage.draw_indirect[node.storage_index].graphics,
52 create_info.node_data.graphics);
53 }
54
59 VKRenderGraphNodeLinks &node_links,
60 const CreateInfo &create_info) override
61 {
62 create_info.resources.build_links(resources, node_links);
64 resources, node_links, create_info.node_data.vertex_buffers);
65 ResourceWithStamp buffer_resource = resources.get_buffer(
66 create_info.node_data.indirect_buffer);
67 node_links.inputs.append({buffer_resource, VK_ACCESS_INDIRECT_COMMAND_READ_BIT});
68 }
69
74 Data &data,
75 VKBoundPipelines &r_bound_pipelines) override
76 {
78 command_buffer, data.graphics.viewport, data.graphics.line_width, r_bound_pipelines);
80 data.graphics.pipeline_data,
81 r_bound_pipelines.graphics.pipeline,
82 VK_PIPELINE_BIND_POINT_GRAPHICS,
83 VK_SHADER_STAGE_ALL_GRAPHICS);
85 command_buffer, data.vertex_buffers, r_bound_pipelines.graphics.vertex_buffers);
86
87 command_buffer.draw_indirect(data.indirect_buffer, data.offset, data.draw_count, data.stride);
88 }
89
91 {
93 }
94};
95} // namespace blender::gpu::render_graph
BMesh const char void * data
virtual void draw_indirect(VkBuffer buffer, VkDeviceSize offset, uint32_t draw_count, uint32_t stride)=0
void build_commands(VKCommandBufferInterface &command_buffer, Data &data, VKBoundPipelines &r_bound_pipelines) override
void build_links(VKResourceStateTracker &resources, VKRenderGraphNodeLinks &node_links, const CreateInfo &create_info) override
static void set_node_data(Node &node, Storage &storage, const CreateInfo &create_info)
ResourceWithStamp get_buffer(VkBuffer vk_buffer) const
void vk_pipeline_data_copy(VKPipelineData &dst, const VKPipelineData &src)
void vk_pipeline_dynamic_graphics_build_commands(VKCommandBufferInterface &command_buffer, const VKViewportData &viewport, const std::optional< float > line_width, VKBoundPipelines &r_bound_pipelines)
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)
struct blender::gpu::render_graph::VKBoundPipelines::@245157173206043141117177130032265241203257234004 graphics
VKDrawIndirectCreateInfo(const VKResourceAccessInfo &resources)
void build_links(VKResourceStateTracker &resources, VKRenderGraphNodeLinks &node_links) const