if ( m_Owner ! = null )
m_Owner . Build ( ) ;
}
public override void Dispose ( )
{
base . Dispose ( ) ;
public override void Render ( ScriptableRenderContext renderContext , Camera [ ] cameras )
{
{
return new HDRenderPipelineInstance ( this ) ;
}
SkyManager m_SkyManager = new SkyManager ( ) ;
public SkyManager skyManager
{
public bool useForwardRenderingOnly = false ; // TODO: Currently there is no way to strip the extra forward shaders generated by the shaders compiler, so we can switch dynamically.
public bool useDepthPrepass = false ;
public bool useDistortion = true ;
// we have to fallback to forward-only rendering when scene view is using wireframe rendering mode --
// as rendering everything in wireframe + deferred do not play well together
public bool ShouldUseForwardRenderingOnly ( ) { return useForwardRenderingOnly | | GL . wireframe ; }
}
DebugParameters m_DebugParameters = new DebugParameters ( ) ;
{
m_lightLoop . Cleanup ( ) ;
m_LitRenderLoop . Cleanup ( ) ;
Utilities . Destroy ( m_DebugViewMaterialGBuffer ) ;
m_SkyManager . Cleanup ( ) ;
cmd . GetTemporaryRT ( m_CameraColorBuffer , w , h , 0 , FilterMode . Point , RenderTextureFormat . ARGBHalf , RenderTextureReadWrite . Linear , 1 , true ) ; // Enable UAV
cmd . GetTemporaryRT ( m_CameraDepthBuffer , w , h , 2 4 , FilterMode . Point , RenderTextureFormat . Depth ) ;
if ( ! debugParameters . useForwardRenderingOnly )
if ( ! debugParameters . Sho uldU seForwardRenderingOnly( ) )
{
m_gbufferManager . InitGBuffers ( w , h , cmd ) ;
}
void RenderGBuffer ( CullResults cull , Camera camera , ScriptableRenderContext renderContext )
{
if ( debugParameters . useForwardRenderingOnly )
if ( debugParameters . Sho uldU seForwardRenderingOnly( ) )
{
return ;
}
{
// If we are forward only we don't need to render ForwardOpaqueDepth object
// But in case we request a prepass we render it
if ( debugParameters . useForwardRenderingOnly & & ! debugParameters . useDepthPrepass )
if ( debugParameters . Sho uldU seForwardRenderingOnly( ) & & ! debugParameters . useDepthPrepass )
return ;
using ( new Utilities . ProfilingSample ( "Forward opaque depth" , renderContext ) )
}
// Render GBuffer opaque
if ( ! debugParameters . useForwardRenderingOnly )
if ( ! debugParameters . Sho uldU seForwardRenderingOnly( ) )
{
Utilities . SetupMaterialHDCamera ( hdCamera , m_DebugViewMaterialGBuffer ) ;
m_DebugViewMaterialGBuffer . SetFloat ( "_DebugViewMaterial" , ( float ) debugParameters . debugViewMaterial ) ;
void RenderDeferredLighting ( HDCamera hdCamera , ScriptableRenderContext renderContext )
{
if ( debugParameters . useForwardRenderingOnly )
if ( debugParameters . Sho uldU seForwardRenderingOnly( ) )
{
return ;
}
{
// TODO: Currently we can't render opaque object forward when deferred is enabled
// miss option
if ( ! debugParameters . useForwardRenderingOnly & & renderOpaque )
if ( ! debugParameters . Sho uldU seForwardRenderingOnly( ) & & renderOpaque )
return ;
using ( new Utilities . ProfilingSample ( "Forward Pass" , renderContext ) )
using ( new Utilities . ProfilingSample ( "Velocity Pass" , renderContext ) )
{
// If opaque velocity have been render during GBuffer no need to render it here
if ( ( ShaderConfig . s_VelocityInGbuffer = = 0 ) | | debugParameters . useForwardRenderingOnly )
if ( ( ShaderConfig . s_VelocityInGbuffer = = 0 ) | | debugParameters . Sho uldU seForwardRenderingOnly( ) )
return ;
int w = camera . pixelWidth ;
m_ShadowSettings . maxShadowDistance = m_CommonSettings . shadowMaxDistance ;
}
}
public void Render ( ScriptableRenderContext renderContext , IEnumerable < Camera > cameras )
{
if ( ! m_LitRenderLoop . isInit )
using ( new Utilities . ProfilingSample ( "Shadow Pass" , renderContext ) )
{
m_ShadowPass . Render ( renderContext , cullResults , out shadows ) ;
}
}
renderContext . SetupCameraProperties ( camera ) ; // Need to recall SetupCameraProperties after m_ShadowPass.Render
using ( new Utilities . ProfilingSample ( "Build Light list" , renderContext ) )
PushGlobalParams ( hdCamera , renderContext ) ;
}
}
UpdateSkyEnvironment ( hdCamera , renderContext ) ;
RenderDeferredLighting ( hdCamera , renderContext ) ;