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

Method Execute

PostProcess/Common/src/PostFXContext.cpp:287–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285}
286
287void PostFXContext::Execute(const RenderAttributes& RenderAttribs)
288{
289 DEV_CHECK_ERR(RenderAttribs.pDevice != nullptr, "RenderAttribs.pDevice must not be null");
290 DEV_CHECK_ERR(RenderAttribs.pDeviceContext != nullptr, "RenderAttribs.pDeviceContext must not be null");
291
292 DEV_CHECK_ERR(RenderAttribs.pCurrDepthBufferSRV != nullptr, "RenderAttribs.pCurrDepthBufferSRV must not be null");
293 DEV_CHECK_ERR(RenderAttribs.pPrevDepthBufferSRV != nullptr, "RenderAttribs.pPrevDepthBufferSRV must not be null");
294 DEV_CHECK_ERR(RenderAttribs.pMotionVectorsSRV != nullptr, "RenderAttribs.pMotionVectorsSRV must not be null");
295
296 m_Resources.Insert(RESOURCE_IDENTIFIER_INPUT_CURR_DEPTH, RenderAttribs.pCurrDepthBufferSRV->GetTexture());
297 m_Resources.Insert(RESOURCE_IDENTIFIER_INPUT_PREV_DEPTH, RenderAttribs.pPrevDepthBufferSRV->GetTexture());
298 m_Resources.Insert(RESOURCE_IDENTIFIER_INPUT_MOTION_VECTORS, RenderAttribs.pMotionVectorsSRV->GetTexture());
299
300 ScopedDebugGroup DebugGroupGlobal{RenderAttribs.pDeviceContext, "PreparePostFX"};
301
302 if (RenderAttribs.pCameraAttribsCB == nullptr)
303 {
304 DEV_CHECK_ERR(RenderAttribs.pCurrCamera != nullptr, "RenderAttribs.pCurrCamera must not be null");
305 DEV_CHECK_ERR(RenderAttribs.pPrevCamera != nullptr, "RenderAttribs.pPrevCamera must not be null");
306
307 if (!m_Resources[RESOURCE_IDENTIFIER_CONSTANT_BUFFER])
308 {
309 RefCntAutoPtr<IBuffer> pBuffer;
310 CreateUniformBuffer(RenderAttribs.pDevice, 2 * sizeof(HLSL::CameraAttribs), "PostFXContext::CameraAttibsConstantBuffer", &pBuffer);
311 m_Resources.Insert(RESOURCE_IDENTIFIER_CONSTANT_BUFFER, pBuffer);
312 }
313
314 MapHelper<HLSL::CameraAttribs> CameraAttibs{RenderAttribs.pDeviceContext, m_Resources[RESOURCE_IDENTIFIER_CONSTANT_BUFFER], MAP_WRITE, MAP_FLAG_DISCARD};
315 CameraAttibs[0] = *RenderAttribs.pCurrCamera;
316 CameraAttibs[1] = *RenderAttribs.pPrevCamera;
317 }
318 else
319 {
320 m_Resources.Insert(RESOURCE_IDENTIFIER_CONSTANT_BUFFER, RenderAttribs.pCameraAttribsCB);
321 }
322
323 m_PSOsReady = PrepareShadersAndPSO(RenderAttribs, m_FeatureFlags);
324
325 if (m_PSOsReady)
326 {
327 ComputeBlueNoiseTexture(RenderAttribs);
328 ComputeReprojectedDepth(RenderAttribs);
329 ComputeClosestMotion(RenderAttribs);
330 ComputePreviousDepth(RenderAttribs);
331 }
332
333 // Release references to input resources
334 for (Uint32 ResourceIdx = 0; ResourceIdx <= RESOURCE_IDENTIFIER_INPUT_LAST; ++ResourceIdx)
335 m_Resources[ResourceIdx].Release();
336}
337
338bool PostFXContext::IsPSOsReady() const
339{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected