1 Shader "Hidden/PostProcessing/CopyStd"
4 // We need this shader for the very first RT blit using the internal CommandBuffer.Blit() method
5 // so it can handle AAResolve properly. We also need it to be separate because of VR and the
6 // need for a Properties block. If we were to add this block to the other Copy shader it would
7 // not allow us to manually bind _MainTex, thus breaking a few other things in the process...
12 _MainTex ("", 2D) = "white" {}
19 float4 vertex : POSITION;
20 float2 texcoord : TEXCOORD0;
25 float4 vertex : SV_POSITION;
26 float2 texcoord : TEXCOORD0;
32 Varyings Vert(Attributes v)
35 o.vertex = float4(v.vertex.xy * 2.0 - 1.0, 0.0, 1.0);
36 o.texcoord = v.texcoord;
38 #if UNITY_UV_STARTS_AT_TOP
39 o.texcoord = o.texcoord * float2(1.0, -1.0) + float2(0.0, 1.0);
42 o.texcoord = o.texcoord * _MainTex_ST.xy + _MainTex_ST.zw; // We need this for VR
47 float4 Frag(Varyings i) : SV_Target
49 float4 color = tex2D(_MainTex, i.texcoord);
53 //>>> We don't want to include StdLib.hlsl in this file so let's copy/paste what we need
56 return (x < 0.0 || x > 0.0 || x == 0.0) ? false : true;
59 bool AnyIsNan(float4 x)
61 return IsNan(x.x) || IsNan(x.y) || IsNan(x.z) || IsNan(x.w);
65 float4 FragKillNaN(Varyings i) : SV_Target
67 float4 color = tex2D(_MainTex, i.texcoord);
81 Cull Off ZWrite Off ZTest Always
94 // 1 - Copy + NaN killer
100 #pragma fragment FragKillNaN