Blender V4.5
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
8
9#pragma once
10
12#include "vk_node_info.hh"
13
15
30
36
37class VKDrawIndexedNode : public VKNodeInfo<VKNodeType::DRAW_INDEXED,
38 VKDrawIndexedCreateInfo,
39 VKDrawIndexedData,
40 VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
41 VKResourceType::IMAGE | VKResourceType::BUFFER> {
42 public:
50 template<typename Node, typename Storage>
51 static void set_node_data(Node &node, Storage &storage, const CreateInfo &create_info)
52 {
53 node.storage_index = storage.draw_indexed.append_and_get_index(create_info.node_data);
54 vk_pipeline_data_copy(storage.draw_indexed[node.storage_index].pipeline_data,
55 create_info.node_data.pipeline_data);
56 }
57
62 VKRenderGraphNodeLinks &node_links,
63 const CreateInfo &create_info) override
64 {
65 create_info.resources.build_links(resources, node_links);
66 vk_index_buffer_binding_build_links(resources, node_links, create_info.node_data.index_buffer);
68 resources, node_links, create_info.node_data.vertex_buffers);
69 }
70
75 Data &data,
76 VKBoundPipelines &r_bound_pipelines) override
77 {
79 command_buffer, data.viewport_data, r_bound_pipelines.graphics.viewport_state);
81 data.pipeline_data,
82 r_bound_pipelines.graphics.pipeline,
83 VK_PIPELINE_BIND_POINT_GRAPHICS,
84 VK_SHADER_STAGE_ALL_GRAPHICS);
86 command_buffer, data.index_buffer, r_bound_pipelines.graphics.index_buffer);
88 command_buffer, data.vertex_buffers, r_bound_pipelines.graphics.vertex_buffers);
89 command_buffer.draw_indexed(data.index_count,
90 data.instance_count,
91 data.first_index,
92 data.vertex_offset,
93 data.first_instance);
94 }
95
97 {
98 vk_pipeline_data_free(data.pipeline_data);
99 }
100};
101} // namespace blender::gpu::render_graph
BMesh const char void * data
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, Storage &storage, 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_pipeline_viewport_set_commands(VKCommandBufferInterface &command_buffer, const VKViewportData &viewport_data, VKViewportData &r_viewport_state)
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::@030044156013015231354074031170364157315270372173 graphics
VKDrawIndexedCreateInfo(const VKResourceAccessInfo &resources)
void build_links(VKResourceStateTracker &resources, VKRenderGraphNodeLinks &node_links) const