All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
renderDelegate.h
1 //
2 // Copyright 2017 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 #ifndef PXR_IMAGING_HD_ST_RENDER_DELEGATE_H
24 #define PXR_IMAGING_HD_ST_RENDER_DELEGATE_H
25 
26 #include "pxr/pxr.h"
27 #include "pxr/imaging/hdSt/api.h"
28 #include "pxr/imaging/hd/renderDelegate.h"
29 
30 #include <memory>
31 #include <mutex>
32 
33 PXR_NAMESPACE_OPEN_SCOPE
34 
35 class Hgi;
36 class HdStRenderParam;
37 
38 using HdStResourceRegistrySharedPtr =
39  std::shared_ptr<class HdStResourceRegistry>;
40 
48 class HdStRenderDelegate final : public HdRenderDelegate {
49 public:
50  HDST_API
52  HDST_API
53  HdStRenderDelegate(HdRenderSettingsMap const& settingsMap);
54 
55  HDST_API
56  virtual ~HdStRenderDelegate();
57 
58  // ---------------------------------------------------------------------- //
60  // ---------------------------------------------------------------------- //
61 
62  HDST_API
63  virtual void SetDrivers(HdDriverVector const& drivers) override;
64 
65  HDST_API
66  virtual HdRenderParam *GetRenderParam() const override;
67 
68  HDST_API
69  virtual const TfTokenVector &GetSupportedRprimTypes() const override;
70  HDST_API
71  virtual const TfTokenVector &GetSupportedSprimTypes() const override;
72  HDST_API
73  virtual const TfTokenVector &GetSupportedBprimTypes() const override;
74  HDST_API
75  virtual HdResourceRegistrySharedPtr GetResourceRegistry() const override;
76 
77  HDST_API
78  virtual HdRenderPassSharedPtr CreateRenderPass(HdRenderIndex *index,
79  HdRprimCollection const& collection) override;
80  HDST_API
81  virtual HdRenderPassStateSharedPtr CreateRenderPassState() const override;
82 
83  HDST_API
84  virtual HdInstancer *CreateInstancer(HdSceneDelegate *delegate,
85  SdfPath const& id) override;
86 
87  HDST_API
88  virtual void DestroyInstancer(HdInstancer *instancer) override;
89 
90  HDST_API
91  virtual HdRprim *CreateRprim(TfToken const& typeId,
92  SdfPath const& rprimId) override;
93  HDST_API
94  virtual void DestroyRprim(HdRprim *rPrim) override;
95 
96  HDST_API
97  virtual HdSprim *CreateSprim(TfToken const& typeId,
98  SdfPath const& sprimId) override;
99  HDST_API
100  virtual HdSprim *CreateFallbackSprim(TfToken const& typeId) override;
101  HDST_API
102  virtual void DestroySprim(HdSprim *sPrim) override;
103 
104  HDST_API
105  virtual HdBprim *CreateBprim(TfToken const& typeId,
106  SdfPath const& bprimId) override;
107  HDST_API
108  virtual HdBprim *CreateFallbackBprim(TfToken const& typeId) override;
109  HDST_API
110  virtual void DestroyBprim(HdBprim *bPrim) override;
111 
112  HDST_API
113  virtual void CommitResources(HdChangeTracker *tracker) override;
114 
115  HDST_API
116  virtual TfTokenVector GetMaterialRenderContexts() const override;
117 
118  HDST_API
119  virtual TfTokenVector GetShaderSourceTypes() const override;
120 
121  HDST_API
122  virtual bool IsPrimvarFilteringNeeded() const override;
123 
124  HDST_API
125  virtual HdRenderSettingDescriptorList
126  GetRenderSettingDescriptors() const override;
127 
128  HDST_API
129  virtual VtDictionary GetRenderStats() const override;
130 
131  HDST_API
132  virtual HdAovDescriptor
133  GetDefaultAovDescriptor(TfToken const& name) const override;
134 
135  // ---------------------------------------------------------------------- //
137  // ---------------------------------------------------------------------- //
138 
139  // Returns whether or not HdStRenderDelegate can run on the current
140  // hardware.
141  HDST_API
142  static bool IsSupported();
143 
144  // Returns Hydra graphics interface
145  HDST_API
146  Hgi* GetHgi();
147 
148 private:
149  void _ApplyTextureSettings();
150  HdSprim *_CreateFallbackMaterialPrim();
151 
152  HdStRenderDelegate(const HdStRenderDelegate &) = delete;
153  HdStRenderDelegate &operator =(const HdStRenderDelegate &) = delete;
154 
155  static const TfTokenVector SUPPORTED_RPRIM_TYPES;
156  static const TfTokenVector SUPPORTED_SPRIM_TYPES;
157 
158  // Resource registry used in this render delegate
159  HdStResourceRegistrySharedPtr _resourceRegistry;
160 
161  HdRenderSettingDescriptorList _settingDescriptors;
162 
163  Hgi* _hgi;
164 
165  std::unique_ptr<HdStRenderParam> _renderParam;
166 };
167 
168 
169 PXR_NAMESPACE_CLOSE_SCOPE
170 
171 #endif // PXR_IMAGING_HD_ST_RENDER_DELEGATE_H
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:116
Tracks changes from the HdSceneDelegate, providing invalidation cues to the render engine...
Definition: changeTracker.h:50
This class exists to facilitate point cloud style instancing.
Definition: instancer.h:124
A map with string keys and VtValue values.
Definition: dictionary.h:63
The HdRenderParam is an opaque (to core Hydra) handle, to an object that is obtained from the render ...
HdStRenderDelegate.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
The render engine state for a given rprim from the scene graph.
Definition: rprim.h:68
The render delegate can create an object of type HdRenderParam, to pass to each prim during Sync()...
Definition: renderParam.h:42
Adapter class providing data exchange with the client scene graph.
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
A named, semantic collection of objects.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:288
Sprim (state prim) is a base class of managing state for non-drawable scene entity (e...
Definition: sprim.h:52
Hydra Graphics Interface.
Definition: hgi.h:106
Bprim (buffer prim) is a base class of managing a blob of data that is used to communicate between th...
Definition: bprim.h:56
A bundle of state describing an AOV (&quot;Arbitrary Output Variable&quot;) display channel.
Definition: aov.h:46