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 terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 ////////////////////////////////////////////////////////////////////////
8 
9 /* ************************************************************************** */
10 /* ** ** */
11 /* ** This file is generated by a script. ** */
12 /* ** ** */
13 /* ** Do not edit it directly (unless it is within a CUSTOM CODE section)! ** */
14 /* ** Edit hdSchemaDefs.py instead to make changes. ** */
15 /* ** ** */
16 /* ************************************************************************** */
17 
18 #ifndef PXR_IMAGING_HD_EXT_COMPUTATION_SCHEMA_H
19 #define PXR_IMAGING_HD_EXT_COMPUTATION_SCHEMA_H
20 
21 /// \file
22 
23 #include "pxr/imaging/hd/api.h"
25 
26 #include "pxr/imaging/hd/schema.h"
27 
28 // --(BEGIN CUSTOM CODE: Includes)--
29 // --(END CUSTOM CODE: Includes)--
30 
32 
33 // --(BEGIN CUSTOM CODE: Declares)--
34 
36  std::shared_ptr<class HdExtComputationCpuCallback>;
41 
42 // --(END CUSTOM CODE: Declares)--
43 
44 #define HD_EXT_COMPUTATION_SCHEMA_TOKENS \
45  (extComputation) \
46  (inputValues) \
47  (inputComputations) \
48  (outputs) \
49  (glslKernel) \
50  (cpuCallback) \
51  (dispatchCount) \
52  (elementCount) \
53 
54 TF_DECLARE_PUBLIC_TOKENS(HdExtComputationSchemaTokens, HD_API,
56 
57 //-----------------------------------------------------------------------------
58 
59 
60 /// \class HdExtComputationSchema
61 ///
63 {
64 public:
65  /// \name Schema retrieval
66  /// @{
67 
68  HdExtComputationSchema(HdContainerDataSourceHandle container)
69  : HdSchema(container) {}
70 
71  /// Retrieves a container data source with the schema's default name token
72  /// "extComputation" from the parent container and constructs a
73  /// HdExtComputationSchema instance.
74  /// Because the requested container data source may not exist, the result
75  /// should be checked with IsDefined() or a bool comparison before use.
76  HD_API
78  const HdContainerDataSourceHandle &fromParentContainer);
79 
80  /// @}
81 
82 // --(BEGIN CUSTOM CODE: Schema Methods)--
83 // --(END CUSTOM CODE: Schema Methods)--
84 
85  /// \name Member accessor
86  /// @{
87 
88  HD_API
90 
91  HD_API
93 
94  HD_API
96 
97  HD_API
99 
100  HD_API
102 
103  HD_API
105 
106  HD_API
108 
109  /// @}
110 
111  /// \name Schema location
112  /// @{
113 
114  /// Returns a token where the container representing this schema is found in
115  /// a container by default.
116  HD_API
117  static const TfToken &GetSchemaToken();
118 
119  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
120  /// where the container representing this schema is found by default.
121  HD_API
122  static const HdDataSourceLocator &GetDefaultLocator();
123 
124  /// @}
125 
126  /// \name Data source locators for members
127  ///
128  /// The following methods return an HdDataSourceLocator (relative to the
129  /// prim-level data source) where the data source for a member can be found.
130  ///
131  /// This is often useful for checking intersection against the
132  /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
133  /// @{
134 
135  /// Prim-level relative data source locator to locate inputValues.
136  HD_API
138 
139  /// Prim-level relative data source locator to locate inputComputations.
140  HD_API
142 
143  /// Prim-level relative data source locator to locate outputs.
144  HD_API
145  static const HdDataSourceLocator &GetOutputsLocator();
146 
147  /// Prim-level relative data source locator to locate glslKernel.
148  HD_API
150 
151  /// Prim-level relative data source locator to locate cpuCallback.
152  HD_API
154 
155  /// Prim-level relative data source locator to locate dispatchCount.
156  HD_API
158 
159  /// Prim-level relative data source locator to locate elementCount.
160  HD_API
162  /// @}
163 
164  /// \name Schema construction
165  /// @{
166 
167  /// \deprecated Use Builder instead.
168  ///
169  /// Builds a container data source which includes the provided child data
170  /// sources. Parameters with nullptr values are excluded. This is a
171  /// low-level interface. For cases in which it's desired to define
172  /// the container with a sparse set of child fields, the Builder class
173  /// is often more convenient and readable.
174  HD_API
175  static HdContainerDataSourceHandle
177  const HdContainerDataSourceHandle &inputValues,
178  const HdContainerDataSourceHandle &inputComputations,
179  const HdContainerDataSourceHandle &outputs,
180  const HdStringDataSourceHandle &glslKernel,
182  const HdSizetDataSourceHandle &dispatchCount,
183  const HdSizetDataSourceHandle &elementCount
184  );
185 
186  /// \class HdExtComputationSchema::Builder
187  ///
188  /// Utility class for setting sparse sets of child data source fields to be
189  /// filled as arguments into BuildRetained. Because all setter methods
190  /// return a reference to the instance, this can be used in the "builder
191  /// pattern" form.
192  class Builder
193  {
194  public:
195  HD_API
197  const HdContainerDataSourceHandle &inputValues);
198  HD_API
200  const HdContainerDataSourceHandle &inputComputations);
201  HD_API
203  const HdContainerDataSourceHandle &outputs);
204  HD_API
206  const HdStringDataSourceHandle &glslKernel);
207  HD_API
210  HD_API
212  const HdSizetDataSourceHandle &dispatchCount);
213  HD_API
215  const HdSizetDataSourceHandle &elementCount);
216 
217  /// Returns a container data source containing the members set thus far.
218  HD_API
219  HdContainerDataSourceHandle Build();
220 
221  private:
222  HdContainerDataSourceHandle _inputValues;
223  HdContainerDataSourceHandle _inputComputations;
224  HdContainerDataSourceHandle _outputs;
225  HdStringDataSourceHandle _glslKernel;
227  HdSizetDataSourceHandle _dispatchCount;
228  HdSizetDataSourceHandle _elementCount;
229 
230  };
231 
232  /// @}
233 };
234 
236 
237 #endif
HD_API Builder & SetDispatchCount(const HdSizetDataSourceHandle &dispatchCount)
HD_API HdExtComputationInputComputationContainerSchema GetInputComputations() const
HD_API Builder & SetElementCount(const HdSizetDataSourceHandle &elementCount)
static HD_API const HdDataSourceLocator & GetGlslKernelLocator()
Prim-level relative data source locator to locate glslKernel.
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
HD_API Builder & SetInputComputations(const HdContainerDataSourceHandle &inputComputations)
HdStringDataSource::Handle HdStringDataSourceHandle
HD_API HdSizetDataSourceHandle GetDispatchCount() const
#define HD_API
Definition: api.h:23
HD_API Builder & SetCpuCallback(const HdExtComputationCpuCallbackDataSourceHandle &cpuCallback)
static HD_API const TfToken & GetSchemaToken()
HD_API HdExtComputationCpuCallbackDataSourceHandle GetCpuCallback() const
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.
HD_API HdSampledDataSourceContainerSchema GetInputValues() const
static HD_API const HdDataSourceLocator & GetElementCountLocator()
Prim-level relative data source locator to locate elementCount.
HD_API HdStringDataSourceHandle GetGlslKernel() const
std::shared_ptr< class HdExtComputationCpuCallback > HdExtComputationCpuCallbackSharedPtr
Definition: token.h:70
HD_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
HD_API HdExtComputationOutputContainerSchema GetOutputs() const
HdExtComputationSchema(HdContainerDataSourceHandle container)
HD_API Builder & SetGlslKernel(const HdStringDataSourceHandle &glslKernel)
HdExtComputationCpuCallbackDataSource::Handle HdExtComputationCpuCallbackDataSourceHandle
static HD_API const HdDataSourceLocator & GetDefaultLocator()
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
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 & SetOutputs(const HdContainerDataSourceHandle &outputs)
static HD_API HdContainerDataSourceHandle BuildRetained(const HdContainerDataSourceHandle &inputValues, const HdContainerDataSourceHandle &inputComputations, const HdContainerDataSourceHandle &outputs, const HdStringDataSourceHandle &glslKernel, const HdExtComputationCpuCallbackDataSourceHandle &cpuCallback, const HdSizetDataSourceHandle &dispatchCount, const HdSizetDataSourceHandle &elementCount)
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.
HD_API HdSizetDataSourceHandle GetElementCount() const
#define HD_EXT_COMPUTATION_SCHEMA_TOKENS
void * Handle
Definition: plugin.h:27