| 70 | } |
| 71 | |
| 72 | void IntroPathTracer::SampleRenderCode(nvrhi::IFramebuffer* framebuffer, nvrhi::CommandListHandle commandList, const SampleConstants& constants) |
| 73 | { |
| 74 | ScopedPerfMarker perfMarker("Intro-Sample", commandList); |
| 75 | |
| 76 | nvrhi::rt::State state; |
| 77 | |
| 78 | nvrhi::rt::DispatchRaysArguments args; |
| 79 | nvrhi::Viewport viewport = GetView().GetViewport(); |
| 80 | uint32_t width = (uint32_t)(viewport.maxX - viewport.minX); |
| 81 | uint32_t height = (uint32_t)(viewport.maxY - viewport.minY); |
| 82 | args.width = width; |
| 83 | args.height = height; |
| 84 | |
| 85 | if (m_ui.RealtimeMode) |
| 86 | { |
| 87 | PopulateGBuffer(commandList); |
| 88 | |
| 89 | // Depth hierarchy (needed by GTAO and SSR, must run before both) |
| 90 | if (m_depthHierarchyRenderer) |
| 91 | { |
| 92 | ScopedPerfMarker perfMarker("Depth hierarchy", commandList); |
| 93 | m_depthHierarchyRenderer->Generate(commandList, m_renderTargets->Depth, width, height); |
| 94 | } |
| 95 | |
| 96 | // Screen-space ambient occlusion |
| 97 | if (m_gtaoRenderer) |
| 98 | { |
| 99 | m_gtaoRenderer->Render(commandList, constants, m_frameIndex, |
| 100 | m_depthHierarchyRenderer->m_depthHierarchy, m_renderTargets->SpecNormal, |
| 101 | m_renderTargets->ScreenMotionVectors, |
| 102 | m_prevDepth, m_bindingSet); |
| 103 | } |
| 104 | |
| 105 | // Reflections |
| 106 | if (m_reflectionSystemReady && m_localCubemapPipeline) |
| 107 | { |
| 108 | ScopedPerfMarker perfMarker("SSR", commandList); |
| 109 | |
| 110 | UpdateLocalCubemap(commandList, constants); |
| 111 | RenderSSR(commandList, constants); |
| 112 | BlurSSR(commandList); |
| 113 | } |
| 114 | |
| 115 | RasterDeferredLighting(commandList); |
| 116 | |
| 117 | CopyDepthForNextFrame(commandList); |
| 118 | |
| 119 | m_frameIndex++; |
| 120 | } |
| 121 | else |
| 122 | { |
| 123 | ReferencePathTracer(commandList); |
| 124 | } |
| 125 | |
| 126 | commandList->setBufferState(m_renderTargets->StablePlanesBuffer, nvrhi::ResourceStates::UnorderedAccess); |
| 127 | } |
| 128 | |
| 129 | void IntroPathTracer::UpdateLocalCubemap(nvrhi::CommandListHandle commandList, const SampleConstants& constants) |