Blender V4.3
vk_draw_indexed_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
29
35
36class VKDrawIndexedNode : public VKNodeInfo<VKNodeType::DRAW_INDEXED,
37 VKDrawIndexedCreateInfo,
38 VKDrawIndexedData,
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 = create_info.node_data;
52 vk_pipeline_data_copy(node.draw_indexed.pipeline_data, create_info.node_data.pipeline_data);
53 }
54
59 VKRenderGraphNodeLinks &node_links,
60 const CreateInfo &create_info) override
61 {
62 create_info.resources.build_links(resources, node_links);
63 vk_index_buffer_binding_build_links(resources, node_links, create_info.node_data.index_buffer);
65 resources, node_links, create_info.node_data.vertex_buffers);
66 }
67
72 Data &data,
73 VKBoundPipelines &r_bound_pipelines) override
74 {
76 data.pipeline_data,
77 r_bound_pipelines.graphics.pipeline,
78 VK_PIPELINE_BIND_POINT_GRAPHICS,
79 VK_SHADER_STAGE_ALL_GRAPHICS);
81 command_buffer, data.index_buffer, r_bound_pipelines.graphics.index_buffer);
83 command_buffer, data.vertex_buffers, r_bound_pipelines.graphics.vertex_buffers);
84 command_buffer.draw_indexed(data.index_count,
85 data.instance_count,
86 data.first_index,
87 data.vertex_offset,
88 data.first_instance);
89 }
90
91 void free_data(Data &data)
92 {
93 vk_pipeline_data_free(data.pipeline_data);
94 }
95};
96} // namespace blender::gpu::render_graph
virtual void draw_indexed(uint32_t index_count, uint32_t instance_count, uint32_t first_index, int32_t vertex_offset, uint32_t first_instance)=0
void build_commands(VKCommandBufferInterface &command_buffer, Data &data, VKBoundPipelines &r_bound_pipelines) override
static void set_node_data(Node &node, const CreateInfo &create_info)
void build_links(VKResourceStateTracker &resources, VKRenderGraphNodeLinks &node_links, const CreateInfo &create_info) override
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
VKDrawIndexedCreateInfo(const VKResourceAccessInfo &resources)
void build_links(VKResourceStateTracker &resources, VKRenderGraphNodeLinks &node_links) const