//needs to be edited
// 3DMigoto: 3a1dfd80801c9bf1 |    Unity headers extracted from DecalShaderDiffuseNormals.shader
//    Shader "Deferred Decal/DecalShader Diffuse+Normals" {
//      Properties {
//       _Color ("Diffuse Color", Color) = (1,1,1,1)
//       _MainTex ("Diffuse", 2D) = "white" { }
//       _NormalOpacity ("Normals Strength", Range(0,1)) = 1
//       _BumpMap ("Normals", 2D) = "bump" { }
//      }
//      Fallback Off
//      SubShader 1/1 {
//        Pass 1/1 {
//          ZWrite Off
//          Blend SrcAlpha OneMinusSrcAlpha
//          ColorMask RGB
//          GpuProgramID 56547
//          Program "fp" {
//            SubProgram "d3d11 " {
//              GpuProgramIndex 3
//            }
//          }
//        }
//      }
//    }
//
// Unity 5.3 headers extracted from DecalShaderDiffuseNormals.shader.decompressed:
//   API d3d11
//   Shader model ps_4_0
//   undeciphered1: 36 4 0
//   undeciphered2: 1 4 4 4 0
//   undeciphered3: 0 0
//   ConstBuffer "$Globals" 128
//   Float 96 [_NormalOpacity]
//   Vector 112 [_Color]
//   ConstBuffer "UnityPerCamera" 144
//   Vector 80 [_ProjectionParams]
//   Vector 112 [_ZBufferParams]
//   ConstBuffer "UnityPerDraw" 352
//   Matrix 256 [_World2Object]
//   ConstBuffer "UnityPerCamera2" 64
//   Matrix 0 [_CameraToWorld]
//   SetTexture 0 [_CameraDepthTexture] 2D 2
//   SetTexture 1 [_NormalsCopy] 2D 3
//   SetTexture 2 [_MainTex] 2D 0
//   SetTexture 3 [_BumpMap] 2D 1
//   BindCB "$Globals" 0
//   BindCB "UnityPerCamera" 1
//   BindCB "UnityPerDraw" 2
//   BindCB "UnityPerCamera2" 3
//
// Headers extracted with DarkStarSword's extract_unity53_shaders.py
// https://raw.githubusercontent.com/DarkStarSword/3d-fixes/master/extract_unity53_shaders.py

// ---- Created with 3Dmigoto v1.2.38 on Sun Jul 10 09:12:37 2016
Texture2D<float4> t3 : register(t3);

Texture2D<float4> t2 : register(t2);

Texture2D<float4> t1 : register(t1);

Texture2D<float4> t0 : register(t0);

SamplerState s3_s : register(s3);

SamplerState s2_s : register(s2);

SamplerState s1_s : register(s1);

SamplerState s0_s : register(s0);

cbuffer cb3 : register(b3)
{
  float4 cb3[4];
}

cbuffer cb2 : register(b2)
{
  float4 cb2[20];
}

cbuffer cb1 : register(b1)
{
  float4 cb1[8];
}

cbuffer cb0 : register(b0)
{
  float4 cb0[8];
}




// 3Dmigoto declarations
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);


void main( 
  float4 v0 : SV_POSITION0,
  float4 v1 : TEXCOORD0,
  float4 v2 : TEXCOORD1,
  float4 v3 : TEXCOORD2,
  float4 v4 : TEXCOORD3,
  float4 v5 : TEXCOORD4,
  float3 v6 : TEXCOORD5,
  out float4 o0 : SV_Target0,
  out float4 o1 : SV_Target1)
{
  float4 r0,r1,r2;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.x = cb1[5].z / v3.z;
  r0.xyz = v3.xyz * r0.xxx;
  r1.xy = v2.xy / v2.ww;
  r2.xyzw = t0.Sample(s2_s, r1.xy).xyzw;
  r1.xyzw = t1.Sample(s3_s, r1.xy).xyzw;
  r1.xyz = r1.xyz * float3(2,2,2) + float3(-1,-1,-1);
  r0.w = dot(r1.xyz, v4.xyz);
  r0.w = -0.300000012 + r0.w;
  r0.w = cmp(r0.w < 0);
  if (r0.w != 0) discard;
  r0.w = cb1[7].x * r2.x + cb1[7].y;
  r0.w = 1 / r0.w;
  r0.xyz = r0.xyz * r0.www;
  r1.xyz = cb3[1].xyz * r0.yyy;
  r0.xyw = cb3[0].xyz * r0.xxx + r1.xyz;
  r0.xyz = cb3[2].xyz * r0.zzz + r0.xyw;
  r0.xyz = cb3[3].xyz + r0.xyz;
  r1.xyz = cb2[17].xyz * r0.yyy;
  r0.xyw = cb2[16].xyz * r0.xxx + r1.xyz;
  r0.xyz = cb2[18].xyz * r0.zzz + r0.xyw;
  r0.xyz = cb2[19].xyz + r0.xyz;
  r1.xyz = float3(0.5,0.5,0.5) + -abs(r0.xyz);
  r0.xy = float2(0.5,0.5) + r0.xz;
  r1.xyz = cmp(r1.xyz < float3(0,0,0));
  r0.z = (int)r1.y | (int)r1.x;
  r0.z = (int)r1.z | (int)r0.z;
  if (r0.z != 0) discard;
  r1.xyzw = t2.Sample(s0_s, r0.xy).xyzw;
  r0.xyzw = t3.Sample(s1_s, r0.xy).xyzw;
  r0.xy = r0.wy * float2(2,2) + float2(-1,-1);
  r0.z = -0.00999999978 + r1.w;
  r0.z = cmp(r0.z < 0);
  if (r0.z != 0) discard;
  o0.xyzw = cb0[7].xyzw * r1.xyzw;
  o1.w = cb0[6].x * r1.w;
  r1.xyz = v6.xyz * r0.yyy;
  r1.xyz = r0.xxx * v5.xyz + r1.xyz;
  r0.x = dot(r0.xy, r0.xy);
  r0.x = min(1, r0.x);
  r0.x = 1 + -r0.x;
  r0.x = sqrt(r0.x);
  r0.xyz = r0.xxx * v4.xyz + r1.xyz;
  o1.xyz = r0.xyz * float3(0.5,0.5,0.5) + float3(0.5,0.5,0.5);
  return;
}