Blender V5.0
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 VKRenderGraphNodeLinks &node_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 node_links.inputs.append({src_resource,
61 VK_ACCESS_TRANSFER_READ_BIT,
62 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
63 VK_IMAGE_ASPECT_COLOR_BIT});
64 node_links.outputs.append({dst_resource,
65 VK_ACCESS_TRANSFER_WRITE_BIT,
66 VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
67 VK_IMAGE_ASPECT_COLOR_BIT});
68 }
69
74 Data &data,
75 VKBoundPipelines & /*r_bound_pipelines*/) override
76 {
77 command_buffer.blit_image(data.src_image,
78 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
79 data.dst_image,
80 VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
81 1,
82 &data.region,
83 data.filter);
84 }
85};
86} // namespace blender::gpu::render_graph
BMesh const char void * data
void build_links(VKResourceStateTracker &resources, VKRenderGraphNodeLinks &node_links, const CreateInfo &create_info) override
void set_node_data(Node &node, Storage &storage, const CreateInfo &create_info)
void build_commands(VKCommandBufferInterface &command_buffer, Data &data, VKBoundPipelines &) 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