Blender V5.3
vk_work_in_flight.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2026 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
10#include "vk_backend.hh"
11#include "vk_context.hh"
12
13namespace blender::gpu {
14
16{
17 async_timeline_values_.resize(max_in_flight);
18 async_timeline_values_.fill(0);
19}
20
22{
23 async_timeline_values_.fill(0);
24 work_index_ = 0;
25}
26
28{
29 TimelineValue async_timeline_prev = async_timeline_values_[work_index_];
30 if (async_timeline_prev > 0) {
31 VKDevice &device = VKBackend::get().device;
32 device.wait_for_timeline(async_timeline_prev);
33 }
34}
35
37{
38 /* Perform render step between samples to avoid allocation of a high amount of command buffer
39 * memory that can eventually result in out-of-memory errors or a TDR when submitted as one large
40 * command buffer. */
41 VKContext &context = *VKContext::get();
42 TimelineValue async_timeline = context.flush_render_graph(
44 async_timeline_values_[work_index_] = async_timeline;
45 work_index_ = (work_index_ + 1) % async_timeline_values_.size();
46}
47
48} // namespace blender::gpu
static VKBackend & get()
static VKContext * get()
void wait_for_timeline(TimelineValue timeline)
VKWorkInFlight(unsigned int max_in_flight)
uint64_t TimelineValue
Definition vk_common.hh:39
unsigned int uint
Definition BKE_text.h:55