Blender V5.3
vk_blit_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
14
19 VkImage src_image;
20 VkImage dst_image;
21 VkImageBlit region;
22 VkFilter filter;
23};
24
32class VKBlitImageNode : public VKNodeInfo<VKNodeType::BLIT_IMAGE,
33 VKBlitImageData,
34 VKBlitImageData,
35 VK_PIPELINE_STAGE_TRANSFER_BIT,
36 VKResourceType::IMAGE> {
37 public:
45 template<typename Node, typename Storage>
46 void set_node_data(Node &node, Storage &storage, const CreateInfo &create_info)
47 {
48 node.storage_index = storage.blit_image.append_and_get_index(create_info);
49 }
50
55 VKRenderGraphLinks &links,
56 const CreateInfo &create_info) override
57 {
58 ResourceWithStamp src_resource = resources.get_image(create_info.src_image);
59 ResourceWithStamp dst_resource = resources.get_image_and_increase_stamp(create_info.dst_image);
60 links.images.append({{src_resource, VK_ACCESS_TRANSFER_READ_BIT},
61 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
62 VK_IMAGE_ASPECT_COLOR_BIT});
63 links.images.append({{dst_resource, VK_ACCESS_TRANSFER_WRITE_BIT},
64 VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
65 VK_IMAGE_ASPECT_COLOR_BIT});
66 }
67
72 Data &data,
73 Span<uint8_t> /*storage_push_constants*/,
74 VKBoundPipelines & /*r_bound_pipelines*/) override
75 {
76 command_buffer.blit_image(data.src_image,
77 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
78 data.dst_image,
79 VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
80 1,
81 &data.region,
82 data.filter);
83 }
84};
85} // namespace blender::gpu::render_graph
void build_commands(VKCommandBufferInterface &command_buffer, Data &data, Span< uint8_t >, VKBoundPipelines &) override
void set_node_data(Node &node, Storage &storage, const CreateInfo &create_info)
void build_links(VKResourceStateTracker &resources, VKRenderGraphLinks &links, const CreateInfo &create_info) override
virtual void blit_image(VkImage src_image, VkImageLayout src_image_layout, VkImage dst_image, VkImageLayout dst_image_layout, uint32_t region_count, const VkImageBlit *p_regions, VkFilter filter)=0
ResourceWithStamp get_image_and_increase_stamp(VkImage vk_image)
ResourceWithStamp get_image(VkImage vk_image) const
#define storage(slot, qualifiers)
BMesh const char void * data