// hlsltool.py -I ../.. --auto-fix-vertex-halo --fix-unity-reflection --fix-unity-frustum-world --only-autofixed --fxc /home/Ryan/fxc.exe 3dd0da60a3fd895b-vs_replace.txt
// 3DMigoto: 3dd0da60a3fd895b |    Unity headers extracted from SpecGrayscaleAdvReflWaterfallAdvSF.shader
//    Shader "Shader Forge/SpecGrayscaleAdvReflWaterfallAdvSF" {
//      Properties {
//       _Diffuse ("Diffuse", 2D) = "white" { }
//       _DiffColor ("DiffColor", Color) = (1,1,1,1)
//       _NormalMap ("NormalMap", 2D) = "bump" { }
//       _Shining ("Shining", 2D) = "black" { }
//       _Cubemap ("Cubemap", CUBE) = "_Skybox" { }
//       _CubeColor ("CubeColor", Color) = (0.5,0.5,0.5,1)
//       _GlossHigh ("GlossHigh", Range(0,1)) = 0.71696
//       _HighSpecColor ("HighSpecColor", Color) = (1,1,1,1)
//       _GlossLow ("GlossLow", Range(0,1)) = 0.166634
//       _LowSpecColor ("LowSpecColor", Color) = (0.0735294,0.0735294,0.0735294,1)
//       _IllumText ("IllumText", 2D) = "white" { }
//       _IllumColor ("IllumColor", Color) = (0,0,0,1)
//       _HighSpecMultiplayerN ("HighSpecMultiplayerN", Range(0,6)) = 1
//       _CubemapBlured ("CubemapBlured", CUBE) = "_Skybox" { }
//       _RoughContrast ("RoughContrast", Float) = 1
//       _MetCubeMultiplayer ("MetCubeMultiplayer", Float) = 4
//       _MetallnessMap ("MetallnessMap", 2D) = "white" { }
//       _MetallnessMultiplayer ("MetallnessMultiplayer", Float) = 0
//       _node_1155 ("node_1155", Float) = 1
//       _Transparent ("Transparent", 2D) = "white" { }
//       _Uflow ("Uflow", Float) = 0.1
//       _Vflow ("Vflow", Float) = 0.1
//       _AdditionalNormalMap ("AdditionalNormalMap", 2D) = "bump" { }
//       _WaweBlendMask ("WaweBlendMask", 2D) = "white" { }
//       _AddNormalsTimeScale ("AddNormalsTimeScale", Float) = 2
//       _node_1460 ("node_1460", 2D) = "white" { }
//       _node_1460_copy ("node_1460_copy", 2D) = "white" { }
//      [HideInInspector]  _Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
//      }
//      Fallback "Diffuse"
//      SubShader 1/1 {
//        Tags { "QUEUE"="Transparent" "IGNOREPROJECTOR"="true" "RenderType"="Transparent" }
//        Pass 3/3 {
//          Name "SHADOWCASTER"
//          Tags { "LIGHTMODE"="SHADOWCASTER" "QUEUE"="Transparent" "IGNOREPROJECTOR"="true" "SHADOWSUPPORT"="true" "RenderType"="Transparent" }
//          Offset 1, 1
//          GpuProgramID 166612
//          Program "vp" {
//            SubProgram "d3d11 " {
//              GpuProgramIndex 193
//            }
//          }
//        }
//      }
//    }
//
// Unity 5.3 headers extracted from SpecGrayscaleAdvReflWaterfallAdvSF.shader.decompressed:
//   API d3d11
//   Shader model vs_4_0
//   undeciphered1: 13 0 0
//   Keywords { "SHADOWS_DEPTH" "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" }
//   undeciphered2: 1 0 2 0 0
//   undeciphered3: 57 4 0 0 3 4 4 5 5 6
//   ConstBuffer "UnityShadows" 416
//   Vector 80 [unity_LightShadowBias]
//   ConstBuffer "UnityPerDraw" 352
//   Matrix 0 [glstate_matrix_mvp]
//   Matrix 192 [_Object2World]
//   BindCB "UnityShadows" 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 Thu Aug 18 03:38:14 2016
cbuffer cb1 : register(b1)
{
  float4 cb1[16];
}

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,
  float4 v1 : TEXCOORD0,
  float4 v2 : TEXCOORD1,
  float2 v3 : TEXCOORD2,
  out float4 o0 : SV_POSITION0,
  out float2 o1 : TEXCOORD1,
  out float2 p1 : TEXCOORD2,
  out float4 o2 : TEXCOORD3,
  out float4 o3 : TEXCOORD4)
{
  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 + r0.xyzw;

o0.xyw = r0.xyw; // 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 3dd0da60a3fd895b-vs_replace.txt
if (r0.w != 1.0) { r0.x += separation * (r0.w - convergence); }

  r1.x = saturate(cb0[5].x / r0.w);
  r0.z = r1.x + r0.z;

  // o0.xyw = r0.xyw; // Relocated from here with hlsltool.py

  r0.x = max(0, r0.z);
  r0.x = r0.x + -r0.z;
  o0.z = cb0[5].y * r0.x + r0.z;
  o1.xy = v1.xy;
  p1.xy = v2.xy;
  o2.xy = v3.xy;
  r0.xyzw = cb1[13].xyzw * v0.yyyy;
  r0.xyzw = cb1[12].xyzw * v0.xxxx + r0.xyzw;
  r0.xyzw = cb1[14].xyzw * v0.zzzz + r0.xyzw;
  o3.xyzw = cb1[15].xyzw * v0.wwww + r0.xyzw;
  return;
}

/****************************** COMPILE WARNINGS ******************************
X:\SteamLibrary\steamapps\common\I am weapon Revival\ShaderFixes\3dd0da60a3fd895b-vs_replace.txt(97,14-15): warning X3578: Output value 'o2' is not completely initialized

****************************** COMPILE WARNINGS ******************************/
