Blender V5.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
8
9#pragma once
10
12#include "vk_node_info.hh"
13
15
41
46
47class VKDrawIndexedNode : public VKDrawNodeInfo<VKNodeType::DRAW_INDEXED,
48 VKDrawIndexedCreateInfo,
49 VKDrawIndexedData,
50 VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
51 VKResourceType::IMAGE | VKResourceType::BUFFER> {
52 public:
53 static void reset_data(Data &data)
54 {
55 data.reset();
56 }
57
58 template<typename Storage>
59 static Data &alloc_node_data(Storage &storage, int64_t &r_storage_index)
60 {
61 Data &data = storage.draw_indexed.alloc(r_storage_index);
63 return data;
64 }
65
66 template<typename Storage> static Data &storage_data(Storage &storage, int64_t storage_index)
67 {
68 return storage.draw_indexed[storage_index];
69 }
70
75 VKRenderGraphLinks &links,
76 const CreateInfo &create_info,
77 Data &data) override
78 {
79 create_info.resources.build_links(resources, links);
80 if (data.index_buffer.buffer != VK_NULL_HANDLE) {
81 vk_index_buffer_binding_build_links(resources, links, data.index_buffer);
82 }
83 vk_vertex_buffer_bindings_build_links(resources, links, data.vertex_buffers);
84 }
85
90 Data &data,
91 Span<uint8_t> storage_push_constants,
92 VKBoundPipelines &r_bound_pipelines) override
93 {
94 vk_pipeline_dynamic_graphics_build_commands(command_buffer, data.graphics, r_bound_pipelines);
96 data.graphics.pipeline_data,
97 storage_push_constants,
98 r_bound_pipelines.graphics.pipeline,
99 VK_PIPELINE_BIND_POINT_GRAPHICS,
100 VK_SHADER_STAGE_ALL_GRAPHICS);
102 command_buffer, data.index_buffer, r_bound_pipelines.graphics.index_buffer);
104 command_buffer, data.vertex_buffers, r_bound_pipelines.graphics.vertex_buffers);
105 command_buffer.draw_indexed(data.index_count,
106 data.instance_count,
107 data.first_index,
108 data.vertex_offset,
109 data.first_instance);
110 }
111};
112} // 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, Span< uint8_t > storage_push_constants, VKBoundPipelines &r_bound_pipelines) override
void build_links(VKResourceStateTracker &resources, VKRenderGraphLinks &links, const CreateInfo &create_info, Data &data) 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_index_buffer_binding_build_commands(VKCommandBufferInterface &command_buffer, const VKIndexBufferBinding &index_buffer_binding, VKIndexBufferBinding &r_bound_index_buffer)
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)
void vk_index_buffer_binding_build_links(VKResourceStateTracker &resources, VKRenderGraphLinks &links, const VKIndexBufferBinding &index_buffer_binding)
__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
VKDrawIndexedCreateInfo(const VKResourceAccessInfo &resources)
void build_links(VKResourceStateTracker &resources, VKRenderGraphLinks &links) const