Blender V5.3
vk_update_buffer_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
11#include "vk_node_info.hh"
12
23
24class VKUpdateBufferNode : public VKNodeInfo<VKNodeType::UPDATE_BUFFER,
25 VKUpdateBufferData,
26 VKUpdateBufferData,
27 VK_PIPELINE_STAGE_TRANSFER_BIT,
28 VKResourceType::BUFFER> {
29 public:
37 template<typename Node, typename Storage>
38 static void set_node_data(Node &node, Storage & /* storage */, const CreateInfo &create_info)
39 {
40 node.update_buffer = create_info;
41 }
42
47 VKRenderGraphLinks &links,
48 const CreateInfo &create_info) override
49 {
50 ResourceWithStamp dst_resource = resources.get_buffer_and_increase_stamp(
51 create_info.dst_buffer);
52 links.buffers.append({dst_resource, VK_ACCESS_TRANSFER_WRITE_BIT});
53 }
54
59 Data &data,
60 Span<uint8_t> /*storage_push_constants*/,
61 VKBoundPipelines & /*r_bound_pipelines*/) override
62 {
63 command_buffer.update_buffer(data.dst_buffer, data.dst_offset, data.data_size, data.data);
64 }
65
67 {
69 data.data = nullptr;
70 }
71};
72} // namespace blender::gpu::render_graph
virtual void update_buffer(VkBuffer dst_buffer, VkDeviceSize dst_offset, VkDeviceSize data_size, const void *p_data)=0
ResourceWithStamp get_buffer_and_increase_stamp(ResourceHandle buffer_handle)
void build_links(VKResourceStateTracker &resources, VKRenderGraphLinks &links, const CreateInfo &create_info) override
void build_commands(VKCommandBufferInterface &command_buffer, Data &data, Span< uint8_t >, VKBoundPipelines &) override
static void set_node_data(Node &node, Storage &, const CreateInfo &create_info)
void MEM_delete_void(void *vmemh)
BMesh const char void * data