Blender V4.3
vk_clear_depth_stencil_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 VkClearDepthStencilValue vk_clear_depth_stencil_value;
21 VkImageSubresourceRange vk_image_subresource_range;
22};
23
34
35class VKClearDepthStencilImageNode : public VKNodeInfo<VKNodeType::CLEAR_DEPTH_STENCIL_IMAGE,
36 VKClearDepthStencilImageCreateInfo,
37 VKClearDepthStencilImageData,
38 VK_PIPELINE_STAGE_TRANSFER_BIT,
39 VKResourceType::IMAGE> {
40 public:
48 template<typename Node> static void set_node_data(Node &node, const CreateInfo &create_info)
49 {
50 node.clear_depth_stencil_image = create_info.node_data;
51 }
52
57 VKRenderGraphNodeLinks &node_links,
58 const CreateInfo &create_info) override
59 {
61 create_info.node_data.vk_image);
62 node_links.outputs.append({resource,
63 VK_ACCESS_TRANSFER_WRITE_BIT,
64 VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
65 create_info.vk_image_aspects});
66 }
67
72 Data &data,
73 VKBoundPipelines & /*r_bound_pipelines*/) override
74 {
75 command_buffer.clear_depth_stencil_image(data.vk_image,
76 VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
77 &data.vk_clear_depth_stencil_value,
78 1,
79 &data.vk_image_subresource_range);
80 }
81};
82} // namespace blender::gpu::render_graph
void build_commands(VKCommandBufferInterface &command_buffer, Data &data, VKBoundPipelines &) override
static void set_node_data(Node &node, const CreateInfo &create_info)
void build_links(VKResourceStateTracker &resources, VKRenderGraphNodeLinks &node_links, const CreateInfo &create_info) override
virtual void clear_depth_stencil_image(VkImage image, VkImageLayout image_layout, const VkClearDepthStencilValue *p_depth_stencil, uint32_t range_count, const VkImageSubresourceRange *p_ranges)=0
ResourceWithStamp get_image_and_increase_stamp(VkImage vk_image)