{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct VertexOutput
UNITY_VERTEX_OUTPUT_STEREO
UNITY_SETUP_INSTANCE_ID(i);
UNITY_TRANSFER_INSTANCE_ID(i, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
#if MSAA_DEPTH
Texture2DMS<float> _CameraDepthTexture;
#if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
#define USE_ARRAY_TEXTURE 1
#endif
#ifdef MSAA_DEPTH
#ifdef USE_ARRAY_TEXTURE
Texture2DMSArray<float> _CameraDepthTexture;
#else
TEXTURE2D(_CameraDepthTexture);
TEXTURE2D_ARRAY(_CameraDepthTexture);
int2 coord = int2(uv * _CameraDepthTexture_TexelSize.zw);
int samples = (int)_SampleCount;
#if UNITY_REVERSED_Z
for (int i = 0; i < samples; ++i)
outDepth = DEPTH_OP(LOAD_TEXTURE2D_MSAA(_CameraDepthTexture, coord, i), outDepth);
outDepth = DEPTH_OP(LOAD_TEXTURE2D_ARRAY_MSAA(_CameraDepthTexture, uv, unity_StereoEyeIndex, i), outDepth);
outDepth = DEPTH_OP(LOAD_TEXTURE2D_MSAA(_CameraDepthTexture, uv, i), outDepth);
return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, sampler_CameraDepthTexture, uv);
return SAMPLE_TEXTURE2D_ARRAY(_CameraDepthTexture, sampler_CameraDepthTexture, uv, unity_StereoEyeIndex).r;
}
float frag(VertexOutput i) : SV_Depth
return SampleDepth(i.uv);
#endif // LIGHTWEIGHT_DEPTH_COPY_INCLUDED
#include "LWRP/ShaderLibrary/DepthCopy.hlsl"
ENDHLSL
SubShader
Tags { "RenderType" = "Opaque" "RenderPipeline" = "LightiweightPipeline"}
Tags { "RenderType" = "Opaque" "RenderPipeline" = "LightweightPipeline"}
Pass