All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
renderDelegate.h
1 //
2 // Copyright 2019 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 //
24 #ifndef HDPRMAN_RENDER_DELEGATE_H
25 #define HDPRMAN_RENDER_DELEGATE_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hd/renderDelegate.h"
29 #include "hdPrman/api.h"
30 #include <mutex>
31 
32 PXR_NAMESPACE_OPEN_SCOPE
33 
34 class HdPrman_RenderParam;
35 class HdPrman_RenderPass;
36 struct HdPrman_Context;
37 
38 #define HDPRMAN_RENDER_SETTINGS_TOKENS \
39  (integrator) \
40  (interactiveIntegrator) \
41  (interactiveIntegratorTimeout)
42 
43 TF_DECLARE_PUBLIC_TOKENS(HdPrmanRenderSettingsTokens, HDPRMAN_API,
44  HDPRMAN_RENDER_SETTINGS_TOKENS);
45 
46 #define HDPRMAN_INTEGRATOR_TOKENS \
47  (PxrPathTracer) \
48  (PbsPathTracer) \
49  (PxrDirectLighting)
50 
51 TF_DECLARE_PUBLIC_TOKENS(HdPrmanIntegratorTokens, HDPRMAN_API,
52  HDPRMAN_INTEGRATOR_TOKENS);
53 
54 class HdPrmanRenderDelegate : public HdRenderDelegate {
55 public:
56  HDPRMAN_API HdPrmanRenderDelegate(std::shared_ptr<HdPrman_Context> context);
57  HDPRMAN_API HdPrmanRenderDelegate(std::shared_ptr<HdPrman_Context> context,
58  HdRenderSettingsMap const& settingsMap);
59  HDPRMAN_API virtual ~HdPrmanRenderDelegate();
60 
61  // HdRenderDelegate API implementation.
62  HDPRMAN_API virtual HdRenderParam *GetRenderParam() const override;
63  HDPRMAN_API virtual const TfTokenVector &
64  GetSupportedRprimTypes() const override;
65  HDPRMAN_API virtual const TfTokenVector &
66  GetSupportedSprimTypes() const override;
67  HDPRMAN_API virtual const TfTokenVector &
68  GetSupportedBprimTypes() const override;
69  HDPRMAN_API virtual HdResourceRegistrySharedPtr
70  GetResourceRegistry() const override;
71 
73  HDPRMAN_API virtual HdRenderSettingDescriptorList
74  GetRenderSettingDescriptors() const override;
75 
76  HDPRMAN_API virtual HdRenderPassSharedPtr CreateRenderPass(
77  HdRenderIndex *index,
78  HdRprimCollection const& collection) override;
79  HDPRMAN_API virtual HdInstancer *CreateInstancer(HdSceneDelegate *delegate,
80  SdfPath const& id,
81  SdfPath const& instancerId) override;
82  HDPRMAN_API virtual void DestroyInstancer(HdInstancer *instancer) override;
83  HDPRMAN_API virtual HdRprim *CreateRprim(TfToken const& typeId,
84  SdfPath const& rprimId,
85  SdfPath const& instancerId) override;
86  HDPRMAN_API virtual void DestroyRprim(HdRprim *rPrim) override;
87  HDPRMAN_API virtual HdSprim *CreateSprim(TfToken const& typeId,
88  SdfPath const& sprimId) override;
89  HDPRMAN_API virtual HdSprim *CreateFallbackSprim(
90  TfToken const& typeId) override;
91  HDPRMAN_API virtual void DestroySprim(HdSprim *sPrim) override;
92  HDPRMAN_API virtual HdBprim *CreateBprim(TfToken const& typeId,
93  SdfPath const& bprimId) override;
94  HDPRMAN_API virtual HdBprim *CreateFallbackBprim(
95  TfToken const& typeId) override;
96  HDPRMAN_API virtual void DestroyBprim(HdBprim *bPrim) override;
97  HDPRMAN_API virtual void CommitResources(HdChangeTracker *tracker) override;
98  HDPRMAN_API virtual TfToken GetMaterialBindingPurpose() const override;
99  HDPRMAN_API virtual TfToken GetMaterialNetworkSelector() const override;
100  HDPRMAN_API virtual TfTokenVector GetShaderSourceTypes() const override;
101 
102 private:
103  // This class does not support copying.
104  HdPrmanRenderDelegate(const HdPrmanRenderDelegate &) = delete;
105  HdPrmanRenderDelegate &operator =(const HdPrmanRenderDelegate &) = delete;
106 
107  void _Initialize();
108 
109 protected: // data
110  static const TfTokenVector SUPPORTED_RPRIM_TYPES;
111  static const TfTokenVector SUPPORTED_SPRIM_TYPES;
112  static const TfTokenVector SUPPORTED_BPRIM_TYPES;
113 
114  std::shared_ptr<HdPrman_Context> _context;
115  std::shared_ptr<HdPrman_RenderParam> _renderParam;
116  HdResourceRegistrySharedPtr _resourceRegistry;
117  HdRenderPassSharedPtr _renderPass;
118  HdRenderSettingDescriptorList _settingDescriptors;
119 };
120 
121 PXR_NAMESPACE_CLOSE_SCOPE
122 
123 #endif // HDPRMAN_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
The HdRenderParam is an opaque (to core Hydra) handle, to an object that is obtained from the render ...
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
Adapter class providing data exchange with the client scene graph.
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:118
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
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 placeholder render pass that does nothing.
Definition: renderPass.h:36