HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
renderDelegate.h
Go to the documentation of this file.
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"
29 
30 #include <memory>
31 #include <mutex>
32 
34 
35 class Hgi;
36 
38  std::shared_ptr<class HdStResourceRegistry>;
39 
40 ///
41 /// HdStRenderDelegate
42 ///
43 /// The Storm Render Delegate provides a Hydra render that uses a
44 /// streaming graphics implementation to draw the scene.
45 ///
46 class HdStRenderDelegate final : public HdRenderDelegate {
47 public:
48  HDST_API
50  HDST_API
51  HdStRenderDelegate(HdRenderSettingsMap const& settingsMap);
52 
53  HDST_API
54  virtual ~HdStRenderDelegate();
55 
56  HDST_API
57  virtual void SetDrivers(HdDriverVector const& drivers) override;
58 
59  HDST_API
60  virtual HdRenderParam *GetRenderParam() const override;
61 
62  HDST_API
63  virtual const TfTokenVector &GetSupportedRprimTypes() const override;
64  HDST_API
65  virtual const TfTokenVector &GetSupportedSprimTypes() const override;
66  HDST_API
67  virtual const TfTokenVector &GetSupportedBprimTypes() const override;
68  HDST_API
69  virtual HdResourceRegistrySharedPtr GetResourceRegistry() const override;
70 
71  HDST_API
73  HdRprimCollection const& collection) override;
74  HDST_API
75  virtual HdRenderPassStateSharedPtr CreateRenderPassState() const override;
76 
77  HDST_API
78  virtual HdInstancer *CreateInstancer(HdSceneDelegate *delegate,
79  SdfPath const& id,
80  SdfPath const& instancerId) override;
81 
82  HDST_API
83  virtual void DestroyInstancer(HdInstancer *instancer) override;
84 
85  HDST_API
86  virtual HdRprim *CreateRprim(TfToken const& typeId,
87  SdfPath const& rprimId,
88  SdfPath const& instancerId) override;
89  HDST_API
90  virtual void DestroyRprim(HdRprim *rPrim) override;
91 
92  HDST_API
93  virtual HdSprim *CreateSprim(TfToken const& typeId,
94  SdfPath const& sprimId) override;
95  HDST_API
96  virtual HdSprim *CreateFallbackSprim(TfToken const& typeId) override;
97  HDST_API
98  virtual void DestroySprim(HdSprim *sPrim) override;
99 
100  HDST_API
101  virtual HdBprim *CreateBprim(TfToken const& typeId,
102  SdfPath const& bprimId) override;
103  HDST_API
104  virtual HdBprim *CreateFallbackBprim(TfToken const& typeId) override;
105  HDST_API
106  virtual void DestroyBprim(HdBprim *bPrim) override;
107 
108  HDST_API
109  virtual void CommitResources(HdChangeTracker *tracker) override;
110 
111  HDST_API
112  virtual TfToken GetMaterialNetworkSelector() const override;
113 
114  HDST_API
115  virtual TfTokenVector GetShaderSourceTypes() const override;
116 
117  HDST_API
118  virtual bool IsPrimvarFilteringNeeded() const override;
119 
120  // Returns whether or not HdStRenderDelegate can run on the current
121  // hardware.
122  HDST_API
123  static bool IsSupported();
124 
125  HDST_API
127  GetRenderSettingDescriptors() const override;
128 
129  HDST_API
130  virtual VtDictionary GetRenderStats() const override;
131 
132  HDST_API
133  virtual HdAovDescriptor
134  GetDefaultAovDescriptor(TfToken const& name) const override;
135 
136  // Returns Hydra graphics interface
137  HDST_API
138  Hgi* GetHgi();
139 
140 private:
141  static const TfTokenVector SUPPORTED_RPRIM_TYPES;
142  static const TfTokenVector SUPPORTED_SPRIM_TYPES;
143 
144  /// Resource registry used in this render delegate
145  HdStResourceRegistrySharedPtr _resourceRegistry;
146 
147  HdRenderSettingDescriptorList _settingDescriptors;
148 
149  Hgi* _hgi;
150 
151  HdSprim *_CreateFallbackMaterialPrim();
152 
153  HdStRenderDelegate(const HdStRenderDelegate &) = delete;
154  HdStRenderDelegate &operator =(const HdStRenderDelegate &) = delete;
155 };
156 
157 
159 
160 #endif // PXR_IMAGING_HD_ST_RENDER_DELEGATE_H
HDST_API Hgi * GetHgi()
std::shared_ptr< class HdRenderPassState > HdRenderPassStateSharedPtr
Definition: engine.h:42
virtual HDST_API void CommitResources(HdChangeTracker *tracker) override
GLuint const GLchar * name
Definition: glew.h:1814
virtual HDST_API const TfTokenVector & GetSupportedRprimTypes() const override
std::shared_ptr< class HdRenderPass > HdRenderPassSharedPtr
Definition: engine.h:41
std::shared_ptr< class HdResourceRegistry > HdResourceRegistrySharedPtr
std::vector< HdRenderSettingDescriptor > HdRenderSettingDescriptorList
virtual HDST_API ~HdStRenderDelegate()
GLuint index
Definition: glew.h:1814
virtual HDST_API bool IsPrimvarFilteringNeeded() const override
virtual HDST_API HdAovDescriptor GetDefaultAovDescriptor(TfToken const &name) const override
virtual HDST_API HdRenderPassSharedPtr CreateRenderPass(HdRenderIndex *index, HdRprimCollection const &collection) override
virtual HDST_API const TfTokenVector & GetSupportedBprimTypes() const override
virtual HDST_API HdRenderSettingDescriptorList GetRenderSettingDescriptors() const override
virtual HDST_API void DestroySprim(HdSprim *sPrim) override
virtual HDST_API HdBprim * CreateFallbackBprim(TfToken const &typeId) override
virtual HDST_API HdSprim * CreateFallbackSprim(TfToken const &typeId) override
Definition: token.h:87
std::vector< HdDriver * > HdDriverVector
static HDST_API bool IsSupported()
Definition: rprim.h:68
virtual HDST_API const TfTokenVector & GetSupportedSprimTypes() const override
virtual HDST_API HdRenderParam * GetRenderParam() const override
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:446
HDST_API HdStRenderDelegate()
Definition: path.h:288
virtual HDST_API void DestroyRprim(HdRprim *rPrim) override
virtual HDST_API void SetDrivers(HdDriverVector const &drivers) override
virtual HDST_API HdRprim * CreateRprim(TfToken const &typeId, SdfPath const &rprimId, SdfPath const &instancerId) override
Definition: sprim.h:52
Definition: hgi.h:106
virtual HDST_API void DestroyBprim(HdBprim *bPrim) override
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1346
virtual HDST_API HdSprim * CreateSprim(TfToken const &typeId, SdfPath const &sprimId) override
#define HDST_API
Definition: api.h:40
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
Definition: bprim.h:56
virtual HDST_API HdResourceRegistrySharedPtr GetResourceRegistry() const override
virtual HDST_API HdRenderPassStateSharedPtr CreateRenderPassState() const override
virtual HDST_API HdBprim * CreateBprim(TfToken const &typeId, SdfPath const &bprimId) override
std::shared_ptr< class HdStResourceRegistry > HdStResourceRegistrySharedPtr
Definition: commandBuffer.h:47
virtual HDST_API void DestroyInstancer(HdInstancer *instancer) override
virtual HDST_API HdInstancer * CreateInstancer(HdSceneDelegate *delegate, SdfPath const &id, SdfPath const &instancerId) override
virtual HDST_API TfTokenVector GetShaderSourceTypes() const override
virtual HDST_API VtDictionary GetRenderStats() const override
virtual HDST_API TfToken GetMaterialNetworkSelector() const override