Panda3D
 All Classes Functions Variables Enumerations
computeNode.I
1 // Filename: computeNode.I
2 // Created by: rdb (20Jun14)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: ComputeNode::add_dispatch
18 // Access: Published
19 // Description: Adds a dispatch command with the given number of
20 // work groups in the X, Y, and Z dimensions. Any
21 // of these values may be set to 1 if the respective
22 // dimension should not be used.
23 ////////////////////////////////////////////////////////////////////
24 INLINE void ComputeNode::
25 add_dispatch(const LVecBase3i &num_groups) {
26  Dispatcher::CDWriter cdata(_dispatcher->_cycler);
27  cdata->_dispatches.push_back(num_groups);
28 }
29 
30 ////////////////////////////////////////////////////////////////////
31 // Function: ComputeNode::add_dispatch
32 // Access: Published
33 // Description: Adds a dispatch command with the given number of
34 // work groups in the X, Y, and Z dimensions. Any
35 // of these values may be set to 1 if the respective
36 // dimension should not be used.
37 ////////////////////////////////////////////////////////////////////
38 INLINE void ComputeNode::
39 add_dispatch(int num_groups_x, int num_groups_y, int num_groups_z) {
40  LVecBase3i num_groups(num_groups_x, num_groups_y, num_groups_z);
41  add_dispatch(num_groups);
42 }
43 
44 ////////////////////////////////////////////////////////////////////
45 // Function: ComputeNode::clear_dispatches
46 // Access: Published
47 // Description: Removes all dispatch commands.
48 ////////////////////////////////////////////////////////////////////
49 INLINE void ComputeNode::
51  Dispatcher::CDWriter cdata(_dispatcher->_cycler);
52  cdata->_dispatches.clear();
53 }
54 
55 ////////////////////////////////////////////////////////////////////
56 // Function: ComputeNode::get_num_dispatches
57 // Access: Published
58 // Description: Returns the number of times add_dispatch has been
59 // called on this object.
60 ////////////////////////////////////////////////////////////////////
61 INLINE int ComputeNode::
63  Dispatcher::CDReader cdata(_dispatcher->_cycler);
64  return cdata->_dispatches.size();
65 }
66 
67 ////////////////////////////////////////////////////////////////////
68 // Function: ComputeNode::get_dispatch
69 // Access: Published
70 // Description: Returns the group counts of the nth dispatch
71 // associated with this object.
72 ////////////////////////////////////////////////////////////////////
73 INLINE const LVecBase3i &ComputeNode::
74 get_dispatch(int n) const {
75  Dispatcher::CDReader cdata(_dispatcher->_cycler);
76  nassertr(n >= 0 && (size_t)n < cdata->_dispatches.size(), LVecBase3i::zero());
77  return cdata->_dispatches[n];
78 }
79 
80 ////////////////////////////////////////////////////////////////////
81 // Function: ComputeNode::Dispatcher::CData::Constructor
82 // Access: Public
83 // Description:
84 ////////////////////////////////////////////////////////////////////
85 INLINE ComputeNode::Dispatcher::CData::
86 CData() {
87 }
88 
89 ////////////////////////////////////////////////////////////////////
90 // Function: ComputeNode::Dispatcher::CData::Copy Constructor
91 // Access: Public
92 // Description:
93 ////////////////////////////////////////////////////////////////////
94 INLINE ComputeNode::Dispatcher::CData::
95 CData(const ComputeNode::Dispatcher::CData &copy) :
96  _dispatches(copy._dispatches)
97 {
98 }
void clear_dispatches()
Removes all dispatch commands.
Definition: computeNode.I:50
static const LVecBase3i & zero()
Returns a zero-length vector.
Definition: lvecBase3.h:3032
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
const LVecBase3i & get_dispatch(int i) const
Returns the group counts of the nth dispatch associated with this object.
Definition: computeNode.I:74
int get_num_dispatches() const
Returns the number of times add_dispatch has been called on this object.
Definition: computeNode.I:62
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:2756
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:25