浏览代码

Support depth texture correctly in stereo

The seperate depth RT wasn't being created or managed correctly in stereo.
/2018.1
Tim Cooper 7 年前
当前提交
33926192
共有 1 个文件被更改,包括 33 次插入6 次删除
  1. 39
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs

39
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs


if (LightweightUtils.HasFlag(frameRenderingConfiguration, FrameRenderingConfiguration.DepthPrePass))
{
DepthPass(ref context);
DepthPass(ref context, frameRenderingConfiguration);
// Only screen space shadowmap mode is supported.
if (shadows)

CommandBufferPool.Release(cmd);
}
private void DepthPass(ref ScriptableRenderContext context)
private void DepthPass(ref ScriptableRenderContext context, FrameRenderingConfiguration frameRenderingConfiguration)
{
CommandBuffer cmd = CommandBufferPool.Get("Depth Prepass");
SetRenderTarget(cmd, m_DepthRT, ClearFlag.Depth);

renderQueueRange = RenderQueueRange.opaque
};
if (LightweightUtils.HasFlag(frameRenderingConfiguration, FrameRenderingConfiguration.Stereo))
context.StartMultiEye(m_CurrCamera);
if (LightweightUtils.HasFlag(frameRenderingConfiguration, FrameRenderingConfiguration.Stereo))
context.StopMultiEye(m_CurrCamera);
}
private void ForwardPass(List<VisibleLight> visibleLights, FrameRenderingConfiguration frameRenderingConfiguration, ref ScriptableRenderContext context, ref LightData lightData, bool stereoEnabled)

if (LightweightUtils.HasFlag(renderingConfig, FrameRenderingConfiguration.IntermediateTexture))
{
if (LightweightUtils.HasFlag(renderingConfig, FrameRenderingConfiguration.Stereo))
SetupIntermediateResourcesStereo(cmd, msaaSamples);
SetupIntermediateResourcesStereo(cmd, renderingConfig, msaaSamples);
else
SetupIntermediateResourcesSingle(cmd, renderingConfig, msaaSamples);
}

cmd.GetTemporaryRT(CameraRenderTargetID.copyColor, colorRTDesc, FilterMode.Point);
}
private void SetupIntermediateResourcesStereo(CommandBuffer cmd, int msaaSamples)
private void SetupIntermediateResourcesStereo(CommandBuffer cmd, FrameRenderingConfiguration renderingConfig, int msaaSamples)
RenderTextureDescriptor rtDesc = new RenderTextureDescriptor();
rtDesc = XRSettings.eyeTextureDesc;
// TODO: support renderscale
// TODO: merge with SetupIntermediateResourcesSingle
var rtDesc = XRSettings.eyeTextureDesc;
if (m_RequireDepthTexture)
{
var depthRTDesc = rtDesc;
depthRTDesc.colorFormat = RenderTextureFormat.Depth;
depthRTDesc.depthBufferBits = kDepthStencilBufferBits;
//RenderTextureDescriptor depthRTDesc = new RenderTextureDescriptor(rtWidth, rtHeight, RenderTextureFormat.Depth, kDepthStencilBufferBits);
cmd.GetTemporaryRT(CameraRenderTargetID.depth, depthRTDesc, FilterMode.Bilinear);
if (LightweightUtils.HasFlag(renderingConfig, FrameRenderingConfiguration.DepthCopy))
cmd.GetTemporaryRT(CameraRenderTargetID.depthCopy, depthRTDesc, FilterMode.Bilinear);
}
//RenderTextureDescriptor rtDesc = new RenderTextureDescriptor();
rtDesc.sRGB = true;
if (m_RequireCopyColor)
cmd.GetTemporaryRT(CameraRenderTargetID.copyColor, rtDesc, FilterMode.Point);
}
private void SetupShaderConstants(List<VisibleLight> visibleLights, ref ScriptableRenderContext context, ref LightData lightData)

正在加载...
取消
保存