Skip to content

Commit

Permalink
Merge pull request #1633 from Autodesk/krickw/MAYA-113230/synchronize…
Browse files Browse the repository at this point in the history
…_only_render_tags_which_have_changed

MAYA-113230 Minor performance improvement for loading scenes into Vp2RenderDelegate
  • Loading branch information
seando-adsk authored Aug 23, 2021
2 parents 2779350 + 308ea74 commit b981b71
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,7 @@ void ProxyRenderDelegate::_UpdateRenderTags()
bool renderPurposeChanged = false;
bool proxyPurposeChanged = false;
bool guidePurposeChanged = false;
TfTokenVector changedRenderTags;
_proxyShapeData->UpdatePurpose(
&renderPurposeChanged, &proxyPurposeChanged, &guidePurposeChanged);
if (renderPurposeChanged || proxyPurposeChanged || guidePurposeChanged) {
Expand All @@ -1191,7 +1192,6 @@ void ProxyRenderDelegate::_UpdateRenderTags()

// Build the list of render tags which were added or removed (changed)
// and the list of render tags which were removed.
TfTokenVector changedRenderTags;
if (renderPurposeChanged) {
changedRenderTags.push_back(HdRenderTagTokens->render);
}
Expand Down Expand Up @@ -1228,10 +1228,9 @@ void ProxyRenderDelegate::_UpdateRenderTags()
// When an rprim has it's renderTag changed the global render tag version
// id will change.
if (rprimRenderTagChanged) {
TfTokenVector renderTags = { HdRenderTagTokens->geometry,
HdRenderTagTokens->render,
HdRenderTagTokens->proxy,
HdRenderTagTokens->guide };
TfTokenVector renderTags
= { HdRenderTagTokens->geometry }; // always draw geometry render tag purpose.
renderTags.insert(renderTags.end(), changedRenderTags.begin(), changedRenderTags.end());
_taskController->SetRenderTags(renderTags);
_taskRenderTagsValid = false;
}
Expand All @@ -1253,6 +1252,14 @@ void ProxyRenderDelegate::_UpdateRenderTags()
_taskController->SetRenderTags(renderTags);
_taskRenderTagsValid = true;
}

// TODO: UsdImagingDelegate is purpose-aware. There are methods
// SetDisplayRender, SetDisplayProxy and SetDisplayGuides which inform the
// scene delegate of what is displayed, and changes the behavior of
// UsdImagingDelegate::GetRenderTag(). So far I don't see an advantage of
// using this feature for MayaUSD, but it may be useful at some point in
// the future.

_renderTagVersion = changeTracker.GetRenderTagVersion();
#ifdef ENABLE_RENDERTAG_VISIBILITY_WORKAROUND
_visibilityVersion = changeTracker.GetVisibilityChangeCount();
Expand Down

0 comments on commit b981b71

Please sign in to comment.