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 HDST_RENDER_DELEGATE_H
24 #define HDST_RENDER_DELEGATE_H
25 
26 #include "pxr/pxr.h"
27 #include "pxr/imaging/hgiGL/hgi.h"
28 #include "pxr/imaging/hdSt/api.h"
29 #include "pxr/imaging/hd/renderDelegate.h"
30 
31 #include <mutex>
32 
33 PXR_NAMESPACE_OPEN_SCOPE
34 
35 typedef boost::shared_ptr<class HdStResourceRegistry>
36  HdStResourceRegistrySharedPtr;
37 
44 class HdStRenderDelegate final : public HdRenderDelegate {
45 public:
46  HDST_API
48  HDST_API
49  HdStRenderDelegate(HdRenderSettingsMap const& settingsMap);
50 
51  HDST_API
52  virtual ~HdStRenderDelegate();
53 
54  HDST_API
55  virtual HdRenderParam *GetRenderParam() const override;
56 
57  HDST_API
58  virtual const TfTokenVector &GetSupportedRprimTypes() const override;
59  HDST_API
60  virtual const TfTokenVector &GetSupportedSprimTypes() const override;
61  HDST_API
62  virtual const TfTokenVector &GetSupportedBprimTypes() const override;
63  HDST_API
64  virtual HdResourceRegistrySharedPtr GetResourceRegistry() const override;
65 
66  HDST_API
67  virtual HdRenderPassSharedPtr CreateRenderPass(HdRenderIndex *index,
68  HdRprimCollection const& collection) override;
69  HDST_API
70  virtual HdRenderPassStateSharedPtr CreateRenderPassState() const override;
71 
72  HDST_API
73  virtual HdInstancer *CreateInstancer(HdSceneDelegate *delegate,
74  SdfPath const& id,
75  SdfPath const& instancerId) override;
76 
77  HDST_API
78  virtual void DestroyInstancer(HdInstancer *instancer) override;
79 
80  HDST_API
81  virtual HdRprim *CreateRprim(TfToken const& typeId,
82  SdfPath const& rprimId,
83  SdfPath const& instancerId) override;
84  HDST_API
85  virtual void DestroyRprim(HdRprim *rPrim) override;
86 
87  HDST_API
88  virtual HdSprim *CreateSprim(TfToken const& typeId,
89  SdfPath const& sprimId) override;
90  HDST_API
91  virtual HdSprim *CreateFallbackSprim(TfToken const& typeId) override;
92  HDST_API
93  virtual void DestroySprim(HdSprim *sPrim) override;
94 
95  HDST_API
96  virtual HdBprim *CreateBprim(TfToken const& typeId,
97  SdfPath const& bprimId) override;
98  HDST_API
99  virtual HdBprim *CreateFallbackBprim(TfToken const& typeId) override;
100  HDST_API
101  virtual void DestroyBprim(HdBprim *bPrim) override;
102 
103  HDST_API
104  virtual void CommitResources(HdChangeTracker *tracker) override;
105 
106  HDST_API
107  virtual TfToken GetMaterialNetworkSelector() const override;
108 
109  HDST_API
110  virtual TfTokenVector GetShaderSourceTypes() const override;
111 
112  HDST_API
113  virtual bool IsPrimvarFilteringNeeded() const override;
114 
115  // Returns whether or not HdStRenderDelegate can run on the current
116  // hardware.
117  HDST_API
118  static bool IsSupported();
119 
120  HDST_API
121  virtual HdRenderSettingDescriptorList
122  GetRenderSettingDescriptors() const override;
123 
124  HDST_API
125  virtual VtDictionary GetRenderStats() const override;
126 
127  HDST_API
128  virtual HdAovDescriptor
129  GetDefaultAovDescriptor(TfToken const& name) const override;
130 
131  // Returns Hydra graphics interface
132  HDST_API
133  Hgi* GetHgi();
134 
135 private:
136  static const TfTokenVector SUPPORTED_RPRIM_TYPES;
137  static const TfTokenVector SUPPORTED_SPRIM_TYPES;
138  static const TfTokenVector SUPPORTED_BPRIM_TYPES;
139 
141  static std::mutex _mutexResourceRegistry;
142  static std::atomic_int _counterResourceRegistry;
143  static HdStResourceRegistrySharedPtr _resourceRegistry;
144 
145  HdRenderSettingDescriptorList _settingDescriptors;
146 
147  HgiGL _hgiGL;
148 
149  void _Initialize();
150 
151  HdSprim *_CreateFallbackMaterialPrim();
152 
153  HdStRenderDelegate(const HdStRenderDelegate &) = delete;
154  HdStRenderDelegate &operator =(const HdStRenderDelegate &) = delete;
155 };
156 
157 
158 PXR_NAMESPACE_CLOSE_SCOPE
159 
160 #endif // HDST_RENDER_DELEGATE_H
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:119
Tracks changes from the HdSceneDelegate, providing invalidation cues to the render engine...
Definition: changeTracker.h:55
This class exists to facilitate point cloud style instancing.
Definition: instancer.h:119
A map with string keys and VtValue values.
Definition: dictionary.h:61
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:89
The render engine state for a given rprim from the scene graph.
Definition: rprim.h:67
OpenGL implementation of the Hydra Graphics Interface.
Definition: hgi.h:39
Adapter class providing data exchange with the client scene graph.
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:438
A named, semantic collection of objects.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
Sprim (state prim) is a base class of managing state for non-drawable scene entity (e...
Definition: sprim.h:54
Hydra Graphics Interface.
Definition: hgi.h:56
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;Alternate Output Value&quot;) display channel.
Definition: aov.h:46