浏览代码

Merge pull request #1263 from Unity-Technologies/lw/fix_copy_depth_to_scene_view_camera

Lw/fix copy depth to scene view camera
/main
GitHub 6 年前
当前提交
9dec0564
共有 2 个文件被更改,包括 14 次插入9 次删除
  1. 21
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs
  2. 2
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Shaders/LightweightCopyDepth.shader

21
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs


if (!CullResults.GetCullingParameters(m_CurrCamera, stereoEnabled, out cullingParameters))
continue;
var cmd = CommandBufferPool.Get("");
cullingParameters.shadowDistance = Mathf.Min(m_ShadowPass.RenderingDistance, m_CurrCamera.farClipPlane);
#if UNITY_EDITOR

ForwardPass(frameRenderingConfiguration, ref lightData, ref context);
cmd.name = "After Camera Render";
CommandBuffer cmd;
{
cmd = CommandBufferPool.Get("Copy Depth to Camera");
cmd.DisableShaderKeyword(kMSAADepthKeyword);
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);
}
context.Submit();
cmd = CommandBufferPool.Get("Dispose of Temporaries");
cmd.ReleaseTemporaryRT(CameraRenderTargetID.depthCopy);
cmd.ReleaseTemporaryRT(CameraRenderTargetID.depth);
cmd.ReleaseTemporaryRT(CameraRenderTargetID.color);

m_ShadowPass.Dispose(cmd);
m_ShadowPass.Dispose(cmd);
context.Submit();
}

bool forceBlit = false;
if (m_MSAASamples > 1)
{
m_CopyDepthMaterial.SetFloat(m_SampleCount, (float)m_MSAASamples);
m_CopyDepthMaterial.EnableKeyword(kMSAADepthKeyword);
cmd.SetGlobalFloat(m_SampleCount, (float)m_MSAASamples);
cmd.EnableShaderKeyword(kMSAADepthKeyword);
m_CopyDepthMaterial.DisableKeyword(kMSAADepthKeyword);
cmd.DisableShaderKeyword(kMSAADepthKeyword);
CopyTexture(cmd, m_DepthRT, m_CopyDepth, m_CopyDepthMaterial, forceBlit);
depthRT = m_CopyDepth;

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


#pragma vertex vert
#pragma fragment frag
#pragma multi_compile _MSAA_DEPTH
#pragma multi_compile __ _MSAA_DEPTH
#include "LWRP/ShaderLibrary/DepthCopy.hlsl"

正在加载...
取消
保存