MCPcopy Create free account
hub / github.com/DiligentGraphics/DiligentFX / Execute

Method Execute

Hydrogent/src/Tasks/HnProcessSelectionTask.cpp:303–366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303void HnProcessSelectionTask::Execute(pxr::HdTaskContext* TaskCtx)
304{
305 if (m_RenderIndex == nullptr)
306 {
307 UNEXPECTED("Render index is not initialized");
308 return;
309 }
310
311 const HnFrameRenderTargets* Targets = GetFrameRenderTargets(TaskCtx);
312 if (Targets == nullptr)
313 {
314 UNEXPECTED("Fraame render targets is not set in the task context");
315 return;
316 }
317
318 if (!m_InitTech.PSO || !m_UpdateTech.PSO)
319 {
320 UNEXPECTED("Render techniques are not initialized");
321 return;
322 }
323
324 HnRenderDelegate* pRenderDelegate = static_cast<HnRenderDelegate*>(m_RenderIndex->GetRenderDelegate());
325 IDeviceContext* pCtx = pRenderDelegate->GetDeviceContext();
326
327 ScopedDebugGroup DebugGroup{pCtx, "Process Selection"};
328
329 if (m_SelectedPrimId.IsEmpty() || !m_InitTech.IsReady() || !m_UpdateTech.IsReady())
330 {
331 ITextureView* pFinalRTV = Targets->ClosestSelectedLocationRTV[m_NumJFIterations % 2];
332 pCtx->SetRenderTargets(1, &pFinalRTV, nullptr, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
333 pCtx->ClearRenderTarget(pFinalRTV, nullptr, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
334 return;
335 }
336
337 {
338 float BackgroundDepth = 1.f;
339 if (!GetTaskContextData(TaskCtx, HnRenderResourceTokens->backgroundDepth, BackgroundDepth))
340 {
341 UNEXPECTED("Background depth is not set in the task context");
342 }
343
344 MapHelper<HLSL::ClosestSelectedLocationConstants> Constants{pCtx, m_ConstantsCB, MAP_WRITE, MAP_FLAG_DISCARD};
345 Constants->ClearDepth = BackgroundDepth;
346 }
347
348 ITextureView* ClosestSelectedLocationRTVs[] = {Targets->ClosestSelectedLocationRTV[0], Targets->ClosestSelectedLocationRTV[1]};
349 pCtx->SetRenderTargets(1, ClosestSelectedLocationRTVs, nullptr, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
350 pCtx->SetPipelineState(m_InitTech.PSO);
351 pCtx->CommitShaderResources(m_InitTech.SRB, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
352 pCtx->Draw({3, DRAW_FLAG_VERIFY_ALL});
353
354 for (Uint32 i = 0; i < m_NumJFIterations; ++i)
355 {
356 {
357 MapHelper<HLSL::ClosestSelectedLocationConstants> Constants{pCtx, m_ConstantsCB, MAP_WRITE, MAP_FLAG_DISCARD};
358 Constants->SampleRange = static_cast<float>(1 << (m_NumJFIterations - 1 - i));
359 }
360

Callers

nothing calls this directly

Calls 5

GetDeviceContextMethod · 0.80
ClearRenderTargetMethod · 0.80
SetPipelineStateMethod · 0.80
CommitShaderResourcesMethod · 0.80
IsReadyMethod · 0.45

Tested by

no test coverage detected