|
|
|
|
|
|
bool shadows = ShadowPass(visibleLights, ref context, ref lightData); |
|
|
|
|
|
|
|
FrameRenderingConfiguration frameRenderingConfiguration; |
|
|
|
SetupFrameRenderingConfiguration(out frameRenderingConfiguration, shadows, stereoEnabled); |
|
|
|
SetupFrameRenderingConfiguration(out frameRenderingConfiguration, shadows, stereoEnabled, sceneViewCamera); |
|
|
|
SetupIntermediateResources(frameRenderingConfiguration, ref context); |
|
|
|
|
|
|
|
// SetupCameraProperties does the following:
|
|
|
|
|
|
|
|
|
|
|
ForwardPass(visibleLights, frameRenderingConfiguration, ref context, ref lightData, stereoEnabled); |
|
|
|
|
|
|
|
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
if (sceneViewCamera) |
|
|
|
CopyTexture(cmd, CameraRenderTargetID.depth, BuiltinRenderTextureType.CameraTarget, m_CopyDepthMaterial, true); |
|
|
|
#endif
|
|
|
|
cmd.ReleaseTemporaryRT(m_ShadowMapRTID); |
|
|
|
cmd.ReleaseTemporaryRT(m_ScreenSpaceShadowMapRTID); |
|
|
|
cmd.ReleaseTemporaryRT(CameraRenderTargetID.depthCopy); |
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void SetupFrameRenderingConfiguration(out FrameRenderingConfiguration configuration, bool shadows, bool stereoEnabled) |
|
|
|
private void SetupFrameRenderingConfiguration(out FrameRenderingConfiguration configuration, bool shadows, bool stereoEnabled, bool sceneViewCamera) |
|
|
|
{ |
|
|
|
configuration = (stereoEnabled) ? FrameRenderingConfiguration.Stereo : FrameRenderingConfiguration.None; |
|
|
|
if (stereoEnabled && XRSettings.eyeTextureDesc.dimension == TextureDimension.Tex2DArray) |
|
|
|
|
|
|
m_RequireCopyColor = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (sceneViewCamera) |
|
|
|
m_RequireDepthTexture = true; |
|
|
|
|
|
|
|
if (shadows) |
|
|
|
{ |
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void CopyTexture(CommandBuffer cmd, RenderTargetIdentifier sourceRT, RenderTargetIdentifier destRT, Material copyMaterial) |
|
|
|
private void CopyTexture(CommandBuffer cmd, RenderTargetIdentifier sourceRT, RenderTargetIdentifier destRT, Material copyMaterial, bool forceBlit = false) |
|
|
|
if (m_CopyTextureSupport != CopyTextureSupport.None) |
|
|
|
if (m_CopyTextureSupport != CopyTextureSupport.None && !forceBlit) |
|
|
|
cmd.CopyTexture(sourceRT, destRT); |
|
|
|
else |
|
|
|
cmd.Blit(sourceRT, destRT, copyMaterial); |
|
|
|