}
else
{
// Temporary hack. For scene view, by default, we don't want to have the lighting override layers in the current sky.
// Temporary hack:
// For scene view, by default, we use the "main" camera volume layer mask if it exists
// Otherwise we just remove the lighting override layers in the current sky to avoid conflicts
layerMask = ( - 1 & ~ m_Asset . renderPipelineSettings . lightLoopSettings . skyLightingOverrideLayerMask ) ;
var mainCamera = Camera . main ;
bool needFallback = true ;
if ( mainCamera ! = null )
{
var mainCamAdditionalData = mainCamera . GetComponent < HDAdditionalCameraData > ( ) ;
if ( mainCamAdditionalData ! = null )
{
layerMask = mainCamAdditionalData . volumeLayerMask ;
needFallback = false ;
}
}
if ( needFallback )
{
// If the override layer is "Everything", we fall-back to "Everything" for the current layer mask to avoid issues by having no current layer
// In practice we should never have "Everything" as an override mask as it does not make sense (a warning is issued in the UI)
if ( m_Asset . renderPipelineSettings . lightLoopSettings . skyLightingOverrideLayerMask = = - 1 )
layerMask = - 1 ;
else
layerMask = ( - 1 & ~ m_Asset . renderPipelineSettings . lightLoopSettings . skyLightingOverrideLayerMask ) ;
}
}
}
VolumeManager . instance . Update ( camera . transform , layerMask ) ;
renderContext . ExecuteCommandBuffer ( cmd ) ;
cmd . Clear ( ) ;
buildGPULightListsCompleteFence = m_LightLoop . BuildGPULightListsAsyncBegin ( hdCamera , renderContext , m_CameraDepthStencilBuffer , m_CameraStencilBufferCopy , startFence , m_SkyManager . IsSkyValid ( ) ) ;
buildGPULightListsCompleteFence = m_LightLoop . BuildGPULightListsAsyncBegin ( hdCamera , renderContext , m_CameraDepthStencilBuffer , m_CameraStencilBufferCopy , startFence , m_SkyManager . IsLighting SkyValid ( ) ) ;
}
using ( new ProfilingSample ( cmd , "Render shadows" , CustomSamplerId . RenderShadows . GetSampler ( ) ) )
{
using ( new ProfilingSample ( cmd , "Build Light list" , CustomSamplerId . BuildLightList . GetSampler ( ) ) )
{
m_LightLoop . BuildGPULightLists ( hdCamera , cmd , m_CameraDepthStencilBuffer , m_CameraStencilBufferCopy , m_SkyManager . IsSkyValid ( ) ) ;
m_LightLoop . BuildGPULightLists ( hdCamera , cmd , m_CameraDepthStencilBuffer , m_CameraStencilBufferCopy , m_SkyManager . IsLighting SkyValid ( ) ) ;
}
}
{
if ( hdCamera . clearColorMode = = HDAdditionalCameraData . ClearColorMode . BackgroundColor | |
// If we want the sky but the sky don't exist, still clear with background color
( hdCamera . clearColorMode = = HDAdditionalCameraData . ClearColorMode . Sky & & ! m_SkyManager . IsSkyValid ( ) ) | |
( hdCamera . clearColorMode = = HDAdditionalCameraData . ClearColorMode . Sky & & ! m_SkyManager . IsVisual SkyValid ( ) ) | |
// Special handling for Preview we force to clear with background color (i.e black)
// Note that the sky use in this case is the last one setup. If there is no scene or game, there is no sky use as reflection in the preview
hdCamera . camera . cameraType = = CameraType . Preview