Line |
Branch |
Exec |
Source |
1 |
|
|
/************************************************************************ |
2 |
|
|
* |
3 |
|
|
* Copyright (C) 2021-2024 IRCAD France |
4 |
|
|
* Copyright (C) 2021 IHU Strasbourg |
5 |
|
|
* |
6 |
|
|
* This file is part of Sight. |
7 |
|
|
* |
8 |
|
|
* Sight is free software: you can redistribute it and/or modify it under |
9 |
|
|
* the terms of the GNU Lesser General Public License as published by |
10 |
|
|
* the Free Software Foundation, either version 3 of the License, or |
11 |
|
|
* (at your option) any later version. |
12 |
|
|
* |
13 |
|
|
* Sight is distributed in the hope that it will be useful, |
14 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
|
|
* GNU Lesser General Public License for more details. |
17 |
|
|
* |
18 |
|
|
* You should have received a copy of the GNU Lesser General Public |
19 |
|
|
* License along with Sight. If not, see <https://www.gnu.org/licenses/>. |
20 |
|
|
* |
21 |
|
|
***********************************************************************/ |
22 |
|
|
|
23 |
|
|
#pragma once |
24 |
|
|
|
25 |
|
|
#include <sight/viz/scene3d/config.hpp> |
26 |
|
|
|
27 |
|
|
#include <functional> |
28 |
|
|
|
29 |
|
|
namespace sight::viz::scene3d |
30 |
|
|
{ |
31 |
|
|
|
32 |
|
|
/** |
33 |
|
|
* @brief Interface for graphics worker. |
34 |
|
|
* |
35 |
|
|
* Graphics worker are used to run gpu resource handling tasks in parallel. |
36 |
|
|
* |
37 |
|
|
* /!\ DISCLAIMER: can not be used for parallel rendering as it is not supported by OGRE. |
38 |
|
|
* graphics workers should mainly be used to fill large gpu buffers in the background. |
39 |
|
|
*/ |
40 |
|
|
class SIGHT_VIZ_SCENE3D_CLASS_API graphics_worker |
41 |
|
|
{ |
42 |
|
|
public: |
43 |
|
|
|
44 |
|
|
using task_t = std::function<void ()>; |
45 |
|
|
|
46 |
|
|
/// Constructor, initializes the worker. |
47 |
|
✗ |
SIGHT_VIZ_SCENE3D_API graphics_worker() |
48 |
|
|
= default; |
49 |
|
|
|
50 |
|
|
/// Destructor, clears all waiting tasks and waits on the one being executed. |
51 |
|
✗ |
SIGHT_VIZ_SCENE3D_API virtual ~graphics_worker() |
52 |
|
|
= default; |
53 |
|
|
|
54 |
|
|
/// Adds a task at the back of the worker's task queue. |
55 |
|
|
SIGHT_VIZ_SCENE3D_API virtual void push_task(task_t _task) = 0; |
56 |
|
|
}; |
57 |
|
|
|
58 |
|
|
//------------------------------------------------------------------------------ |
59 |
|
|
|
60 |
|
|
} // namespace sight::viz::scene3d |
61 |
|
|
|