MCPcopy Create free account
hub / github.com/NVIDIA-RTX/RTXPT / PostProcessAA

Method PostProcessAA

Rtxpt/Sample.cpp:2621–2780  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2619}
2620
2621void Sample::PostProcessAA(nvrhi::IFramebuffer* framebuffer, bool reset)
2622{
2623 if (m_ui.RealtimeMode)
2624 {
2625 if (m_ui.RealtimeAA == 0)
2626 {
2627 // TODO: Remove Redundant copy for non AA case
2628 m_commandList->copyTexture(m_renderTargets->ProcessedOutputColor, nvrhi::TextureSlice(), m_renderTargets->OutputColor, nvrhi::TextureSlice());
2629 }
2630 else if (m_ui.RealtimeAA == 1 && m_temporalAntiAliasingPass != nullptr )
2631 {
2632 bool previousViewValid = (GetFrameIndex() != 0);
2633
2634 m_commandList->beginMarker("TAA");
2635
2636 m_temporalAntiAliasingPass->TemporalResolve(m_commandList, m_ui.TemporalAntiAliasingParams, previousViewValid, *m_view, *m_view);
2637
2638 m_commandList->endMarker();
2639 }
2640
2641#if DONUT_WITH_STREAMLINE
2642 // SET STREAMLINE CONSTANTS
2643 {
2644 // This section of code updates the streamline constants every frame. Regardless of whether we are utilising the streamline plugins, as long as streamline is in use, we must set its constants.
2645 affine3 viewReprojection = m_view->GetChildView(ViewType::PLANAR, 0)->GetInverseViewMatrix() * m_viewPrevious->GetViewMatrix();
2646 float4x4 reprojectionMatrix = inverse(m_view->GetProjectionMatrix(false)) * affineToHomogeneous(viewReprojection) * m_viewPrevious->GetProjectionMatrix(false);
2647 float outputAspectRatio = m_displayAspectRatio; //windowViewport.width() / windowViewport.height(); // render and display outputs might not match in case of lower DLSS/etc resolution rounding!
2648 float4x4 projection = perspProjD3DStyleReverse(dm::radians(m_cameraVerticalFOV), outputAspectRatio, m_cameraZNear);
2649
2650 //float2 jitterOffset = std::dynamic_pointer_cast<PlanarView, IView>(m_view)->GetPixelOffset();
2651 float2 jitterOffset = ComputeCameraJitter(m_sampleIndex);
2652
2653 StreamlineInterface::Constants slConstants = {};
2654 slConstants.cameraAspectRatio = outputAspectRatio;
2655 slConstants.cameraFOV = dm::radians(m_cameraVerticalFOV);
2656 slConstants.cameraFar = m_cameraZFar;
2657 slConstants.cameraMotionIncluded = true;
2658 slConstants.cameraNear = m_cameraZNear;
2659 slConstants.cameraPinholeOffset = { 0.f, 0.f };
2660 slConstants.cameraPos = m_camera.GetPosition();
2661 slConstants.cameraFwd = m_camera.GetDir();
2662 slConstants.cameraUp = m_camera.GetUp();
2663 slConstants.cameraRight = normalize(cross(m_camera.GetDir(), m_camera.GetUp()));
2664 slConstants.cameraViewToClip = projection;
2665 slConstants.clipToCameraView = inverse(projection);
2666 slConstants.clipToPrevClip = reprojectionMatrix;
2667 slConstants.depthInverted = m_view->IsReverseDepth() ? true : false;
2668 slConstants.jitterOffset = jitterOffset;
2669 slConstants.mvecScale = { 1.0f / m_renderSize.x , 1.0f / m_renderSize.y }; // This are scale factors used to normalize mvec (to -1,1) and donut has mvec in pixel space
2670 slConstants.prevClipToClip = inverse(reprojectionMatrix);
2671 slConstants.reset = reset;
2672 slConstants.motionVectors3D = false;
2673 slConstants.motionVectorsInvalidValue = FLT_MIN;
2674
2675 GetDeviceManager()->GetStreamline().SetConstants(slConstants);
2676
2677 if (m_ui.RealtimeAA == 3) // DLSS-RR
2678 {

Callers

nothing calls this directly

Calls 3

ApplyMethod · 0.80
RenderMethod · 0.45

Tested by

no test coverage detected