Blender V5.3
GPU_work_in_flight.hh
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#pragma once
10
11#include <memory>
12
13#include "BLI_assert.hh"
14
15namespace blender::gpu {
16
17class WorkInFlight;
18
20 public:
21 void operator()(WorkInFlight *work_in_flight);
22};
23
24using WorkInFlightPtr = std::unique_ptr<gpu::WorkInFlight, gpu::WorkInFlightDeleter>;
25
31 public:
32 static WorkInFlightPtr create(unsigned int max_in_flight);
33
34 virtual ~WorkInFlight() = default;
35
36 /* Reset the internal state. Needs to be called before the first or after the last work packet.
37 */
38 virtual void reset() = 0;
39
40 /* Needs to be called before beginning a work packet. Blocks if the maximum number of work
41 * packets in flight is reached. */
42 virtual void begin_work() = 0;
43
44 /* Needs to be called after the end of a work packet. */
45 virtual void end_work() = 0;
46};
47
48} // namespace blender::gpu
void operator()(WorkInFlight *work_in_flight)
virtual void end_work()=0
virtual void begin_work()=0
virtual ~WorkInFlight()=default
static WorkInFlightPtr create(unsigned int max_in_flight)
virtual void reset()=0
std::unique_ptr< gpu::WorkInFlight, gpu::WorkInFlightDeleter > WorkInFlightPtr