Panda3D
Loading...
Searching...
No Matches
graphicsThreadingModel.I
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file graphicsThreadingModel.I
10 * @author drose
11 * @date 2003-01-27
12 */
13
14/**
15 *
16 */
19 _cull_name(copy._cull_name),
20 _cull_stage(copy._cull_stage),
21 _draw_name(copy._draw_name),
22 _draw_stage(copy._draw_stage),
23 _cull_sorting(copy._cull_sorting)
24{
25}
26
27/**
28 *
29 */
30INLINE void GraphicsThreadingModel::
31operator = (const GraphicsThreadingModel &copy) {
32 _cull_name = copy._cull_name;
33 _cull_stage = copy._cull_stage;
34 _draw_name = copy._draw_name;
35 _draw_stage = copy._draw_stage;
36 _cull_sorting = copy._cull_sorting;
37}
38
39/**
40 * Returns the name of the thread that will handle culling in this model.
41 */
42INLINE const std::string &GraphicsThreadingModel::
43get_cull_name() const {
44 return _cull_name;
45}
46
47/**
48 * Changes the name of the thread that will handle culling in this model.
49 * This won't change any windows that were already created with this model;
50 * this only has an effect on newly-opened windows.
51 */
53set_cull_name(const std::string &cull_name) {
54 _cull_name = cull_name;
55 update_stages();
56}
57
58/**
59 * Returns the pipeline stage from which the cull thread should access data.
60 * This will be 0 if the cull is run in the same thread as app, or 1 if it is
61 * its own thread.
62 */
64get_cull_stage() const {
65 return _cull_stage;
66}
67
68/**
69 * Returns the name of the thread that will handle sending the actual graphics
70 * primitives to the graphics API in this model.
71 */
72INLINE const std::string &GraphicsThreadingModel::
73get_draw_name() const {
74 return _draw_name;
75}
76
77/**
78 * Changes the name of the thread that will handle drawing in this model.
79 * This won't change any windows that were already created with this model;
80 * this only has an effect on newly-opened windows.
81 */
83set_draw_name(const std::string &draw_name) {
84 _draw_name = draw_name;
85 update_stages();
86}
87
88/**
89 * Returns the pipeline stage from which the draw thread should access data.
90 * This will be the same value as get_cull_stage() if cull and draw are run in
91 * the same thread, or one more than that value if draw should be in its own
92 * thread.
93 */
95get_draw_stage() const {
96 return _draw_stage;
97}
98
99/**
100 * Returns true if the model involves a separate cull pass, or false if
101 * culling happens implicitly, at the same time as draw.
102 */
104get_cull_sorting() const {
105 return _cull_sorting;
106
107}
108
109/**
110 * Changes the flag that indicates whether the threading model involves a
111 * separate cull pass. This won't change any windows that were already
112 * created with this model; this only has an effect on newly-opened windows.
113 */
115set_cull_sorting(bool cull_sorting) {
116 _cull_sorting = cull_sorting;
117 update_stages();
118}
119
120/**
121 * Returns true if the threading model is a single-threaded model, or false if
122 * it involves threads.
123 */
125is_single_threaded() const {
126 return _cull_name.empty() && _draw_name.empty();
127}
128
129/**
130 * Returns true if the threading model is the default, cull-then-draw single-
131 * threaded model, or false otherwise.
132 */
134is_default() const {
135 return is_single_threaded() && _cull_sorting;
136}
137
138
139/**
140 *
141 */
142INLINE void GraphicsThreadingModel::
143output(std::ostream &out) const {
144 out << get_model();
145}
146
147INLINE std::ostream &
148operator << (std::ostream &out, const GraphicsThreadingModel &threading_model) {
149 threading_model.output(out);
150 return out;
151}
This represents the user's specification of how a particular frame is handled by the various threads.
void set_draw_name(const std::string &cull_name)
Changes the name of the thread that will handle drawing in this model.
int get_cull_stage() const
Returns the pipeline stage from which the cull thread should access data.
bool get_cull_sorting() const
Returns true if the model involves a separate cull pass, or false if culling happens implicitly,...
GraphicsThreadingModel(const std::string &model=std::string())
The threading model accepts a string representing the names of the two threads that will process cull...
bool is_single_threaded() const
Returns true if the threading model is a single-threaded model, or false if it involves threads.
void set_cull_name(const std::string &cull_name)
Changes the name of the thread that will handle culling in this model.
std::string get_model() const
Returns the string that describes the threading model.
const std::string & get_cull_name() const
Returns the name of the thread that will handle culling in this model.
bool is_default() const
Returns true if the threading model is the default, cull-then-draw single- threaded model,...
void set_cull_sorting(bool cull_sorting)
Changes the flag that indicates whether the threading model involves a separate cull pass.
const std::string & get_draw_name() const
Returns the name of the thread that will handle sending the actual graphics primitives to the graphic...
int get_draw_stage() const
Returns the pipeline stage from which the draw thread should access data.