Shader "HiddenURP/Environment/WeatherSystem/BlitToScreen"
{
    Properties
	{
		_MainTex("Texture", any) = "" {}
		_SceneDepthTexture("Texture", any) = "" {}
		_Color("Multiplicative color", Color) = (1.0, 1.0, 1.0, 1.0)
	}
	SubShader 
	{
        Pass 
		{
            ZTest Always Cull Off ZWrite Off

            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #include "UnityCG.cginc"

            UNITY_DECLARE_SCREENSPACE_TEXTURE(_MainTex);
            uniform float4 _MainTex_ST;
			UNITY_DECLARE_SCREENSPACE_TEXTURE(_SceneDepthTexture);
            uniform float4 _Color;

            struct appdata_t {
                float4 vertex : POSITION;
                float2 texcoord : TEXCOORD0;
                UNITY_VERTEX_INPUT_INSTANCE_ID
            };

            struct v2f {
                float4 vertex : SV_POSITION;
                float2 texcoord : TEXCOORD0;
                UNITY_VERTEX_OUTPUT_STEREO
            };

            v2f vert (appdata_t v)
            {
                v2f o;
                UNITY_SETUP_INSTANCE_ID(v);
                UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.texcoord = TRANSFORM_TEX(v.texcoord.xy, _MainTex);
                return o;
            }
			
			struct FResult
			{
				float4 color	:	SV_Target;
				float depth		:	SV_Depth;
			};
			
            FResult frag (v2f i)
            {
				FResult o;
                UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
                o.color = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, i.texcoord) * _Color;
				o.depth = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_SceneDepthTexture, i.texcoord);
				return o;
            }
            ENDCG

        }

    }
    Fallback Off
}
