Blender V4.3
vk_scheduler.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
12#pragma once
13
14#include "BLI_vector.hh"
15
16#include "vk_common.hh"
18
20class VKRenderGraph;
21
47 private:
52 Vector<NodeHandle> result_;
53
54 public:
62 [[nodiscard]] Span<NodeHandle> select_nodes_for_image(const VKRenderGraph &render_graph,
63 VkImage vk_image);
64
72 [[nodiscard]] Span<NodeHandle> select_nodes_for_buffer(const VKRenderGraph &render_graph,
73 VkBuffer vk_buffer);
74 [[nodiscard]] Span<NodeHandle> select_nodes(const VKRenderGraph &render_graph);
75
76 private:
82 void select_all_nodes(const VKRenderGraph &render_graph);
83
84 void reorder_nodes(const VKRenderGraph &render_graph);
85
102 void move_transfer_and_dispatch_outside_rendering_scope(const VKRenderGraph &render_graph);
103
107 std::optional<std::pair<int64_t, int64_t>> find_rendering_scope(
108 const VKRenderGraph &render_graph, IndexRange search_range) const;
109 template<typename FuncT>
110 void foreach_rendering_scope(const VKRenderGraph &render_graph, const FuncT &func) const
111 {
112 for (std::optional<std::pair<int64_t, int64_t>> rendering_scope =
113 find_rendering_scope(render_graph, IndexRange(result_.index_range()));
114 rendering_scope.has_value();
115 rendering_scope =
116 find_rendering_scope(render_graph,
117 IndexRange(rendering_scope.value().second + 1,
118 result_.size() - rendering_scope.value().second - 1)))
119 {
120 func(rendering_scope.value().first, rendering_scope.value().second);
121 }
122 }
123
124 void debug_print(const VKRenderGraph &render_graph) const;
125};
126
127} // namespace blender::gpu::render_graph
int64_t size() const
IndexRange index_range() const
Span< NodeHandle > select_nodes(const VKRenderGraph &render_graph)
Span< NodeHandle > select_nodes_for_image(const VKRenderGraph &render_graph, VkImage vk_image)
Span< NodeHandle > select_nodes_for_buffer(const VKRenderGraph &render_graph, VkBuffer vk_buffer)