// hlsltool.py -I ../.. --auto-fix-vertex-halo --fix-unity-reflection --fix-unity-frustum-world --only-autofixed --fxc /home/rshan/fxc.exe cd2fe3de8400ffc9-vs_replace.txt
// 3DMigoto: cd2fe3de8400ffc9 |    Unity headers extracted from Alloy Deferred Reflections.shader
//    Shader "Hidden/Alloy/Deferred Reflections" {
//      Properties {
//       _SrcBlend ("", Float) = 1
//       _DstBlend ("", Float) = 1
//      }
//      Fallback Off
//      SubShader 1/1 {
//        Pass 2/2 {
//          ZTest Always
//          ZWrite Off
//          Blend [_SrcBlend] [_DstBlend]
//          GpuProgramID 75119
//          Program "vp" {
//            SubProgram "d3d11 " {
//              GpuProgramIndex 5
//            }
//          }
//        }
//      }
//    }
//
// Unity 5.3 headers extracted from Alloy Deferred Reflections.shader.decompressed:
//   API d3d11
//   Shader model vs_4_0
//   undeciphered1: 8 0 0
//   undeciphered2: 1 0 2 0 0
//   undeciphered3: 1 1 0 0
//   ConstBuffer "UnityPerCamera" 144
//   Vector 80 [_ProjectionParams]
//   ConstBuffer "UnityPerDraw" 352
//   Matrix 0 [glstate_matrix_mvp]
//   BindCB "UnityPerCamera" 0
//   BindCB "UnityPerDraw" 1
//
// 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.30 on Wed Oct 26 06:14:08 2016
cbuffer cb1 : register(b1)
{
  float4 cb1[4];
}

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




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


void main( 
  float4 v0 : POSITION0,
  out float2 o0 : TEXCOORD0,
  out float4 o1 : SV_POSITION0)
{
  float4 r0,r1;
  uint4 bitmask, uiDest;
  float4 fDest;

float4 stereo = StereoParams.Load(0);
float separation = stereo.x, convergence = stereo.y, eye = stereo.z;

  r0.xyzw = cb1[1].xyzw * v0.yyyy;
  r0.xyzw = cb1[0].xyzw * v0.xxxx + r0.xyzw;
  r0.xyzw = cb1[2].xyzw * v0.zzzz + r0.xyzw;
  r0.xyzw = cb1[3].xyzw * v0.wwww + r0.xyzw;

o1.xyzw = r0.xyzw; // Relocated to here with hlsltool.py

// Automatic vertex shader halo fix inserted with DarkStarSword's hlsltool.py:
// hlsltool.py -I ../.. --auto-fix-vertex-halo --fix-unity-reflection --fix-unity-frustum-world --only-autofixed --fxc /home/rshan/fxc.exe cd2fe3de8400ffc9-vs_replace.txt
if (r0.w != 1.0) { r0.x += separation * (r0.w - convergence); }

  r1.x = cb0[5].x * r0.y;
  r1.w = 0.5 * r1.x;
  r1.xz = float2(0.5,0.5) * r0.xw;

  // o1.xyzw = r0.xyzw; // Relocated from here with hlsltool.py

  o0.xy = r1.xw + r1.zz;
  return;
}
