浏览代码

Blit shaders modified to avoid tile depth load.

/main
Felipe Lira 7 年前
当前提交
567d0716
共有 3 个文件被更改,包括 6 次插入6 次删除
  1. 6
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs
  2. 2
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightBlit.shader
  3. 4
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightCopyDepth.shader

6
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs


{
// If PostProcessing is enabled, it is already blit to CameraTarget.
if (!LightweightUtils.HasFlag(renderingConfig, FrameRenderingConfiguration.PostProcess))
Blit(cmd, renderingConfig, BuiltinRenderTextureType.CurrentActive, BuiltinRenderTextureType.CameraTarget);
Blit(cmd, renderingConfig, BuiltinRenderTextureType.CurrentActive, BuiltinRenderTextureType.CameraTarget, m_BlitMaterial);
}
SetRenderTarget(cmd, BuiltinRenderTextureType.CameraTarget);

private void Blit(CommandBuffer cmd, FrameRenderingConfiguration renderingConfig, RenderTargetIdentifier sourceRT, RenderTargetIdentifier destRT, Material material = null)
{
cmd.SetGlobalTexture(m_BlitTexID, sourceRT);
if (LightweightUtils.HasFlag(renderingConfig, FrameRenderingConfiguration.DefaultViewport))
{
cmd.Blit(sourceRT, destRT, material);

if (m_BlitQuad == null)
m_BlitQuad = LightweightUtils.CreateQuadMesh(false);
cmd.SetGlobalTexture(m_BlitTexID, sourceRT);
cmd.DrawMesh(m_BlitQuad, Matrix4x4.identity, m_BlitMaterial);
cmd.DrawMesh(m_BlitQuad, Matrix4x4.identity, material);
}
}

2
ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightBlit.shader


{
Tags { "LightMode" = "LightweightForward"}
ZTest Always ZWrite Off
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library
#pragma prefer_hlslcc gles

4
ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightCopyDepth.shader


Pass
{
ColorMask 0
ZTest Always
ZWrite On
ZTest Always ZWrite Off ColorMask 0
HLSLPROGRAM
// Required to compile gles 2.0 with standard srp library

正在加载...
取消
保存