using ( new ProfilingSample ( cmd , "Push Global Parameters" , CustomSamplerId . PushGlobalParameters . GetSampler ( ) ) )
{
hdCamera . SetupGlobalParams ( cmd ) ;
if ( m_FrameSettings . enableStereo )
hdCamera . SetupGlobalStereoParams ( cmd ) ;
m_SSSBufferManager . PushGlobalParams ( cmd , sssParameters , m_FrameSettings ) ;
// TODO: Float HDCamera setup higher in order to pass stereo into GetCullingParameters
ScriptableCullingParameters cullingParams ;
if ( ! CullResults . GetCullingParameters ( camera , out cullingParams ) )
if ( ! CullResults . GetCullingParameters ( camera , m_FrameSettings . enableStereo , out cullingParams ) )
{
renderContext . Submit ( ) ;
continue ;
DecalSystem . instance . EndCull ( ) ;
}
renderContext . SetupCameraProperties ( camera ) ;
renderContext . SetupCameraProperties ( camera , m_FrameSettings . enableStereo ) ;
PushGlobalParams ( hdCamera , cmd , diffusionProfileSettings ) ;
}
ConfigureForShadowMask ( enableBakeShadowMask , cmd ) ;
StartStereoRendering ( renderContext , hdCamera . camera ) ;
// TODO: Add stereo occlusion mask
bool forcePrepassForDecals = m_DbufferManager . vsibleDecalCount > 0 ;
RenderDepthPrepass ( m_CullResults , hdCamera , renderContext , cmd , forcePrepassForDecals ) ;
RenderPyramidDepth ( hdCamera , cmd , renderContext , FullScreenDebugMode . DepthPyramid ) ;
StopStereoRendering ( renderContext , hdCamera . camera ) ;
if ( m_CurrentDebugDisplaySettings . IsDebugMaterialDisplayEnabled ( ) )
{
}
else
{
StartStereoRendering ( renderContext , hdCamera . camera ) ;
using ( new ProfilingSample ( cmd , "Render SSAO" , CustomSamplerId . RenderSSAO . GetSampler ( ) ) )
{
// TODO: Everything here (SSAO, Shadow, Build light list, deferred shadow, material and light classification can be parallelize with Async compute)
HDUtils . DrawFullScreen ( cmd , hdCamera , m_CopyStencilForNoLighting , m_CameraStencilBufferCopy , m_CameraDepthStencilBuffer , null , 1 ) ;
}
}
StopStereoRendering ( renderContext , hdCamera . camera ) ;
GPUFence buildGPULightListsCompleteFence = new GPUFence ( ) ;
if ( m_FrameSettings . enableAsyncCompute )
{
m_LightLoop . RenderShadows ( renderContext , cmd , m_CullResults ) ;
// TODO: check if statement below still apply
renderContext . SetupCameraProperties ( camera ) ; // Need to recall SetupCameraProperties after RenderShadows as it modify our view/proj matrix
renderContext . SetupCameraProperties ( camera , m_FrameSettings . enableStereo ) ; // Need to recall SetupCameraProperties after RenderShadows as it modify our view/proj matrix
}
using ( new ProfilingSample ( cmd , "Deferred directional shadows" , CustomSamplerId . RenderDeferredDirectionalShadow . GetSampler ( ) ) )
RenderDeferredLighting ( hdCamera , cmd ) ;
// Might float this higher if we enable stereo w/ deferred
StartStereoRendering ( renderContext , hdCamera . camera ) ;
RenderForward ( m_CullResults , hdCamera , renderContext , cmd , ForwardPass . Opaque ) ;
RenderForwardError ( m_CullResults , hdCamera , renderContext , cmd , ForwardPass . Opaque ) ;
AccumulateDistortion ( m_CullResults , hdCamera , renderContext , cmd ) ;
RenderDistortion ( cmd , m_Asset . renderPipelineResources , hdCamera ) ;
StopStereoRendering ( renderContext , hdCamera . camera ) ;
PushFullScreenDebugTexture ( cmd , m_CameraColorBuffer , hdCamera , FullScreenDebugMode . NanTracker ) ;
PushColorPickerDebugTexture ( cmd , m_CameraColorBuffer , hdCamera ) ;
StartStereoRendering ( renderContext , hdCamera . camera ) ;
// Final blit
if ( m_FrameSettings . enablePostprocess & & CoreUtils . IsPostProcessingActive ( postProcessLayer ) )
{
HDUtils . BlitCameraTexture ( cmd , hdCamera , m_CameraColorBuffer , BuiltinRenderTextureType . CameraTarget ) ;
}
}
StopStereoRendering ( renderContext , hdCamera . camera ) ;
// Pushes to XR headset and/or display mirror
if ( m_FrameSettings . enableStereo )
renderContext . StereoEndRender ( hdCamera . camera ) ;
}
}
// END TEMP
}
}
void StartStereoRendering ( ScriptableRenderContext renderContext , Camera cam )
{
if ( m_FrameSettings . enableStereo )
renderContext . StartMultiEye ( cam ) ;
}
void StopStereoRendering ( ScriptableRenderContext renderContext , Camera cam )
{
if ( m_FrameSettings . enableStereo )
renderContext . StopMultiEye ( cam ) ;
}
}
}