Skip to content

Commit

Permalink
HnRenderParam: added skinning xforms global version
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Nov 28, 2024
1 parent 993b46d commit 311dc64
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Hydrogent/include/HnRenderParam.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ class HnRenderParam final : public pxr::HdRenderParam
// Indicates changes to light resources (e.g. textures).
LightResources,

// Indicates changes to skinning xforms
SkinningXForms,

Count
};
uint32_t GetAttribVersion(GlobalAttrib Attrib) const { return m_GlobalAttribVersions[static_cast<size_t>(Attrib)].load(); }
Expand Down
1 change: 1 addition & 0 deletions Hydrogent/src/Computations/HnSkinningComputation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ void HnSkinningComputation::Sync(pxr::HdSceneDelegate* SceneDelegate,
m_XformsHash = pxr::TfHash{}(Xforms);

m_LastXformSyncFrameNumber = static_cast<const HnRenderParam*>(RenderParam)->GetFrameNumber();
static_cast<HnRenderParam*>(RenderParam)->MakeAttribDirty(HnRenderParam::GlobalAttrib::SkinningXForms);

const HnRenderDelegate* RenderDelegate = static_cast<const HnRenderDelegate*>(SceneDelegate->GetRenderIndex().GetRenderDelegate());
const USD_Renderer& USDRenderer = *RenderDelegate->GetUSDRenderer();
Expand Down
5 changes: 3 additions & 2 deletions Hydrogent/src/Tasks/HnPostProcessTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,14 +668,15 @@ void HnPostProcessTask::Prepare(pxr::HdTaskContext* TaskCtx,
}
}

static_assert(static_cast<int>(HnRenderParam::GlobalAttrib::Count) == 9, "Please update the code below to handle the new attribute, if necessary.");
static_assert(static_cast<int>(HnRenderParam::GlobalAttrib::Count) == 10, "Please update the code below to handle the new attribute, if necessary.");
SuperSamplingFactors CurrSSFactors{
(pRenderParam->GetAttribVersion(HnRenderParam::GlobalAttrib::MeshGeometry) +
pRenderParam->GetAttribVersion(HnRenderParam::GlobalAttrib::MeshMaterial) +
pRenderParam->GetAttribVersion(HnRenderParam::GlobalAttrib::MeshTransform) +
pRenderParam->GetAttribVersion(HnRenderParam::GlobalAttrib::MeshVisibility) +
pRenderParam->GetAttribVersion(HnRenderParam::GlobalAttrib::Material) +
pRenderParam->GetAttribVersion(HnRenderParam::GlobalAttrib::Light)),
pRenderParam->GetAttribVersion(HnRenderParam::GlobalAttrib::Light) +
pRenderParam->GetAttribVersion(HnRenderParam::GlobalAttrib::SkinningXForms)),
m_UseSSR,
m_UseSSAO,
pRenderParam->GetUseShadows(),
Expand Down
5 changes: 3 additions & 2 deletions Hydrogent/src/Tasks/HnRenderShadowsTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,9 @@ void HnRenderShadowsTask::Prepare(pxr::HdTaskContext* TaskCtx,
pRenderParam->GetAttribVersion(HnRenderParam::GlobalAttrib::MeshGeometry) +
pRenderParam->GetAttribVersion(HnRenderParam::GlobalAttrib::MeshTransform) +
pRenderParam->GetAttribVersion(HnRenderParam::GlobalAttrib::MeshVisibility) +
pRenderParam->GetAttribVersion(HnRenderParam::GlobalAttrib::MeshMaterial));
static_assert(static_cast<int>(HnRenderParam::GlobalAttrib::Count) == 9, "Please update the code above to handle the new attribute, if necessary.");
pRenderParam->GetAttribVersion(HnRenderParam::GlobalAttrib::MeshMaterial) +
pRenderParam->GetAttribVersion(HnRenderParam::GlobalAttrib::SkinningXForms));
static_assert(static_cast<int>(HnRenderParam::GlobalAttrib::Count) == 10, "Please update the code above to handle the new attribute, if necessary.");

bool GeometryChanged = m_LastGeometryVersion != GeometryVersion;
m_LastGeometryVersion = GeometryVersion;
Expand Down

0 comments on commit 311dc64

Please sign in to comment.