// hlsltool.py -I ../112 --auto-fix-vertex-halo --fix-unity-reflection --only-autofixed --no-validate --ignore-other-errors 40d79da5db83c1a6-vs_replace.txt
// 3DMigoto: 40d79da5db83c1a6 |    Unity headers extracted from Occlusion.shader
//    Shader "Hidden/Amplify Occlusion/Occlusion" {
//      Fallback Off
//      SubShader 1/1 {
//        Pass 1/42 {
//          ZTest Always
//          ZWrite Off
//          Cull Off
//          GpuProgramID 40694
//          Program "vp" {
//            SubProgram "d3d11 " {
//              GpuProgramIndex 1
//            }
//          }
//        }
//      }
//    }
//
// Unity 5.3 headers extracted from Occlusion.shader.decompressed:
//   API d3d11
//   Shader model vs_4_0
//   undeciphered1: 201509030 7 0 0
//   undeciphered2: 1 0 2 0 0
//   undeciphered3: 1 1 0 0
//   ConstBuffer "$Globals" 480
//   Matrix 112 [_AO_CameraProj]
//   ConstBuffer "UnityPerCamera" 144
//   Vector 80 [_ProjectionParams]
//   BindCB "$Globals" 0
//   BindCB "UnityPerCamera" 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.38 on Thu Feb 09 12:26:51 2017
cbuffer cb1 : register(b1)
{
  float4 cb1[6];
}

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,
  float2 v1 : TEXCOORD0,
  out float4 o0 : SV_POSITION0,
  out float2 o1 : TEXCOORD0)
{
  float4 r0;
  uint4 bitmask, uiDest;
  float4 fDest;

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

  r0.xyzw = cb0[8].xyzw * v0.yyyy;
  r0.xyzw = cb0[7].xyzw * v0.xxxx + r0.xyzw;
  r0.xyzw = cb0[10].xyzw + r0.xyzw;
  o0.xyzw = r0.xyzw;

// Automatic vertex shader halo fix inserted with DarkStarSword's hlsltool.py:
// hlsltool.py -I ../112 --auto-fix-vertex-halo --fix-unity-reflection --only-autofixed --no-validate --ignore-other-errors 40d79da5db83c1a6-vs_replace.txt
if (r0.w != 1.0) { r0.x += separation * (r0.w - convergence); }

  r0.y = cb1[5].x * r0.y;
  r0.xz = float2(0.5,0.5) * r0.xw;
  r0.w = 0.5 * r0.y;
  o1.xy = r0.xw + r0.zz;
  return;
}
