HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rendererCreateArgsSchema.h
Go to the documentation of this file.
1 //
2 // Copyright 2025 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_RENDERER_CREATE_ARGS_SCHEMA_H
19 #define PXR_IMAGING_HD_RENDERER_CREATE_ARGS_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 // --(END CUSTOM CODE: Declares)--
35 
36 #define HD_RENDERER_CREATE_ARGS_SCHEMA_TOKENS \
37  (rendererCreateArgs) \
38  (gpuEnabled) \
39  (drivers) \
40  (hgi) \
41 
42 TF_DECLARE_PUBLIC_TOKENS(HdRendererCreateArgsSchemaTokens, HD_API,
44 
45 //-----------------------------------------------------------------------------
46 
47 
48 /// \class HdRendererCreateArgsSchema
49 ///
50 /// Arguments to HdRendererPlugin::IsSupported and CreateRenderer.
51 ///
53 {
54 public:
55  /// \name Schema retrieval
56  /// @{
57 
58  HdRendererCreateArgsSchema(HdContainerDataSourceHandle container)
59  : HdSchema(container) {}
60 
61  /// Retrieves a container data source with the schema's default name token
62  /// "rendererCreateArgs" from the parent container and constructs a
63  /// HdRendererCreateArgsSchema instance.
64  /// Because the requested container data source may not exist, the result
65  /// should be checked with IsDefined() or a bool comparison before use.
66  HD_API
68  const HdContainerDataSourceHandle &fromParentContainer);
69 
70  /// @}
71 
72 // --(BEGIN CUSTOM CODE: Schema Methods)--
73 // --(END CUSTOM CODE: Schema Methods)--
74 
75  /// \name Member accessor
76  /// @{
77 
78  /// Is a GPU available.
79  HD_API
81 
82  /// Drivers such as Hgi that renderer can use.
83  HD_API
85 
86  /// @}
87 
88  /// \name Schema location
89  /// @{
90 
91  /// Returns a token where the container representing this schema is found in
92  /// a container by default.
93  HD_API
94  static const TfToken &GetSchemaToken();
95 
96  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
97  /// where the container representing this schema is found by default.
98  HD_API
99  static const HdDataSourceLocator &GetDefaultLocator();
100 
101  /// @}
102 
103  /// \name Data source locators for members
104  ///
105  /// The following methods return an HdDataSourceLocator (relative to the
106  /// prim-level data source) where the data source for a member can be found.
107  ///
108  /// This is often useful for checking intersection against the
109  /// HdDataSourceLocatorSet sent with HdDataSourceObserver::PrimsDirtied.
110  /// @{
111 
112  /// Prim-level relative data source locator to locate gpuEnabled.
113  HD_API
115 
116  /// Prim-level relative data source locator to locate drivers.
117  HD_API
118  static const HdDataSourceLocator &GetDriversLocator();
119  /// @}
120 
121  /// \name Schema construction
122  /// @{
123 
124  /// \deprecated Use Builder instead.
125  ///
126  /// Builds a container data source which includes the provided child data
127  /// sources. Parameters with nullptr values are excluded. This is a
128  /// low-level interface. For cases in which it's desired to define
129  /// the container with a sparse set of child fields, the Builder class
130  /// is often more convenient and readable.
131  HD_API
132  static HdContainerDataSourceHandle
134  const HdBoolDataSourceHandle &gpuEnabled,
135  const HdContainerDataSourceHandle &drivers
136  );
137 
138  /// \class HdRendererCreateArgsSchema::Builder
139  ///
140  /// Utility class for setting sparse sets of child data source fields to be
141  /// filled as arguments into BuildRetained. Because all setter methods
142  /// return a reference to the instance, this can be used in the "builder
143  /// pattern" form.
144  class Builder
145  {
146  public:
147  HD_API
149  const HdBoolDataSourceHandle &gpuEnabled);
150  HD_API
152  const HdContainerDataSourceHandle &drivers);
153 
154  /// Returns a container data source containing the members set thus far.
155  HD_API
156  HdContainerDataSourceHandle Build();
157 
158  private:
159  HdBoolDataSourceHandle _gpuEnabled;
160  HdContainerDataSourceHandle _drivers;
161 
162  };
163 
164  /// @}
165 };
166 
168 
169 #endif
static HD_API const HdDataSourceLocator & GetDefaultLocator()
static HD_API HdContainerDataSourceHandle BuildRetained(const HdBoolDataSourceHandle &gpuEnabled, const HdContainerDataSourceHandle &drivers)
#define HD_RENDERER_CREATE_ARGS_SCHEMA_TOKENS
HD_API HdBoolDataSourceHandle GetGpuEnabled() const
Is a GPU available.
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
HD_API HdSampledDataSourceContainerSchema GetDrivers() const
Drivers such as Hgi that renderer can use.
#define HD_API
Definition: api.h:23
HD_API Builder & SetGpuEnabled(const HdBoolDataSourceHandle &gpuEnabled)
static HD_API HdRendererCreateArgsSchema GetFromParent(const HdContainerDataSourceHandle &fromParentContainer)
Definition: token.h:70
HdBoolDataSource::Handle HdBoolDataSourceHandle
static HD_API const TfToken & GetSchemaToken()
TF_DECLARE_PUBLIC_TOKENS(HdRendererCreateArgsSchemaTokens, HD_API, HD_RENDERER_CREATE_ARGS_SCHEMA_TOKENS)
HdRendererCreateArgsSchema(HdContainerDataSourceHandle container)
HD_API Builder & SetDrivers(const HdContainerDataSourceHandle &drivers)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
static HD_API const HdDataSourceLocator & GetDriversLocator()
Prim-level relative data source locator to locate drivers.
HD_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
static HD_API const HdDataSourceLocator & GetGpuEnabledLocator()
Prim-level relative data source locator to locate gpuEnabled.