| 60 | } |
| 61 | |
| 62 | void HnCopySelectionDepthTask::Execute(pxr::HdTaskContext* TaskCtx) |
| 63 | { |
| 64 | if (m_RenderIndex == nullptr) |
| 65 | { |
| 66 | UNEXPECTED("Render index is not initialized"); |
| 67 | return; |
| 68 | } |
| 69 | |
| 70 | const HnFrameRenderTargets* Targets = GetFrameRenderTargets(TaskCtx); |
| 71 | if (Targets == nullptr) |
| 72 | { |
| 73 | UNEXPECTED("Frame render targets are not set in the task context"); |
| 74 | return; |
| 75 | } |
| 76 | |
| 77 | if (Targets->DepthDSV == nullptr || Targets->SelectionDepthDSV == nullptr) |
| 78 | { |
| 79 | UNEXPECTED("Depth buffers are not set in the render pass state"); |
| 80 | return; |
| 81 | } |
| 82 | |
| 83 | HnRenderDelegate* pRenderDelegate = static_cast<HnRenderDelegate*>(m_RenderIndex->GetRenderDelegate()); |
| 84 | IDeviceContext* pCtx = pRenderDelegate->GetDeviceContext(); |
| 85 | |
| 86 | ScopedDebugGroup DebugGroup{pCtx, "Copy Selection Depth"}; |
| 87 | |
| 88 | // Unbind render targets before copying depth since they will be unbound by the copy operation anyway, |
| 89 | // and Diligent will emit a warning. |
| 90 | pCtx->SetRenderTargets(0, nullptr, nullptr, RESOURCE_STATE_TRANSITION_MODE_NONE); |
| 91 | CopyTextureAttribs CopyAttribs{ |
| 92 | Targets->SelectionDepthDSV->GetTexture(), |
| 93 | RESOURCE_STATE_TRANSITION_MODE_TRANSITION, |
| 94 | Targets->DepthDSV->GetTexture(), |
| 95 | RESOURCE_STATE_TRANSITION_MODE_TRANSITION, |
| 96 | }; |
| 97 | pCtx->CopyTexture(CopyAttribs); |
| 98 | } |
| 99 | |
| 100 | } // namespace USD |
| 101 |
nothing calls this directly
no test coverage detected