Blender
V5.3
source
blender
gpu
vulkan
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
9
#include "
vk_work_in_flight.hh
"
10
#include "
vk_backend.hh
"
11
#include "
vk_context.hh
"
12
13
namespace
blender::gpu
{
14
15
VKWorkInFlight::VKWorkInFlight
(
uint
max_in_flight)
16
{
17
async_timeline_values_.resize(max_in_flight);
18
async_timeline_values_.fill(0);
19
}
20
21
void
VKWorkInFlight::reset
()
22
{
23
async_timeline_values_.fill(0);
24
work_index_ = 0;
25
}
26
27
void
VKWorkInFlight::begin_work
()
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
36
void
VKWorkInFlight::end_work
()
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(
43
RenderGraphFlushFlags::SUBMIT
|
RenderGraphFlushFlags::RENEW_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
blender::gpu::VKBackend::get
static VKBackend & get()
Definition
vk_backend.hh:103
blender::gpu::VKBackend::device
VKDevice device
Definition
vk_backend.hh:37
blender::gpu::VKContext
Definition
vk_context.hh:42
blender::gpu::VKContext::get
static VKContext * get()
Definition
vk_context.hh:148
blender::gpu::VKDevice
Definition
vk_device.hh:180
blender::gpu::VKDevice::wait_for_timeline
void wait_for_timeline(TimelineValue timeline)
Definition
vk_device_submission.cc:99
blender::gpu::VKWorkInFlight::VKWorkInFlight
VKWorkInFlight(unsigned int max_in_flight)
Definition
vk_work_in_flight.cc:15
blender::gpu::VKWorkInFlight::reset
void reset() override
Definition
vk_work_in_flight.cc:21
blender::gpu::VKWorkInFlight::end_work
void end_work() override
Definition
vk_work_in_flight.cc:36
blender::gpu::VKWorkInFlight::begin_work
void begin_work() override
Definition
vk_work_in_flight.cc:27
blender::gpu
Definition
blf_internal_types.hh:35
blender::gpu::TimelineValue
uint64_t TimelineValue
Definition
vk_common.hh:39
blender::gpu::RENEW_RENDER_GRAPH
@ RENEW_RENDER_GRAPH
Definition
vk_context.hh:35
blender::gpu::SUBMIT
@ SUBMIT
Definition
vk_context.hh:36
blender::uint
unsigned int uint
Definition
BKE_text.h:55
vk_backend.hh
vk_context.hh
vk_work_in_flight.hh
Generated on
for Blender by
doxygen
1.18.0