Blender V5.0
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
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, typename Storage>
50 static void set_node_data(Node &node, Storage &storage, const CreateInfo &create_info)
51 {
52 node.storage_index = storage.draw_indexed.append_and_get_index(create_info.node_data);
53 vk_pipeline_data_copy(storage.draw_indexed[node.storage_index].graphics,
54 create_info.node_data.graphics);
55 }
56
61 VKRenderGraphNodeLinks &node_links,
62 const CreateInfo &create_info) override
63 {
64 create_info.resources.build_links(resources, node_links);
65 vk_index_buffer_binding_build_links(resources, node_links, create_info.node_data.index_buffer);
67 resources, node_links, create_info.node_data.vertex_buffers);
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.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(data.index_count,
89 data.instance_count,
90 data.first_index,
91 data.vertex_offset,
92 data.first_instance);
93 }
94
96 {
98 }
99};
100} // 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_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
VKDrawIndexedCreateInfo(const VKResourceAccessInfo &resources)
void build_links(VKResourceStateTracker &resources, VKRenderGraphNodeLinks &node_links) const