HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
extComputationSchema.h
Go to the documentation of this file.
1 //
2 // Copyright 2023 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 /* ************************************************************************** */
27 /* ** This file is generated by a script. Do not edit directly. Edit ** */
28 /* ** defs.py or the (*)Schema.template.h files to make changes. ** */
29 /* ************************************************************************** */
30 
31 #ifndef PXR_IMAGING_HD_EXT_COMPUTATION_SCHEMA_H
32 #define PXR_IMAGING_HD_EXT_COMPUTATION_SCHEMA_H
33 
34 #include "pxr/imaging/hd/api.h"
35 
36 #include "pxr/imaging/hd/schema.h"
37 
39 
40 //-----------------------------------------------------------------------------
41 
42 #define HDEXTCOMPUTATION_SCHEMA_TOKENS \
43  (extComputation) \
44  (inputValues) \
45  (inputComputations) \
46  (outputs) \
47  (glslKernel) \
48  (cpuCallback) \
49  (dispatchCount) \
50  (elementCount) \
51 
52 TF_DECLARE_PUBLIC_TOKENS(HdExtComputationSchemaTokens, HD_API,
54 
55 //-----------------------------------------------------------------------------
56 
58 {
59 public:
60  HdExtComputationSchema(HdContainerDataSourceHandle container)
61  : HdSchema(container) {}
62 
63  //ACCESSORS
64 
65  HD_API
66  HdContainerDataSourceHandle GetInputValues();
67  HD_API
68  HdVectorDataSourceHandle GetInputComputations();
69  HD_API
70  HdVectorDataSourceHandle GetOutputs();
71  HD_API
73  HD_API
74  HdDataSourceBaseHandle GetCpuCallback();
75  HD_API
77  HD_API
79 
80  // RETRIEVING AND CONSTRUCTING
81 
82  /// Builds a container data source which includes the provided child data
83  /// sources. Parameters with nullptr values are excluded. This is a
84  /// low-level interface. For cases in which it's desired to define
85  /// the container with a sparse set of child fields, the Builder class
86  /// is often more convenient and readable.
87  HD_API
88  static HdContainerDataSourceHandle
90  const HdContainerDataSourceHandle &inputValues,
91  const HdVectorDataSourceHandle &inputComputations,
92  const HdVectorDataSourceHandle &outputs,
93  const HdStringDataSourceHandle &glslKernel,
94  const HdDataSourceBaseHandle &cpuCallback,
95  const HdSizetDataSourceHandle &dispatchCount,
96  const HdSizetDataSourceHandle &elementCount
97  );
98 
99  /// \class HdExtComputationSchema::Builder
100  ///
101  /// Utility class for setting sparse sets of child data source fields to be
102  /// filled as arguments into BuildRetained. Because all setter methods
103  /// return a reference to the instance, this can be used in the "builder
104  /// pattern" form.
105  class Builder
106  {
107  public:
108  HD_API
110  const HdContainerDataSourceHandle &inputValues);
111  HD_API
113  const HdVectorDataSourceHandle &inputComputations);
114  HD_API
116  const HdVectorDataSourceHandle &outputs);
117  HD_API
119  const HdStringDataSourceHandle &glslKernel);
120  HD_API
122  const HdDataSourceBaseHandle &cpuCallback);
123  HD_API
125  const HdSizetDataSourceHandle &dispatchCount);
126  HD_API
128  const HdSizetDataSourceHandle &elementCount);
129 
130  /// Returns a container data source containing the members set thus far.
131  HD_API
132  HdContainerDataSourceHandle Build();
133 
134  private:
135  HdContainerDataSourceHandle _inputValues;
136  HdVectorDataSourceHandle _inputComputations;
137  HdVectorDataSourceHandle _outputs;
138  HdStringDataSourceHandle _glslKernel;
139  HdDataSourceBaseHandle _cpuCallback;
140  HdSizetDataSourceHandle _dispatchCount;
141  HdSizetDataSourceHandle _elementCount;
142  };
143 
144  /// Retrieves a container data source with the schema's default name token
145  /// "extComputation" from the parent container and constructs a
146  /// HdExtComputationSchema instance.
147  /// Because the requested container data source may not exist, the result
148  /// should be checked with IsDefined() or a bool comparison before use.
149  HD_API
151  const HdContainerDataSourceHandle &fromParentContainer);
152 
153  /// Returns a token where the container representing this schema is found in
154  /// a container by default.
155  HD_API
156  static const TfToken &GetSchemaToken();
157 
158  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
159  /// where the container representing this schema is found by default.
160  HD_API
161  static const HdDataSourceLocator &GetDefaultLocator();
162 
163 
164  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
165  /// where the inputvalues data source can be found.
166  /// This is often useful for checking intersection against the
167  /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
168  HD_API
170 
171  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
172  /// where the inputcomputations data source can be found.
173  /// This is often useful for checking intersection against the
174  /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
175  HD_API
177 
178  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
179  /// where the outputs data source can be found.
180  /// This is often useful for checking intersection against the
181  /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
182  HD_API
183  static const HdDataSourceLocator &GetOutputsLocator();
184 
185  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
186  /// where the dispatchcount data source can be found.
187  /// This is often useful for checking intersection against the
188  /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
189  HD_API
191 
192  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
193  /// where the elementcount data source can be found.
194  /// This is often useful for checking intersection against the
195  /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
196  HD_API
198 
199  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
200  /// where the glslkernel data source can be found.
201  /// This is often useful for checking intersection against the
202  /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
203  HD_API
205 
206 };
207 
209 
210 #endif
static HD_API HdContainerDataSourceHandle BuildRetained(const HdContainerDataSourceHandle &inputValues, const HdVectorDataSourceHandle &inputComputations, const HdVectorDataSourceHandle &outputs, const HdStringDataSourceHandle &glslKernel, const HdDataSourceBaseHandle &cpuCallback, const HdSizetDataSourceHandle &dispatchCount, const HdSizetDataSourceHandle &elementCount)
HD_API Builder & SetDispatchCount(const HdSizetDataSourceHandle &dispatchCount)
HD_API HdStringDataSourceHandle GetGlslKernel()
HD_API HdContainerDataSourceHandle GetInputValues()
#define HDEXTCOMPUTATION_SCHEMA_TOKENS
HD_API Builder & SetElementCount(const HdSizetDataSourceHandle &elementCount)
static HD_API const HdDataSourceLocator & GetGlslKernelLocator()
TF_DECLARE_PUBLIC_TOKENS(HdExtComputationSchemaTokens, HD_API, HDEXTCOMPUTATION_SCHEMA_TOKENS)
HdStringDataSource::Handle HdStringDataSourceHandle
HD_API HdSizetDataSourceHandle GetDispatchCount()
#define HD_API
Definition: api.h:40
HD_API Builder & SetOutputs(const HdVectorDataSourceHandle &outputs)
static HD_API const TfToken & GetSchemaToken()
static HD_API const HdDataSourceLocator & GetDispatchCountLocator()
static HD_API const HdDataSourceLocator & GetElementCountLocator()
Definition: token.h:87
HD_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
HD_API Builder & SetInputComputations(const HdVectorDataSourceHandle &inputComputations)
HD_API HdSizetDataSourceHandle GetElementCount()
HD_API HdVectorDataSourceHandle GetInputComputations()
HdExtComputationSchema(HdContainerDataSourceHandle container)
HD_API Builder & SetGlslKernel(const HdStringDataSourceHandle &glslKernel)
HD_API HdDataSourceBaseHandle GetCpuCallback()
HD_API HdVectorDataSourceHandle GetOutputs()
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1441
static HD_API const HdDataSourceLocator & GetDefaultLocator()
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
static HD_API HdExtComputationSchema GetFromParent(const HdContainerDataSourceHandle &fromParentContainer)
static HD_API const HdDataSourceLocator & GetInputValuesLocator()
HD_API Builder & SetCpuCallback(const HdDataSourceBaseHandle &cpuCallback)
HdSizetDataSource::Handle HdSizetDataSourceHandle
static HD_API const HdDataSourceLocator & GetInputComputationsLocator()
HD_API Builder & SetInputValues(const HdContainerDataSourceHandle &inputValues)
static HD_API const HdDataSourceLocator & GetOutputsLocator()