// hlsltool.py -I ../112 --auto-fix-vertex-halo --fix-unity-reflection --only-autofixed --no-validate --ignore-other-errors 159ecb383c60dedc-vs_replace.txt
// 3DMigoto: 159ecb383c60dedc | Matched 8 variants of 8 shaders: Custom/Energy Bar Toolkit/Expand Fill, Custom/Energy Bar Toolkit/Expand Fill Pre, Custom/Energy Bar Toolkit/Horizontal Fill, Custom/Energy Bar Toolkit/Horizontal Fill Pre, Custom/Energy Bar Toolkit/Radial Fill, Custom/Energy Bar Toolkit/Radial Fill Pre, Custom/Energy Bar Toolkit/Vertical Fill, Custom/Energy Bar Toolkit/Vertical Fill Pre
//
// 01:    Unity headers extracted from ExpandFillShader.shader
// 02:    Unity headers extracted from ExpandFillShaderPre.shader
// 04:    Unity headers extracted from HorizontalFillShader.shader
// 08:    Unity headers extracted from HorizontalFillShaderPre.shader
// 10:    Unity headers extracted from RadialFillShader.shader
// 20:    Unity headers extracted from RadialFillShaderPre.shader
// 40:    Unity headers extracted from VerticalFillShader.shader
// 80:    Unity headers extracted from VerticalFillShaderPre.shader
// 02:    Shader "Custom/Energy Bar Toolkit/Expand Fill Pre" {
// 01:    Shader "Custom/Energy Bar Toolkit/Expand Fill" {
// 08:    Shader "Custom/Energy Bar Toolkit/Horizontal Fill Pre" {
// 04:    Shader "Custom/Energy Bar Toolkit/Horizontal Fill" {
// 20:    Shader "Custom/Energy Bar Toolkit/Radial Fill Pre" {
// 10:    Shader "Custom/Energy Bar Toolkit/Radial Fill" {
// 80:    Shader "Custom/Energy Bar Toolkit/Vertical Fill Pre" {
// 40:    Shader "Custom/Energy Bar Toolkit/Vertical Fill" {
//          Properties {
//           _MainTex ("Base (RGB)", 2D) = "white" { }
//           _Color ("Color (RGB)", Color) = (1,1,1,1)
// 30:       _CenterX ("Rotation Center X", Float) = 0.5
// cf:       _Rect ("Visible Rect", Vector) = (0,0,1,1)
// 30:       _CenterY ("Rotation Center Y", Float) = 0.5
// 30:       _Offset ("Start Pos (0-1)", Float) = 0
// 30:       _Length ("End Pos (0-1)", Float) = 1
//           _Progress ("Progress", Float) = 0.5
//           _Invert ("Invert", Float) = 0
//          }
//          Fallback "Diffuse"
//          SubShader 1/1 {
// cf:        Tags { "LIGHTMODE"="Always" "QUEUE"="Overlay" }
// 30:        Tags { "QUEUE"="Overlay" }
// 30:        Pass 1/1 {
// cf:        Pass 1/2 {
//              Name "FORWARD"
// cf:          Tags { "LIGHTMODE"="Always" "QUEUE"="Overlay" "SHADOWSUPPORT"="true" }
// 30:          Tags { "LIGHTMODE"="ForwardBase" "QUEUE"="Overlay" "SHADOWSUPPORT"="true" }
//              ZTest Always
//              ZWrite Off
//              Cull Off
// aa:          Blend One OneMinusSrcAlpha
// 55:          Blend SrcAlpha OneMinusSrcAlpha
// 03:          GpuProgramID 13264
// 0c:          GpuProgramID 19598
// 40:          GpuProgramID 22002
// 10:          GpuProgramID 29361
// 80:          GpuProgramID 35005
// 20:          GpuProgramID 45595
//              Program "vp" {
//                SubProgram "d3d11 " {
//                  GpuProgramIndex 4
//                }
//              }
//            }
//          }
//        }
//
// 01: Unity 5.3 headers extracted from ExpandFillShader.shader.decompressed:
// 02: Unity 5.3 headers extracted from ExpandFillShaderPre.shader.decompressed:
// 04: Unity 5.3 headers extracted from HorizontalFillShader.shader.decompressed:
// 08: Unity 5.3 headers extracted from HorizontalFillShaderPre.shader.decompressed:
// 10: Unity 5.3 headers extracted from RadialFillShader.shader.decompressed:
// 20: Unity 5.3 headers extracted from RadialFillShaderPre.shader.decompressed:
// 40: Unity 5.3 headers extracted from VerticalFillShader.shader.decompressed:
// 80: Unity 5.3 headers extracted from VerticalFillShaderPre.shader.decompressed:
//       API d3d11
//       Shader model vs_4_0
//       undeciphered1: 201509030 22 0 0
//       Keywords { "DIRECTIONAL" "SHADOWS_SCREEN" "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" }
//       undeciphered2: 1 0 3 0 0
//       undeciphered3: 15 4 0 0 2 1 1 2 3 4
//       ConstBuffer "$Globals" 192
//       Vector 176 [_MainTex_ST]
//       ConstBuffer "UnityPerCamera" 144
//       Vector 80 [_ProjectionParams]
//       ConstBuffer "UnityPerDraw" 352
//       Matrix 0 [glstate_matrix_mvp]
//       Matrix 256 [_World2Object]
//       BindCB "$Globals" 0
//       BindCB "UnityPerCamera" 1
//       BindCB "UnityPerDraw" 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.38 on Thu Feb 09 12:24:54 2017
cbuffer cb2 : register(b2)
{
  float4 cb2[19];
}

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

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




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


void main( 
  float4 v0 : POSITION0,
  float4 v1 : TANGENT0,
  float3 v2 : NORMAL0,
  float4 v3 : TEXCOORD0,
  float4 v4 : TEXCOORD1,
  float4 v5 : TEXCOORD2,
  float4 v6 : TEXCOORD3,
  float4 v7 : COLOR0,
  out float4 o0 : SV_POSITION0,
  out float4 o1 : TEXCOORD0,
  out float4 o2 : TEXCOORD1,
  out float4 o3 : TEXCOORD2,
  out float4 o4 : TEXCOORD3)
{
  float4 r0,r1,r2;
  uint4 bitmask, uiDest;
  float4 fDest;

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

  r0.xyzw = cb2[1].xyzw * v0.yyyy;
  r0.xyzw = cb2[0].xyzw * v0.xxxx + r0.xyzw;
  r0.xyzw = cb2[2].xyzw * v0.zzzz + r0.xyzw;
  r0.xyzw = cb2[3].xyzw * v0.wwww + 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 159ecb383c60dedc-vs_replace.txt
if (r0.w != 1.0) { r0.x += separation * (r0.w - convergence); }

  o1.xy = v3.xy * cb0[11].xy + cb0[11].zw;
  r1.x = cb2[16].x * v2.x;
  r1.y = cb2[17].x * v2.x;
  r1.z = cb2[18].x * v2.x;
  r2.x = cb2[16].y * v2.y;
  r2.y = cb2[17].y * v2.y;
  r2.z = cb2[18].y * v2.y;
  r1.xyz = r2.xyz + r1.xyz;
  r2.x = cb2[16].z * v2.z;
  r2.y = cb2[17].z * v2.z;
  r2.z = cb2[18].z * v2.z;
  r1.xyz = r2.xyz + r1.xyz;
  r1.w = dot(r1.xyz, r1.xyz);
  r1.w = rsqrt(r1.w);
  o2.xyz = r1.xyz * r1.www;
  o3.xyz = float3(0,0,0);
  r0.y = cb1[5].x * r0.y;
  r1.xzw = float3(0.5,0.5,0.5) * r0.xwy;
  o4.zw = r0.zw;
  o4.xy = r1.xw + r1.zz;
  return;
}
