Blender V5.0
vk_clear_attachments_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
12#include "vk_node_info.hh"
13
15
21 VkClearAttachment attachments[8];
22 VkClearRect vk_clear_rect;
23};
24
25class VKClearAttachmentsNode : public VKNodeInfo<VKNodeType::CLEAR_ATTACHMENTS,
26 VKClearAttachmentsData,
27 VKClearAttachmentsData,
28 VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT |
29 VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT |
30 VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT,
31 VKResourceType::IMAGE> {
32 public:
40 template<typename Node, typename Storage>
41 void set_node_data(Node &node, Storage &storage, const CreateInfo &create_info)
42 {
43 node.storage_index = storage.clear_attachments.append_and_get_index(create_info);
44 }
45
50 VKRenderGraphNodeLinks &node_links,
51 const CreateInfo &create_info) override
52 {
53 UNUSED_VARS(resources, node_links, create_info);
54 }
55
60 Data &data,
61 VKBoundPipelines & /*r_bound_pipelines*/) override
62 {
63 command_buffer.clear_attachments(
64 data.attachment_count, data.attachments, 1, &data.vk_clear_rect);
65 }
66};
67} // namespace blender::gpu::render_graph
#define UNUSED_VARS(...)
BMesh const char void * data
void build_commands(VKCommandBufferInterface &command_buffer, Data &data, VKBoundPipelines &) override
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)
virtual void clear_attachments(uint32_t attachment_count, const VkClearAttachment *p_attachments, uint32_t rect_count, const VkClearRect *p_rects)=0