From 311dc648b3f757bfc946911cfbab89b47131aff3 Mon Sep 17 00:00:00 2001 From: assiduous Date: Wed, 27 Nov 2024 17:26:52 -0800 Subject: [PATCH] HnRenderParam: added skinning xforms global version --- Hydrogent/include/HnRenderParam.hpp | 3 +++ Hydrogent/src/Computations/HnSkinningComputation.cpp | 1 + Hydrogent/src/Tasks/HnPostProcessTask.cpp | 5 +++-- Hydrogent/src/Tasks/HnRenderShadowsTask.cpp | 5 +++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Hydrogent/include/HnRenderParam.hpp b/Hydrogent/include/HnRenderParam.hpp index 0a0b68ea..beab9987 100644 --- a/Hydrogent/include/HnRenderParam.hpp +++ b/Hydrogent/include/HnRenderParam.hpp @@ -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(Attrib)].load(); } diff --git a/Hydrogent/src/Computations/HnSkinningComputation.cpp b/Hydrogent/src/Computations/HnSkinningComputation.cpp index b8f7cef7..9c0ee343 100644 --- a/Hydrogent/src/Computations/HnSkinningComputation.cpp +++ b/Hydrogent/src/Computations/HnSkinningComputation.cpp @@ -83,6 +83,7 @@ void HnSkinningComputation::Sync(pxr::HdSceneDelegate* SceneDelegate, m_XformsHash = pxr::TfHash{}(Xforms); m_LastXformSyncFrameNumber = static_cast(RenderParam)->GetFrameNumber(); + static_cast(RenderParam)->MakeAttribDirty(HnRenderParam::GlobalAttrib::SkinningXForms); const HnRenderDelegate* RenderDelegate = static_cast(SceneDelegate->GetRenderIndex().GetRenderDelegate()); const USD_Renderer& USDRenderer = *RenderDelegate->GetUSDRenderer(); diff --git a/Hydrogent/src/Tasks/HnPostProcessTask.cpp b/Hydrogent/src/Tasks/HnPostProcessTask.cpp index f0e46ae4..324d8fea 100644 --- a/Hydrogent/src/Tasks/HnPostProcessTask.cpp +++ b/Hydrogent/src/Tasks/HnPostProcessTask.cpp @@ -668,14 +668,15 @@ void HnPostProcessTask::Prepare(pxr::HdTaskContext* TaskCtx, } } - static_assert(static_cast(HnRenderParam::GlobalAttrib::Count) == 9, "Please update the code below to handle the new attribute, if necessary."); + static_assert(static_cast(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(), diff --git a/Hydrogent/src/Tasks/HnRenderShadowsTask.cpp b/Hydrogent/src/Tasks/HnRenderShadowsTask.cpp index bd2b2280..670d0d6c 100644 --- a/Hydrogent/src/Tasks/HnRenderShadowsTask.cpp +++ b/Hydrogent/src/Tasks/HnRenderShadowsTask.cpp @@ -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(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(HnRenderParam::GlobalAttrib::Count) == 10, "Please update the code above to handle the new attribute, if necessary."); bool GeometryChanged = m_LastGeometryVersion != GeometryVersion; m_LastGeometryVersion = GeometryVersion;