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 /* ** ** */
28 /* ** This file is generated by a script. ** */
29 /* ** ** */
30 /* ** Do not edit it directly (unless it is within a CUSTOM CODE section)! ** */
31 /* ** Edit hdGen/schema.py instead to make changes. ** */
32 /* ** ** */
33 /* ************************************************************************** */
34 
35 #ifndef PXR_IMAGING_HD_EXT_COMPUTATION_SCHEMA_H
36 #define PXR_IMAGING_HD_EXT_COMPUTATION_SCHEMA_H
37 
38 #include "pxr/imaging/hd/api.h"
39 
40 #include "pxr/imaging/hd/schema.h"
41 
42 // --(BEGIN CUSTOM CODE: Includes)--
43 // --(END CUSTOM CODE: Includes)--
44 
46 
47 //-----------------------------------------------------------------------------
48 
49 // --(BEGIN CUSTOM CODE: Declares)--
50 // --(END CUSTOM CODE: Declares)--
51 
52 //-----------------------------------------------------------------------------
53 
54 #define HD_EXT_COMPUTATION_SCHEMA_TOKENS \
55  (extComputation) \
56  (inputValues) \
57  (inputComputations) \
58  (outputs) \
59  (glslKernel) \
60  (cpuCallback) \
61  (dispatchCount) \
62  (elementCount) \
63 
64 TF_DECLARE_PUBLIC_TOKENS(HdExtComputationSchemaTokens, HD_API,
66 
67 //-----------------------------------------------------------------------------
69 {
70 public:
71  HdExtComputationSchema(HdContainerDataSourceHandle container)
72  : HdSchema(container) {}
73 
74 // --(BEGIN CUSTOM CODE: Schema Methods)--
75 // --(END CUSTOM CODE: Schema Methods)--
76 
77  //ACCESSORS
78 
79 
80  HD_API
81  HdContainerDataSourceHandle GetInputValues();
82 
83  HD_API
84  HdVectorDataSourceHandle GetInputComputations();
85 
86  HD_API
87  HdVectorDataSourceHandle GetOutputs();
88 
89  HD_API
91 
92  HD_API
93  HdDataSourceBaseHandle GetCpuCallback();
94 
95  HD_API
97 
98  HD_API
100 
101  // RETRIEVING AND CONSTRUCTING
102 
103  /// Builds a container data source which includes the provided child data
104  /// sources. Parameters with nullptr values are excluded. This is a
105  /// low-level interface. For cases in which it's desired to define
106  /// the container with a sparse set of child fields, the Builder class
107  /// is often more convenient and readable.
108  HD_API
109  static HdContainerDataSourceHandle
111  const HdContainerDataSourceHandle &inputValues,
112  const HdVectorDataSourceHandle &inputComputations,
113  const HdVectorDataSourceHandle &outputs,
114  const HdStringDataSourceHandle &glslKernel,
115  const HdDataSourceBaseHandle &cpuCallback,
116  const HdSizetDataSourceHandle &dispatchCount,
117  const HdSizetDataSourceHandle &elementCount
118  );
119 
120  /// \class HdExtComputationSchema::Builder
121  ///
122  /// Utility class for setting sparse sets of child data source fields to be
123  /// filled as arguments into BuildRetained. Because all setter methods
124  /// return a reference to the instance, this can be used in the "builder
125  /// pattern" form.
126  class Builder
127  {
128  public:
129  HD_API
131  const HdContainerDataSourceHandle &inputValues);
132  HD_API
134  const HdVectorDataSourceHandle &inputComputations);
135  HD_API
137  const HdVectorDataSourceHandle &outputs);
138  HD_API
140  const HdStringDataSourceHandle &glslKernel);
141  HD_API
143  const HdDataSourceBaseHandle &cpuCallback);
144  HD_API
146  const HdSizetDataSourceHandle &dispatchCount);
147  HD_API
149  const HdSizetDataSourceHandle &elementCount);
150 
151  /// Returns a container data source containing the members set thus far.
152  HD_API
153  HdContainerDataSourceHandle Build();
154 
155  private:
156  HdContainerDataSourceHandle _inputValues;
157  HdVectorDataSourceHandle _inputComputations;
158  HdVectorDataSourceHandle _outputs;
159  HdStringDataSourceHandle _glslKernel;
160  HdDataSourceBaseHandle _cpuCallback;
161  HdSizetDataSourceHandle _dispatchCount;
162  HdSizetDataSourceHandle _elementCount;
163  };
164 
165  /// Retrieves a container data source with the schema's default name token
166  /// "extComputation" from the parent container and constructs a
167  /// HdExtComputationSchema instance.
168  /// Because the requested container data source may not exist, the result
169  /// should be checked with IsDefined() or a bool comparison before use.
170  HD_API
172  const HdContainerDataSourceHandle &fromParentContainer);
173 
174  /// Returns a token where the container representing this schema is found in
175  /// a container by default.
176  HD_API
177  static const TfToken &GetSchemaToken();
178 
179  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
180  /// where the container representing this schema is found by default.
181  HD_API
182  static const HdDataSourceLocator &GetDefaultLocator();
183 
184  // DATA SOURCE LOCATORS FOR MEMBERS
185  //
186  // The following methods return an HdDataSourceLocator (relative to the
187  // prim-level data source) where the data source for a member can be found.
188  //
189  // This is often useful for checking intersection against the
190  // HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
191 
192 
193  /// Prim-level relative data source locator to locate inputValues.
194  HD_API
196 
197  /// Prim-level relative data source locator to locate inputComputations.
198  HD_API
200 
201  /// Prim-level relative data source locator to locate outputs.
202  HD_API
203  static const HdDataSourceLocator &GetOutputsLocator();
204 
205  /// Prim-level relative data source locator to locate glslKernel.
206  HD_API
208 
209  /// Prim-level relative data source locator to locate cpuCallback.
210  HD_API
212 
213  /// Prim-level relative data source locator to locate dispatchCount.
214  HD_API
216 
217  /// Prim-level relative data source locator to locate elementCount.
218  HD_API
220 
221 
222 };
223 
225 
226 #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()
HD_API Builder & SetElementCount(const HdSizetDataSourceHandle &elementCount)
static HD_API const HdDataSourceLocator & GetGlslKernelLocator()
Prim-level relative data source locator to locate glslKernel.
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()
TF_DECLARE_PUBLIC_TOKENS(HdExtComputationSchemaTokens, HD_API, HD_EXT_COMPUTATION_SCHEMA_TOKENS)
static HD_API const HdDataSourceLocator & GetDispatchCountLocator()
Prim-level relative data source locator to locate dispatchCount.
static HD_API const HdDataSourceLocator & GetCpuCallbackLocator()
Prim-level relative data source locator to locate cpuCallback.
static HD_API const HdDataSourceLocator & GetElementCountLocator()
Prim-level relative data source locator to locate elementCount.
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:1432
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()
Prim-level relative data source locator to locate inputValues.
HD_API Builder & SetCpuCallback(const HdDataSourceBaseHandle &cpuCallback)
HdSizetDataSource::Handle HdSizetDataSourceHandle
static HD_API const HdDataSourceLocator & GetInputComputationsLocator()
Prim-level relative data source locator to locate inputComputations.
HD_API Builder & SetInputValues(const HdContainerDataSourceHandle &inputValues)
static HD_API const HdDataSourceLocator & GetOutputsLocator()
Prim-level relative data source locator to locate outputs.
#define HD_EXT_COMPUTATION_SCHEMA_TOKENS