renderPass.h
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_IMAGING_HD_RENDER_PASS_H
8 #define PXR_IMAGING_HD_RENDER_PASS_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hd/api.h"
12 #include "pxr/imaging/hd/version.h"
13 #include "pxr/imaging/hd/rprimCollection.h"
14 #include "pxr/imaging/hd/task.h"
15 
16 #include <memory>
17 
18 PXR_NAMESPACE_OPEN_SCOPE
19 
20 class HdRenderIndex;
21 class HdSceneDelegate;
22 
23 using HdRenderPassSharedPtr = std::shared_ptr<class HdRenderPass>;
24 using HdRenderPassStateSharedPtr = std::shared_ptr<class HdRenderPassState>;
25 
53 {
54 public:
55  HD_API
56  HdRenderPass(HdRenderIndex *index, HdRprimCollection const& collection);
57  HD_API
58  virtual ~HdRenderPass();
59 
61  HdRprimCollection const& GetRprimCollection() const { return _collection; }
62 
65  HD_API
66  void SetRprimCollection(HdRprimCollection const& col);
67 
69  HdRenderIndex* GetRenderIndex() const { return _renderIndex; }
70 
71  // ---------------------------------------------------------------------- //
73  // ---------------------------------------------------------------------- //
74 
76  HD_API
77  void Sync();
78 
79  // ---------------------------------------------------------------------- //
81  // ---------------------------------------------------------------------- //
82 
84  HD_API
85  void Execute(HdRenderPassStateSharedPtr const &renderPassState,
86  TfTokenVector const &renderTags);
87 
88  // ---------------------------------------------------------------------- //
90  // ---------------------------------------------------------------------- //
91 
92  virtual bool IsConverged() const { return true; }
93 
94 protected:
97  virtual void _Execute(HdRenderPassStateSharedPtr const &renderPassState,
98  TfTokenVector const &renderTags) = 0;
99 
101  virtual void _MarkCollectionDirty() {}
102 
104  virtual void _Sync() {}
105 
106 private:
107 
108  // Don't allow copies
109  HdRenderPass(const HdRenderPass &) = delete;
110  HdRenderPass &operator=(const HdRenderPass &) = delete;
111 
112  // ---------------------------------------------------------------------- //
113  // \name Change Tracking State
114  // ---------------------------------------------------------------------- //
115  // The renderIndex to which this renderPass belongs
116  // (can't change after construction)
117  HdRenderIndex * const _renderIndex;
118 
119  // ---------------------------------------------------------------------- //
120  // \name Core RenderPass State
121  // ---------------------------------------------------------------------- //
122  HdRprimCollection _collection;
123 };
124 
125 PXR_NAMESPACE_CLOSE_SCOPE
126 
127 #endif //PXR_IMAGING_HD_RENDER_PASS_H
virtual void _MarkCollectionDirty()
Optional API: let derived classes mark their collection tracking as dirty.
Definition: renderPass.h:101
The render index is part of the Hydra 1.0 API and is only used for emulation purposes so that HdScene...
Definition: renderIndex.h:110
HD_API void Execute(HdRenderPassStateSharedPtr const &renderPassState, TfTokenVector const &renderTags)
Execute a subset of buckets of this renderpass.
HD_API void SetRprimCollection(HdRprimCollection const &col)
Sets the HdRprimCollection, note that this may invalidate internal caches used to accelerate drawing.
An abstract class representing a single render iteration over a set of prims (the HdRprimCollection),...
Definition: renderPass.h:52
HdRenderIndex * GetRenderIndex() const
Return the render index.
Definition: renderPass.h:69
virtual void _Execute(HdRenderPassStateSharedPtr const &renderPassState, TfTokenVector const &renderTags)=0
Virtual API: Execute the buckets corresponding to renderTags; renderTags.empty() implies execute ever...
Adapter class providing data exchange with the client scene graph.
HdRprimCollection const & GetRprimCollection() const
Returns the HdRprimCollection to be drawn by this RenderPass.
Definition: renderPass.h:61
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:489
A named, semantic collection of objects.
virtual void _Sync()
Optional API: let derived classes sync data.
Definition: renderPass.h:104
HD_API void Sync()
Sync the render pass resources.