// hlsltool.py -I ../.. --auto-fix-vertex-halo --fix-unity-reflection --fix-unity-frustum-world --only-autofixed --fxc /home/Ryan/fxc.exe 3e9ea9b8f01e7b61-vs_replace.txt
// 3DMigoto: 3e9ea9b8f01e7b61 |    Unity headers extracted from Reflect-VertexLit.shader
//    Shader "Legacy Shaders/Reflective/VertexLit" {
//      Properties {
//       _Color ("Main Color", Color) = (1,1,1,1)
//       _ReflectColor ("Reflection Color", Color) = (1,1,1,0.5)
//       _MainTex ("Base (RGB) RefStrength (A)", 2D) = "white" { }
//       _Cube ("Reflection Cubemap", CUBE) = "_Skybox" { }
//      }
//      Fallback "Legacy Shaders/VertexLit"
//      SubShader 1/1 {
//        LOD 150
//        Tags { "RenderType"="Opaque" }
//        Pass 3/4 {
//          Tags { "LIGHTMODE"="VertexLM" "RenderType"="Opaque" }
//          ZWrite Off
//          Blend One One
//          ColorMask RGB
//          GpuProgramID 149264
//          Program "vp" {
//            SubProgram "d3d11 " {
//              GpuProgramIndex 28
//            }
//          }
//        }
//      }
//    }
//
// Unity 5.3 headers extracted from Reflect-VertexLit.shader.decompressed:
//   API d3d11
//   Shader model vs_4_0
//   undeciphered1: 9 0 0
//   Keywords { "FOG_LINEAR" }
//   undeciphered2: 1 0 3 0 0
//   undeciphered3: 25 3 0 0 3 4 4 5
//   ConstBuffer "$Globals" 192
//   Vector 96 [_MainTex_ST]
//   Matrix 112 [unity_LightmapMatrix]
//   ConstBuffer "UnityPerDraw" 352
//   Matrix 0 [glstate_matrix_mvp]
//   ConstBuffer "UnityFog" 32
//   Vector 16 [unity_FogParams]
//   BindCB "$Globals" 0
//   BindCB "UnityPerDraw" 1
//   BindCB "UnityFog" 2
//
// 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 Thu Aug 18 03:38:55 2016
cbuffer cb2 : register(b2)
{
  float4 cb2[2];
}

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

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




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


void main( 
  float4 v0 : POSITION0,
  float4 v1 : TEXCOORD0,
  float2 v2 : TEXCOORD1,
  out float2 o0 : TEXCOORD0,
  out float2 p0 : TEXCOORD1,
  out float o1 : TEXCOORD2,
  out float4 o2 : SV_POSITION0)
{
  float4 r0;
  uint4 bitmask, uiDest;
  float4 fDest;

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

  r0.xy = cb0[8].xy * v2.yy;
  r0.xy = cb0[7].xy * v2.xx + r0.xy;
  p0.xy = cb0[10].xy + r0.xy;
  o0.xy = v1.xy * cb0[6].xy + cb0[6].zw;
  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;

o2.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/Ryan/fxc.exe 3e9ea9b8f01e7b61-vs_replace.txt
if (r0.w != 1.0) { r0.x += separation * (r0.w - convergence); }

  o1.x = r0.z * cb2[1].z + cb2[1].w;

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

  return;
}
