Blender V4.3
vk_clear_color_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
9#pragma once
10
11#include "vk_node_info.hh"
12
14
19 VkImage vk_image;
20 VkClearColorValue vk_clear_color_value;
21 VkImageSubresourceRange vk_image_subresource_range;
22};
23
24class VKClearColorImageNode : public VKNodeInfo<VKNodeType::CLEAR_COLOR_IMAGE,
25 VKClearColorImageData,
26 VKClearColorImageData,
27 VK_PIPELINE_STAGE_TRANSFER_BIT,
28 VKResourceType::IMAGE> {
29 public:
37 template<typename Node> static void set_node_data(Node &node, const CreateInfo &create_info)
38 {
39 node.clear_color_image = create_info;
40 }
41
46 VKRenderGraphNodeLinks &node_links,
47 const CreateInfo &create_info) override
48 {
49 ResourceWithStamp resource = resources.get_image_and_increase_stamp(create_info.vk_image);
50 node_links.outputs.append({resource,
51 VK_ACCESS_TRANSFER_WRITE_BIT,
52 VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
53 VK_IMAGE_ASPECT_COLOR_BIT});
54 }
55
60 Data &data,
61 VKBoundPipelines & /*r_bound_pipelines*/) override
62 {
63 command_buffer.clear_color_image(data.vk_image,
64 VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
65 &data.vk_clear_color_value,
66 1,
67 &data.vk_image_subresource_range);
68 }
69};
70} // namespace blender::gpu::render_graph
void build_commands(VKCommandBufferInterface &command_buffer, Data &data, VKBoundPipelines &) override
void build_links(VKResourceStateTracker &resources, VKRenderGraphNodeLinks &node_links, const CreateInfo &create_info) override
static void set_node_data(Node &node, const CreateInfo &create_info)
virtual void clear_color_image(VkImage image, VkImageLayout image_layout, const VkClearColorValue *p_color, uint32_t range_count, const VkImageSubresourceRange *p_ranges)=0
ResourceWithStamp get_image_and_increase_stamp(VkImage vk_image)