Blender V5.3
vk_copy_buffer_to_image_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
22
27
28class VKCopyBufferToImageNode : public VKNodeInfo<VKNodeType::COPY_BUFFER_TO_IMAGE,
29 VKCopyBufferToImageCreateInfo,
30 VKCopyBufferToImageData,
31 VK_PIPELINE_STAGE_TRANSFER_BIT,
32 VKResourceType::IMAGE | VKResourceType::BUFFER> {
33 public:
41 template<typename Node, typename Storage>
42 static void set_node_data(Node &node, Storage &storage, const CreateInfo &create_info)
43 {
44 node.storage_index = storage.copy_buffer_to_image.append_and_get_index(create_info.node_data);
45 }
46
51 VKRenderGraphLinks &links,
52 const CreateInfo &create_info) override
53 {
54 ResourceWithStamp src_resource = resources.get_buffer(create_info.node_data.src_buffer);
55 ResourceWithStamp dst_resource = resources.get_image_and_increase_stamp(
56 create_info.node_data.dst_image);
57 links.buffers.append({src_resource, VK_ACCESS_TRANSFER_READ_BIT});
58 links.images.append({{dst_resource, VK_ACCESS_TRANSFER_WRITE_BIT},
59 VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
60 create_info.vk_image_aspects});
61 }
62
67 Data &data,
68 Span<uint8_t> /*storage_push_constants*/,
69 VKBoundPipelines & /*r_bound_pipelines*/) override
70 {
71 command_buffer.copy_buffer_to_image(
72 data.src_buffer, data.dst_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &data.region);
73 }
74};
75} // namespace blender::gpu::render_graph
virtual void copy_buffer_to_image(VkBuffer src_buffer, VkImage dst_image, VkImageLayout dst_image_layout, uint32_t region_count, const VkBufferImageCopy *p_regions)=0
void build_commands(VKCommandBufferInterface &command_buffer, Data &data, Span< uint8_t >, VKBoundPipelines &) override
void build_links(VKResourceStateTracker &resources, VKRenderGraphLinks &links, const CreateInfo &create_info) override
static void set_node_data(Node &node, Storage &storage, const CreateInfo &create_info)
ResourceWithStamp get_image_and_increase_stamp(VkImage vk_image)
ResourceWithStamp get_buffer(ResourceHandle buffer_handle) const
#define storage(slot, qualifiers)
BMesh const char void * data