浏览代码

Fixed copyDepth pass.

/main
Felipe Lira 7 年前
当前提交
4e3fad68
共有 2 个文件被更改,包括 12 次插入11 次删除
  1. 5
      ScriptableRenderPipeline/LightweightPipeline/LWRP/Passes/ForwardLitPass.cs
  2. 18
      ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/DepthCopy.hlsl

5
ScriptableRenderPipeline/LightweightPipeline/LWRP/Passes/ForwardLitPass.cs


cameraData.postProcessLayer.HasOpaqueOnlyEffects(renderer.postProcessRenderContext))
OpaquePostProcessSubPass(ref context, ref cameraData);
if (depthAttachmentHandle != -1 && cameraData.requiresDepthTexture)
if (depthAttachmentHandle != -1)
CopyDepthSubPass(ref context, ref cameraData);
if (cameraData.requiresOpaqueTexture)

// TODO: Move these to separate passes
if (cameraData.postProcessEnabled)
PostProcessPass(ref context, ref cameraData);
else if (!cameraData.isOffscreenRender && colorAttachmentHandle != -1)

RenderTextureDescriptor descriptor = renderer.CreateRTDesc(ref cameraData);
descriptor.colorFormat = RenderTextureFormat.Depth;
descriptor.depthBufferBits = k_DepthStencilBufferBits;
descriptor.msaaSamples = 1;
descriptor.bindMS = false;
cmd.GetTemporaryRT(RenderTargetHandles.DepthTexture, descriptor, FilterMode.Point);
if (cameraData.msaaSamples > 1)

18
ScriptableRenderPipeline/LightweightPipeline/LWRP/ShaderLibrary/DepthCopy.hlsl


#if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
#define DEPTH_TEXTURE_MS Texture2DMSArray
#define DEPTH_TEXTURE(name) TEXTURE2D_ARRAY(name)
#define LOAD(uv, sampleIndex) LOAD_TEXTURE2D_ARRAY_MSAA(_CameraDepthTexture, uv, unity_StereoEyeIndex, sampleIndex)
#define SAMPLE(uv) SAMPLE_TEXTURE2D_ARRAY(_CameraDepthTexture, sampler_CameraDepthTexture, uv, unity_StereoEyeIndex).r
#define LOAD(uv, sampleIndex) LOAD_TEXTURE2D_ARRAY_MSAA(_CameraDepthAttachment, uv, unity_StereoEyeIndex, sampleIndex)
#define SAMPLE(uv) SAMPLE_TEXTURE2D_ARRAY(_CameraDepthAttachment, sampler_CameraDepthAttachment, uv, unity_StereoEyeIndex).r
#define LOAD(uv, sampleIndex) LOAD_TEXTURE2D_MSAA(_CameraDepthTexture, uv, sampleIndex)
#define SAMPLE(uv) SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, sampler_CameraDepthTexture, uv)
#define LOAD(uv, sampleIndex) LOAD_TEXTURE2D_MSAA(_CameraDepthAttachment, uv, sampleIndex)
#define SAMPLE(uv) SAMPLE_DEPTH_TEXTURE(_CameraDepthAttachment, sampler_CameraDepthAttachment, uv)
DEPTH_TEXTURE_MS<float> _CameraDepthTexture;
DEPTH_TEXTURE_MS<float> _CameraDepthAttachment;
float4 _CameraDepthTexture_TexelSize;
float4 _CameraDepthAttachment_TexelSize;
DEPTH_TEXTURE(_CameraDepthTexture);
SAMPLER(sampler_CameraDepthTexture);
DEPTH_TEXTURE(_CameraDepthAttachment);
SAMPLER(sampler_CameraDepthAttachment);
int2 coord = int2(uv * _CameraDepthTexture_TexelSize.zw);
int2 coord = int2(uv * _CameraDepthAttachment_TexelSize.zw);
int samples = (int)_SampleCount;
#if UNITY_REVERSED_Z
float outDepth = 1.0;

正在加载...
取消
保存