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 
61 {
62 public:
63  /// \name Schema retrieval
64  /// @{
65 
66  HdExtComputationSchema(HdContainerDataSourceHandle container)
67  : HdSchema(container) {}
68 
69  /// Retrieves a container data source with the schema's default name token
70  /// "extComputation" from the parent container and constructs a
71  /// HdExtComputationSchema instance.
72  /// Because the requested container data source may not exist, the result
73  /// should be checked with IsDefined() or a bool comparison before use.
74  HD_API
76  const HdContainerDataSourceHandle &fromParentContainer);
77 
78  /// @}
79 
80 // --(BEGIN CUSTOM CODE: Schema Methods)--
81 // --(END CUSTOM CODE: Schema Methods)--
82 
83  /// \name Member accessor
84  /// @{
85 
86  HD_API
88 
89  HD_API
91 
92  HD_API
94 
95  HD_API
97 
98  HD_API
100 
101  HD_API
103 
104  HD_API
106 
107  /// @}
108 
109  /// \name Schema location
110  /// @{
111 
112  /// Returns a token where the container representing this schema is found in
113  /// a container by default.
114  HD_API
115  static const TfToken &GetSchemaToken();
116 
117  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
118  /// where the container representing this schema is found by default.
119  HD_API
120  static const HdDataSourceLocator &GetDefaultLocator();
121 
122  /// @}
123 
124  /// \name Data source locators for members
125  ///
126  /// The following methods return an HdDataSourceLocator (relative to the
127  /// prim-level data source) where the data source for a member can be found.
128  ///
129  /// This is often useful for checking intersection against the
130  /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
131  /// @{
132 
133  /// Prim-level relative data source locator to locate inputValues.
134  HD_API
136 
137  /// Prim-level relative data source locator to locate inputComputations.
138  HD_API
140 
141  /// Prim-level relative data source locator to locate outputs.
142  HD_API
143  static const HdDataSourceLocator &GetOutputsLocator();
144 
145  /// Prim-level relative data source locator to locate glslKernel.
146  HD_API
148 
149  /// Prim-level relative data source locator to locate cpuCallback.
150  HD_API
152 
153  /// Prim-level relative data source locator to locate dispatchCount.
154  HD_API
156 
157  /// Prim-level relative data source locator to locate elementCount.
158  HD_API
160  /// @}
161 
162  /// \name Schema construction
163  /// @{
164 
165  /// \deprecated Use Builder instead.
166  ///
167  /// Builds a container data source which includes the provided child data
168  /// sources. Parameters with nullptr values are excluded. This is a
169  /// low-level interface. For cases in which it's desired to define
170  /// the container with a sparse set of child fields, the Builder class
171  /// is often more convenient and readable.
172  HD_API
173  static HdContainerDataSourceHandle
175  const HdContainerDataSourceHandle &inputValues,
176  const HdContainerDataSourceHandle &inputComputations,
177  const HdContainerDataSourceHandle &outputs,
178  const HdStringDataSourceHandle &glslKernel,
180  const HdSizetDataSourceHandle &dispatchCount,
181  const HdSizetDataSourceHandle &elementCount
182  );
183 
184  /// \class HdExtComputationSchema::Builder
185  ///
186  /// Utility class for setting sparse sets of child data source fields to be
187  /// filled as arguments into BuildRetained. Because all setter methods
188  /// return a reference to the instance, this can be used in the "builder
189  /// pattern" form.
190  class Builder
191  {
192  public:
193  HD_API
195  const HdContainerDataSourceHandle &inputValues);
196  HD_API
198  const HdContainerDataSourceHandle &inputComputations);
199  HD_API
201  const HdContainerDataSourceHandle &outputs);
202  HD_API
204  const HdStringDataSourceHandle &glslKernel);
205  HD_API
208  HD_API
210  const HdSizetDataSourceHandle &dispatchCount);
211  HD_API
213  const HdSizetDataSourceHandle &elementCount);
214 
215  /// Returns a container data source containing the members set thus far.
216  HD_API
217  HdContainerDataSourceHandle Build();
218 
219  private:
220  HdContainerDataSourceHandle _inputValues;
221  HdContainerDataSourceHandle _inputComputations;
222  HdContainerDataSourceHandle _outputs;
223  HdStringDataSourceHandle _glslKernel;
225  HdSizetDataSourceHandle _dispatchCount;
226  HdSizetDataSourceHandle _elementCount;
227 
228  };
229 
230  /// @}
231 };
232 
234 
235 #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.
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
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
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