forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomputeNode.I
More file actions
113 lines (103 loc) · 3.04 KB
/
computeNode.I
File metadata and controls
113 lines (103 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file computeNode.I
* @author rdb
* @date 2014-06-20
*/
/**
* Adds a dispatch command with the given number of work groups in the X, Y,
* and Z dimensions. Any of these values may be set to 1 if the respective
* dimension should not be used.
*/
INLINE void ComputeNode::
add_dispatch(const LVecBase3i &num_groups) {
Dispatcher::CDWriter cdata(_dispatcher->_cycler);
cdata->_dispatches.push_back(num_groups);
}
/**
* Adds a dispatch command with the given number of work groups in the X, Y,
* and Z dimensions. Any of these values may be set to 1 if the respective
* dimension should not be used.
*/
INLINE void ComputeNode::
add_dispatch(int num_groups_x, int num_groups_y, int num_groups_z) {
LVecBase3i num_groups(num_groups_x, num_groups_y, num_groups_z);
add_dispatch(num_groups);
}
/**
* Removes all dispatch commands.
*/
INLINE void ComputeNode::
clear_dispatches() {
Dispatcher::CDWriter cdata(_dispatcher->_cycler);
cdata->_dispatches.clear();
}
/**
* Returns the number of times add_dispatch has been called on this object.
*/
INLINE size_t ComputeNode::
get_num_dispatches() const {
Dispatcher::CDReader cdata(_dispatcher->_cycler);
return cdata->_dispatches.size();
}
/**
* Returns the group counts of the nth dispatch associated with this object.
*/
INLINE const LVecBase3i &ComputeNode::
get_dispatch(size_t n) const {
Dispatcher::CDReader cdata(_dispatcher->_cycler);
nassertr(n < cdata->_dispatches.size(), LVecBase3i::zero());
return cdata->_dispatches[n];
}
/**
* Sets the group counts of the nth dispatch associated with this object.
*/
INLINE void ComputeNode::
set_dispatch(size_t n, const LVecBase3i &dispatch) {
Dispatcher::CDWriter cdata(_dispatcher->_cycler);
nassertv(n < cdata->_dispatches.size());
cdata->_dispatches[n] = dispatch;
}
/**
* Inserts a dispatch command with the given number of work groups in the X,
* Y, and Z dimensions at the given position in the list of dispatch commands.
* Any of these values may be set to 1 if the respective dimension should not
* be used.
*/
INLINE void ComputeNode::
insert_dispatch(size_t n, const LVecBase3i &dispatch) {
Dispatcher::CDWriter cdata(_dispatcher->_cycler);
if (n > cdata->_dispatches.size()) {
n = cdata->_dispatches.size();
}
cdata->_dispatches.insert(cdata->_dispatches.begin(), dispatch);
}
/**
* Erases the given dispatch index from the list.
*/
INLINE void ComputeNode::
remove_dispatch(size_t n) {
Dispatcher::CDWriter cdata(_dispatcher->_cycler);
nassertv(n < cdata->_dispatches.size());
cdata->_dispatches.erase(cdata->_dispatches.begin() + n);
}
/**
*
*/
INLINE ComputeNode::Dispatcher::CData::
CData() {
}
/**
*
*/
INLINE ComputeNode::Dispatcher::CData::
CData(const ComputeNode::Dispatcher::CData ©) :
_dispatches(copy._dispatches)
{
}