HDK
|
#include <dirtyList.h>
Public Member Functions | |
HD_API | HdDirtyList (HdRenderIndex &index) |
HD_API SdfPathVector const & | GetDirtyRprims () |
HD_API void | UpdateRenderTagsAndReprSelectors (TfTokenVector const &tags, HdReprSelectorVector const &reprs) |
void | PruneToVaryingRprims () |
Used for faster iteration of dirty Rprims by the render index.
GetDirtyRprims() implicitly refreshes and caches the list if needed. The returning prims list will be used for sync.
DirtyList construction can expensive. We have 3 layer versioning to make it efficient.
Constantly updating Prims in a stable set (fast) when munging or playing back, the same set of prims are being updated, while the remaining prims (could be huge – for example a large set) are static. Those animating prims can be distinguished by the Varying bit. The Varying bit is set on a prim when any dirty bit is set, and stays even after cleaning the scene dirty bits, until HdChangeTracker::ResetVaryingState clears it out.
DirtyList caches those prims in a list at the first time (described in 3), and returns the list for the subsequent queries. Since that list is conservatively picked by the Varying bit instead of the actual DirtyBits needed for various reprs, consumer of DirtyList needs to check the dirtybits again (this is a common pattern in HdRprim, HdMesh and other).
Varying state changed (medium cost) when a exisitng prim newly starts updating (start munging), or when a majority of the dirtylist stop updating, we need to reconstruct the dirtylist. HdChangeTracker::GetVaryingStateVersion() tells the right timing to refresh, by comparing the cached version number in the dirtylist.
To construct a dirtylist, the Varying bit is checked instead of other dirtybits, since effective dirtybits may differ over prims, by prim type (mesh vs curve) or by per-prim repr style (flat vs smooth)
example: [x]=Varying [x*]=Dirty,Varying
say in change tracker: A B C D E [F*] [G] [H*] [I*] [J] [K] L M N ... then the dirtylist will be: F*, G, H*, I*, J, K
Note that G, J and K are not dirty, but it exists in the dirtylist. This optimization gives the maximum efficiency when all of Varying prims are being updated.
Definition at line 103 of file dirtyList.h.
|
explicit |
HD_API SdfPathVector const& HdDirtyList::GetDirtyRprims | ( | ) |
Returns a reference of dirty rprim ids. If the change tracker hasn't changed any state since the last time GetDirtyRprims gets called, and if the tracked filtering parameters (set via UpdateRenderTagsAndReprSelectors) are the same, it simply returns an empty list. Otherwise depending on what changed, it will return a list of Rprim ids to be synced. Therefore, it is expected that GetDirtyRprims is called only once per render index sync.
|
inline |
Sets the flag to prune to dirty list to just the varying Rprims on the next call to GetDirtyRprims.
Definition at line 128 of file dirtyList.h.
HD_API void HdDirtyList::UpdateRenderTagsAndReprSelectors | ( | TfTokenVector const & | tags, |
HdReprSelectorVector const & | reprs | ||
) |
Updates the tracked filtering parameters. This typically comes from the tasks submitted to HdEngine::Execute.