浏览代码

Add support for render scale and XR

/LW-DistortionPass
Matt Dean 7 年前
当前提交
5b394827
共有 1 个文件被更改,包括 19 次插入5 次删除
  1. 24
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs

24
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs


StopStereoRendering(ref context, frameRenderingConfiguration);
}
private void OpaqueTexturePass(ref ScriptableRenderContext context)
private void OpaqueTexturePass(ref ScriptableRenderContext context, FrameRenderingConfiguration frameRenderingConfiguration)
RenderTextureDescriptor opaqueDesc;
if (LightweightUtils.HasFlag(frameRenderingConfiguration, FrameRenderingConfiguration.Stereo))
opaqueDesc = XRSettings.eyeTextureDesc;
else
opaqueDesc = new RenderTextureDescriptor(m_CurrCamera.pixelWidth, m_CurrCamera.pixelHeight);
float renderScale = (m_CurrCamera.cameraType == CameraType.Game) ? m_Asset.RenderScale : 1.0f;
cmd.GetTemporaryRT(CameraRenderTargetID.opaque, m_CurrCamera.pixelWidth / 2, m_CurrCamera.pixelHeight / 2, 0, FilterMode.Bilinear, m_ColorFormat);
opaqueDesc.width = (int)((float)opaqueDesc.width * renderScale * 0.5f);
opaqueDesc.height = (int)((float)opaqueDesc.height * renderScale * 0.5f);
cmd.GetTemporaryRT(CameraRenderTargetID.opaque, opaqueDesc, FilterMode.Bilinear);
cmd.GetTemporaryRT(CameraRenderTargetID.opaque, m_CurrCamera.pixelWidth / 4, m_CurrCamera.pixelHeight / 4, 0, FilterMode.Bilinear, m_ColorFormat);
opaqueDesc.width = (int)((float)opaqueDesc.width * renderScale * 0.25f);
opaqueDesc.height = (int)((float)opaqueDesc.height * renderScale * 0.25f);
cmd.GetTemporaryRT(CameraRenderTargetID.opaque, opaqueDesc, FilterMode.Bilinear);
cmd.GetTemporaryRT(CameraRenderTargetID.opaque, m_CurrCamera.pixelWidth, m_CurrCamera.pixelHeight, 0, FilterMode.Bilinear, m_ColorFormat);
opaqueDesc.width = (int)((float)opaqueDesc.width * renderScale);
opaqueDesc.height = (int)((float)opaqueDesc.height * renderScale);
cmd.GetTemporaryRT(CameraRenderTargetID.opaque, opaqueDesc, FilterMode.Bilinear);
cmd.Blit(m_CurrCameraColorRT, CameraRenderTargetID.opaque);
break;
}

if(m_Asset.RequireOpaqueTexture)
{
OpaqueTexturePass(ref context);
OpaqueTexturePass(ref context, config);
}
}

正在加载...
取消
保存