Blender V5.3
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
38
43
44class VKDrawNode : public VKDrawNodeInfo<VKNodeType::DRAW,
45 VKDrawCreateInfo,
46 VKDrawData,
47 VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
48 VKResourceType::IMAGE | VKResourceType::BUFFER> {
49 public:
50 static void reset_data(Data &data)
51 {
52 data.reset();
53 }
54
55 template<typename Storage>
56 static Data &alloc_node_data(Storage &storage, int64_t &r_storage_index)
57 {
58 Data &data = storage.draw.alloc(r_storage_index);
60 return data;
61 }
62
63 template<typename Storage> static Data &storage_data(Storage &storage, int64_t storage_index)
64 {
65 return storage.draw[storage_index];
66 }
67
72 VKRenderGraphLinks &links,
73 const CreateInfo &create_info,
74 Data &data) override
75 {
76 create_info.resources.build_links(resources, links);
77 vk_vertex_buffer_bindings_build_links(resources, links, data.vertex_buffers);
78 }
79
84 Data &data,
85 Span<uint8_t> storage_push_constants,
86 VKBoundPipelines &r_bound_pipelines) override
87 {
88 vk_pipeline_dynamic_graphics_build_commands(command_buffer, data.graphics, r_bound_pipelines);
90 data.graphics.pipeline_data,
91 storage_push_constants,
92 r_bound_pipelines.graphics.pipeline,
93 VK_PIPELINE_BIND_POINT_GRAPHICS,
94 VK_SHADER_STAGE_ALL_GRAPHICS);
96 command_buffer, data.vertex_buffers, r_bound_pipelines.graphics.vertex_buffers);
97
98 command_buffer.draw(
99 data.vertex_count, data.instance_count, data.first_vertex, data.first_instance);
100 }
101};
102} // namespace blender::gpu::render_graph
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, VKRenderGraphLinks &links, const CreateInfo &create_info, Data &data) override
void build_commands(VKCommandBufferInterface &command_buffer, Data &data, Span< uint8_t > storage_push_constants, VKBoundPipelines &r_bound_pipelines) override
static Data & alloc_node_data(Storage &storage, int64_t &r_storage_index)
static Data & storage_data(Storage &storage, int64_t storage_index)
#define storage(slot, qualifiers)
void vk_pipeline_dynamic_graphics_build_commands(VKCommandBufferInterface &command_buffer, const VKPipelineDataGraphics &graphics, VKBoundPipelines &r_bound_pipelines)
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, Span< uint8_t > storage_push_constants, VKBoundPipeline &r_bound_pipeline, VkPipelineBindPoint vk_pipeline_bind_point, VkShaderStageFlags vk_shader_stage_flags)
void vk_vertex_buffer_bindings_build_links(VKResourceStateTracker &resources, VKRenderGraphLinks &links, const VKVertexBufferBindings &vertex_buffers)
__int64 int64_t
Definition BKE_text.h:90
unsigned int uint32_t
Definition BKE_text.h:81
BMesh const char void * data
struct blender::gpu::render_graph::VKBoundPipelines::@354275304307172366215375121273352137136061330352 graphics
const VKResourceAccessInfo & resources
VKDrawCreateInfo(const VKResourceAccessInfo &resources)
VKVertexBufferBindings vertex_buffers
void build_links(VKResourceStateTracker &resources, VKRenderGraphLinks &links) const