Panda3D
Loading...
Searching...
No Matches
computeNode.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 computeNode.I
10 * @author rdb
11 * @date 2014-06-20
12 */
13
14/**
15 * Adds a dispatch command with the given number of work groups in the X, Y,
16 * and Z dimensions. Any of these values may be set to 1 if the respective
17 * dimension should not be used.
18 */
19INLINE void ComputeNode::
20add_dispatch(const LVecBase3i &num_groups) {
21 Dispatcher::CDWriter cdata(_dispatcher->_cycler);
22 cdata->_dispatches.push_back(num_groups);
23}
24
25/**
26 * Adds a dispatch command with the given number of work groups in the X, Y,
27 * and Z dimensions. Any of these values may be set to 1 if the respective
28 * dimension should not be used.
29 */
30INLINE void ComputeNode::
31add_dispatch(int num_groups_x, int num_groups_y, int num_groups_z) {
32 LVecBase3i num_groups(num_groups_x, num_groups_y, num_groups_z);
33 add_dispatch(num_groups);
34}
35
36/**
37 * Removes all dispatch commands.
38 */
39INLINE void ComputeNode::
41 Dispatcher::CDWriter cdata(_dispatcher->_cycler);
42 cdata->_dispatches.clear();
43}
44
45/**
46 * Returns the number of times add_dispatch has been called on this object.
47 */
48INLINE size_t ComputeNode::
49get_num_dispatches() const {
50 Dispatcher::CDReader cdata(_dispatcher->_cycler);
51 return cdata->_dispatches.size();
52}
53
54/**
55 * Returns the group counts of the nth dispatch associated with this object.
56 */
57INLINE const LVecBase3i &ComputeNode::
58get_dispatch(size_t n) const {
59 Dispatcher::CDReader cdata(_dispatcher->_cycler);
60 nassertr(n < cdata->_dispatches.size(), LVecBase3i::zero());
61 return cdata->_dispatches[n];
62}
63
64/**
65 * Sets the group counts of the nth dispatch associated with this object.
66 */
67INLINE void ComputeNode::
68set_dispatch(size_t n, const LVecBase3i &dispatch) {
69 Dispatcher::CDWriter cdata(_dispatcher->_cycler);
70 nassertv(n < cdata->_dispatches.size());
71 cdata->_dispatches[n] = dispatch;
72}
73
74/**
75 * Inserts a dispatch command with the given number of work groups in the X,
76 * Y, and Z dimensions at the given position in the list of dispatch commands.
77 * Any of these values may be set to 1 if the respective dimension should not
78 * be used.
79 */
80INLINE void ComputeNode::
81insert_dispatch(size_t n, const LVecBase3i &dispatch) {
82 Dispatcher::CDWriter cdata(_dispatcher->_cycler);
83 if (n > cdata->_dispatches.size()) {
84 n = cdata->_dispatches.size();
85 }
86 cdata->_dispatches.insert(cdata->_dispatches.begin(), dispatch);
87}
88
89/**
90 * Erases the given dispatch index from the list.
91 */
92INLINE void ComputeNode::
93remove_dispatch(size_t n) {
94 Dispatcher::CDWriter cdata(_dispatcher->_cycler);
95 nassertv(n < cdata->_dispatches.size());
96 cdata->_dispatches.erase(cdata->_dispatches.begin() + n);
97}
98
99/**
100 *
101 */
102INLINE ComputeNode::Dispatcher::CData::
103CData() {
104}
105
106/**
107 *
108 */
109INLINE ComputeNode::Dispatcher::CData::
110CData(const ComputeNode::Dispatcher::CData &copy) :
111 _dispatches(copy._dispatches)
112{
113}
get_dispatch
Returns the group counts of the nth dispatch associated with this object.
Definition computeNode.h:41
void add_dispatch(const LVecBase3i &num_groups)
Adds a dispatch command with the given number of work groups in the X, Y, and Z dimensions.
Definition computeNode.I:20
get_num_dispatches
Returns the number of times add_dispatch has been called on this object.
Definition computeNode.h:41
void clear_dispatches()
Removes all dispatch commands.
Definition computeNode.I:40
insert_dispatch
Inserts a dispatch command with the given number of work groups in the X, Y, and Z dimensions at the ...
Definition computeNode.h:42
remove_dispatch
Erases the given dispatch index from the list.
Definition computeNode.h:42
set_dispatch
Sets the group counts of the nth dispatch associated with this object.
Definition computeNode.h:42
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...