dirtyList.h
1 //
2 // Copyright 2016 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 PXR_IMAGING_HD_DIRTY_LIST_H
25 #define PXR_IMAGING_HD_DIRTY_LIST_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hd/api.h"
29 #include "pxr/imaging/hd/version.h"
30 #include "pxr/imaging/hd/repr.h"
31 #include "pxr/imaging/hd/rprimCollection.h"
32 #include "pxr/imaging/hd/types.h"
33 
34 #include <memory>
35 
36 PXR_NAMESPACE_OPEN_SCOPE
37 
38 class HdRenderIndex;
39 class HdChangeTracker;
40 using HdReprSelectorVector = std::vector<HdReprSelector>;
41 
103 class HdDirtyList {
104 public:
105  HD_API
106  explicit HdDirtyList(HdRenderIndex &index);
107 
117  HD_API
118  SdfPathVector const& GetDirtyRprims();
119 
122  HD_API
124  TfTokenVector const &tags, HdReprSelectorVector const &reprs);
125 
129  _pruneDirtyList = true;
130  }
131 
132 private:
133  HdChangeTracker & _GetChangeTracker() const;
134  void _UpdateDirtyIdsIfNeeded();
135 
136  // Note: Can't use a const ref to the renderIndex because
137  // HdRenderIndex::GetRprimIds() isn't a const member fn.
138  HdRenderIndex &_renderIndex;
139  TfTokenVector _trackedRenderTags;
140  HdReprSelectorVector _trackedReprs;
141  SdfPathVector _dirtyIds;
142 
143  unsigned int _sceneStateVersion;
144  unsigned int _rprimIndexVersion;
145  unsigned int _rprimRenderTagVersion;
146  unsigned int _varyingStateVersion;
147 
148  bool _rebuildDirtyList;
149  bool _pruneDirtyList;
150 };
151 
152 PXR_NAMESPACE_CLOSE_SCOPE
153 
154 #endif // PXR_IMAGING_HD_DIRTY_LIST_H
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:120
Tracks changes from the HdSceneDelegate, providing invalidation cues to the render engine.
Definition: changeTracker.h:51
HD_API SdfPathVector const & GetDirtyRprims()
Returns a reference of dirty rprim ids.
HD_API void UpdateRenderTagsAndReprSelectors(TfTokenVector const &tags, HdReprSelectorVector const &reprs)
Updates the tracked filtering parameters.
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
Used for faster iteration of dirty Rprims by the render index.
Definition: dirtyList.h:103
void PruneToVaryingRprims()
Sets the flag to prune to dirty list to just the varying Rprims on the next call to GetDirtyRprims.
Definition: dirtyList.h:128