Blender V5.0
vk_draw_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
13#include "vk_node_info.hh"
14
16
28
34
35class VKDrawNode : public VKNodeInfo<VKNodeType::DRAW,
36 VKDrawCreateInfo,
37 VKDrawData,
38 VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
39 VKResourceType::IMAGE | VKResourceType::BUFFER> {
40 public:
48 template<typename Node, typename Storage>
49 static void set_node_data(Node &node, Storage &storage, const CreateInfo &create_info)
50 {
51 node.storage_index = storage.draw.append_and_get_index(create_info.node_data);
52 vk_pipeline_data_copy(storage.draw[node.storage_index].graphics,
53 create_info.node_data.graphics);
54 }
55
60 VKRenderGraphNodeLinks &node_links,
61 const CreateInfo &create_info) override
62 {
63 create_info.resources.build_links(resources, node_links);
65 resources, node_links, create_info.node_data.vertex_buffers);
66 }
67
72 Data &data,
73 VKBoundPipelines &r_bound_pipelines) override
74 {
76 command_buffer, data.graphics.viewport, data.graphics.line_width, r_bound_pipelines);
78 data.graphics.pipeline_data,
79 r_bound_pipelines.graphics.pipeline,
80 VK_PIPELINE_BIND_POINT_GRAPHICS,
81 VK_SHADER_STAGE_ALL_GRAPHICS);
83 command_buffer, data.vertex_buffers, r_bound_pipelines.graphics.vertex_buffers);
84
85 command_buffer.draw(
86 data.vertex_count, data.instance_count, data.first_vertex, data.first_instance);
87 }
88
90 {
92 }
93};
94} // namespace blender::gpu::render_graph
BMesh const char void * data
virtual void draw(uint32_t vertex_count, uint32_t instance_count, uint32_t first_vertex, uint32_t first_instance)=0
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)
void build_commands(VKCommandBufferInterface &command_buffer, Data &data, VKBoundPipelines &r_bound_pipelines) override
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
const VKResourceAccessInfo & resources
VKDrawCreateInfo(const VKResourceAccessInfo &resources)
VKVertexBufferBindings vertex_buffers
void build_links(VKResourceStateTracker &resources, VKRenderGraphNodeLinks &node_links) const