pcp: Implement culling for specializes nodes
authorsunyab <sunyab@users.noreply.github.com>
Mon, 22 Jan 2024 22:36:20 +0000 (14:36 -0800)
committerpixar-oss <pixar-oss@users.noreply.github.com>
Mon, 22 Jan 2024 23:03:26 +0000 (15:03 -0800)
commit9e84ca8c3fb83f7c2408bd6edc3f5048d066eede
tree5c0ac06efac89dbf394aa89a03e5b557571af7e0
parent2cf6612b2b1d5a1a1031bc153867116c5963e605
pcp: Implement culling for specializes nodes

Change 2311004 caused a regression in memory usage because
nodes due to ancestral opinions beneath specializes nodes
were not being culled as they had been before.

For example, if prim /A specialized /B/C/D, Pcp would
recursively compute the prim index for /B/C/D. Prior to the
above change, Pcp would cull nodes in that prim index before
attaching it to the prim index for /A. After that change,
Pcp would attach the unculled prim index first, then attempt
to cull nodes later. However, this caused Pcp to hit a
clause in the culling code that explicitly ignored specializes
nodes, meaning the nodes for /B/C/D would be skipped over
entirely.

Culling for specializes nodes was originally unimplemented
because of the complicated duplication of node subtrees that
was part of how the specializes arc was implemented. Adding
this fixes the regression and actually reduces memory usage
even further than the original numbers.

(Internal change: 2312006)
pxr/usd/pcp/primIndex.cpp
pxr/usd/pcp/testenv/testPcpPrimIndex.py