| 51 | } |
| 52 | |
| 53 | void HnRenderShadowsTask::Sync(pxr::HdSceneDelegate* Delegate, |
| 54 | pxr::HdTaskContext* TaskCtx, |
| 55 | pxr::HdDirtyBits* DirtyBits) |
| 56 | { |
| 57 | if (*DirtyBits & pxr::HdChangeTracker::DirtyCollection) |
| 58 | { |
| 59 | pxr::VtValue CollectionVal = Delegate->Get(GetId(), pxr::HdTokens->collection); |
| 60 | pxr::HdRprimCollection Collection = CollectionVal.Get<pxr::HdRprimCollection>(); |
| 61 | |
| 62 | if (Collection.GetName().IsEmpty()) |
| 63 | { |
| 64 | m_RenderPass.reset(); |
| 65 | } |
| 66 | else |
| 67 | { |
| 68 | if (!m_RenderPass) |
| 69 | { |
| 70 | pxr::HdRenderIndex& Index = Delegate->GetRenderIndex(); |
| 71 | pxr::HdRenderDelegate* RenderDelegate = Index.GetRenderDelegate(); |
| 72 | |
| 73 | m_RenderPass = std::static_pointer_cast<HnRenderPass>(RenderDelegate->CreateRenderPass(&Index, Collection)); |
| 74 | |
| 75 | { |
| 76 | pxr::VtValue ParamsValue = Delegate->Get(GetId(), HnTokens->renderPassParams); |
| 77 | if (ParamsValue.IsHolding<HnRenderPassParams>()) |
| 78 | { |
| 79 | HnRenderPassParams RenderPassParams = ParamsValue.UncheckedGet<HnRenderPassParams>(); |
| 80 | m_RenderPass->SetParams(RenderPassParams); |
| 81 | } |
| 82 | else |
| 83 | { |
| 84 | UNEXPECTED("Unexpected type of render pass parameters ", ParamsValue.GetTypeName()); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | // Need to set params for the new render pass. |
| 89 | *DirtyBits |= pxr::HdChangeTracker::DirtyParams; |
| 90 | } |
| 91 | else |
| 92 | { |
| 93 | m_RenderPass->SetRprimCollection(Collection); |
| 94 | } |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | if (*DirtyBits & pxr::HdChangeTracker::DirtyParams) |
| 99 | { |
| 100 | HnRenderShadowsTaskParams Params; |
| 101 | if (GetTaskParams(Delegate, Params)) |
| 102 | { |
| 103 | m_RPState.SetDepthBias(Params.State.DepthBias, Params.State.SlopeScaledDepthBias); |
| 104 | m_RPState.SetDepthFunc(Params.State.DepthFunc); |
| 105 | m_RPState.SetDepthBiasEnabled(Params.State.DepthBiasEnabled); |
| 106 | m_RPState.SetEnableDepthTest(Params.State.DepthTestEnabled); |
| 107 | m_RPState.SetEnableDepthClamp(Params.State.DepthClampEnabled); |
| 108 | |
| 109 | m_RPState.SetCullStyle(Params.State.CullStyle); |
| 110 | m_RPState.SetFrontFaceCCW(Params.State.FrontFaceCCW); |
nothing calls this directly
no test coverage detected