// hlsltool.py -I ../112 --auto-fix-vertex-halo --fix-unity-reflection --only-autofixed --no-validate --ignore-other-errors dad0f148bf42d31d-vs_replace.txt
// 3DMigoto: dad0f148bf42d31d | Matched 7 variants of 5 shaders: Beautiful Dissolves/Standard Dissolve, Beautiful Dissolves/Standard Dissolve (Specular setup), Beautiful Dissolves/Standard Dissolve NoCull, Beautiful Dissolves/Standard Dissolve NoCull Fixed, Standard (Specular setup)
//
// 40:    Unity headers extracted from Standard-Dissolve NoCull Fixed.shader
// 03:    Unity headers extracted from Standard-Dissolve-NoCull.shader
// 04:    Unity headers extracted from Standard-Dissolve.shader
// 08:    Unity headers extracted from Standard-DissolveSpecular.shader
// 30:    Unity headers extracted from StandardSpecular.shader
// 08:    Shader "Beautiful Dissolves/Standard Dissolve (Specular setup)" {
// 40:    Shader "Beautiful Dissolves/Standard Dissolve NoCull Fixed" {
// 03:    Shader "Beautiful Dissolves/Standard Dissolve NoCull" {
// 04:    Shader "Beautiful Dissolves/Standard Dissolve" {
// 30:    Shader "Standard (Specular setup)" {
//          Properties {
//           _Color ("Color", Color) = (1,1,1,1)
//           _MainTex ("Albedo", 2D) = "white" { }
//           _Cutoff ("Alpha Cutoff", Range(0,1)) = 0.5
//           _Glossiness ("Smoothness", Range(0,1)) = 0.5
// 38:       _SpecColor ("Specular", Color) = (0.2,0.2,0.2,1)
// 47:      [Gamma]  _Metallic ("Metallic", Range(0,1)) = 0
// 47:       _MetallicGlossMap ("Metallic", 2D) = "white" { }
// 38:       _SpecGlossMap ("Specular", 2D) = "white" { }
//           _BumpScale ("Scale", Float) = 1
//           _BumpMap ("Normal Map", 2D) = "bump" { }
//           _Parallax ("Height Scale", Range(0.005,0.08)) = 0.02
//           _ParallaxMap ("Height Map", 2D) = "black" { }
//           _OcclusionStrength ("Strength", Range(0,1)) = 1
//           _OcclusionMap ("Occlusion", 2D) = "white" { }
//           _EmissionColor ("Color", Color) = (0,0,0,1)
//           _EmissionMap ("Emission", 2D) = "white" { }
//           _DetailMask ("Detail Mask", 2D) = "white" { }
//           _DetailAlbedoMap ("Detail Albedo x2", 2D) = "grey" { }
//           _DetailNormalMapScale ("Scale", Float) = 1
//           _DetailNormalMap ("Normal Map", 2D) = "bump" { }
//          [Enum(UV0,0,UV1,1)]  _UVSec ("UV Set for secondary textures", Float) = 0
// 4f:       _DissolveMap ("Dissolve Map", 2D) = "white" { }
// 4f:       _DissolveAmount ("Dissolve Amount", Range(0,1)) = 0.5
// 4f:       _GlowColor ("Glow Color", Color) = (0.2588,0.4118,0.8588,1)
// 4f:       _GlowIntensity ("Glow Intensity", Float) = 1
// 4f:       _OuterEdgeColor ("Outer Edge Color", Color) = (0,0.5,1,1)
// 4f:       _InnerEdgeColor ("Inner Edge Color", Color) = (1,1,0,1)
// 4f:       _OuterEdgeThickness ("Outer Edge Thickness", Range(0,1)) = 0.02
// 4f:       _InnerEdgeThickness ("Inner Edge Thickness", Range(0,1)) = 0
// 03:       _VertexAnimValue1 ("Vertex Anim Value 1", Float) = 0.05
// 03:       _VertexAnimValue2 ("Vertex Anim Value 2", Float) = 3
// 03:       _VertexAnimValue3 ("Vertex Anim Value 3", Float) = 5
//          [HideInInspector]  _Mode ("__mode", Float) = 0
//          [HideInInspector]  _SrcBlend ("__src", Float) = 1
//          [HideInInspector]  _DstBlend ("__dst", Float) = 0
//          [HideInInspector]  _ZWrite ("__zw", Float) = 1
//          }
//          Fallback "VertexLit"
//          SubShader 1/2 {
//            LOD 300
// 03:        Tags { "QUEUE"="AlphaTest" "RenderType"="TransparentCutout" "PerformanceChecks"="False" }
// 7c:        Tags { "RenderType"="Opaque" "PerformanceChecks"="False" }
//            Pass 3/4 {
//              Name "SHADOWCASTER"
// 03:          Tags { "LIGHTMODE"="SHADOWCASTER" "QUEUE"="AlphaTest" "SHADOWSUPPORT"="true" "RenderType"="TransparentCutout" "PerformanceChecks"="False" }
// 7c:          Tags { "LIGHTMODE"="SHADOWCASTER" "SHADOWSUPPORT"="true" "RenderType"="Opaque" "PerformanceChecks"="False" }
// 4b:          Cull Off
// 30:          GpuProgramID 136779
// 08:          GpuProgramID 138481
// 03:          GpuProgramID 147385
// 44:          GpuProgramID 150576
//              Program "vp" {
//                SubProgram "d3d11 " {
// 40:              GpuProgramIndex 153
// 01:              GpuProgramIndex 217
// 02:              GpuProgramIndex 221
// 0c:              GpuProgramIndex 241
// 10:              GpuProgramIndex 933
// 20:              GpuProgramIndex 937
//                }
//              }
//            }
//          }
//        }
//
// 40: Unity 5.3 headers extracted from Standard-Dissolve NoCull Fixed.shader.decompressed:
// 03: Unity 5.3 headers extracted from Standard-Dissolve-NoCull.shader.decompressed:
// 04: Unity 5.3 headers extracted from Standard-Dissolve.shader.decompressed:
// 08: Unity 5.3 headers extracted from Standard-DissolveSpecular.shader.decompressed:
// 30: Unity 5.3 headers extracted from StandardSpecular.shader.decompressed:
//       API d3d11
//       Shader model vs_4_0
//       undeciphered1: 201509030 42 0 0
// 20:   Keywords { "SHADOWS_DEPTH" "_ALPHABLEND_ON" }
// 12:   Keywords { "SHADOWS_DEPTH" "_ALPHATEST_ON" }
// 4d:   Keywords { "SHADOWS_DEPTH" }
//       undeciphered2: 1 0 5 0 0
//       undeciphered3: 11 3 0 0 1 2 3 4
// 30:   ConstBuffer "$Globals" 144
// 4f:   ConstBuffer "$Globals" 160
//       Vector 128 [_MainTex_ST]
//       ConstBuffer "UnityLighting" 720
//       Vector 0 [_WorldSpaceLightPos0]
//       ConstBuffer "UnityShadows" 416
//       Vector 80 [unity_LightShadowBias]
//       ConstBuffer "UnityPerDraw" 352
//       Matrix 0 [glstate_matrix_mvp]
//       Matrix 192 [_Object2World]
//       Matrix 256 [_World2Object]
//       ConstBuffer "UnityPerFrame" 256
//       Matrix 144 [unity_MatrixVP]
//       BindCB "$Globals" 0
//       BindCB "UnityLighting" 1
//       BindCB "UnityShadows" 2
//       BindCB "UnityPerDraw" 3
//       BindCB "UnityPerFrame" 4
//
// 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:34:05 2017
cbuffer cb4 : register(b4)
{
  float4 cb4[13];
}

cbuffer cb3 : register(b3)
{
  float4 cb3[19];
}

cbuffer cb2 : register(b2)
{
  float4 cb2[6];
}

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

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




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


void main( 
  float4 v0 : POSITION0,
  float3 v1 : NORMAL0,
  float2 v2 : TEXCOORD0,
  out float2 o0 : TEXCOORD1,
  out float4 o1 : SV_POSITION0)
{
  float4 r0,r1,r2;
  uint4 bitmask, uiDest;
  float4 fDest;

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

  o0.xy = v2.xy * cb0[8].xy + cb0[8].zw;
  r0.x = cb3[16].x * v1.x;
  r0.y = cb3[17].x * v1.x;
  r0.z = cb3[18].x * v1.x;
  r1.x = cb3[16].y * v1.y;
  r1.y = cb3[17].y * v1.y;
  r1.z = cb3[18].y * v1.y;
  r0.xyz = r1.xyz + r0.xyz;
  r1.x = cb3[16].z * v1.z;
  r1.y = cb3[17].z * v1.z;
  r1.z = cb3[18].z * v1.z;
  r0.xyz = r1.xyz + r0.xyz;
  r0.w = dot(r0.xyz, r0.xyz);
  r0.w = rsqrt(r0.w);
  r0.xyz = r0.xyz * r0.www;
  r1.xyz = cb3[13].xyz * v0.yyy;
  r1.xyz = cb3[12].xyz * v0.xxx + r1.xyz;
  r1.xyz = cb3[14].xyz * v0.zzz + r1.xyz;
  r1.xyz = cb3[15].xyz + r1.xyz;
  r2.xyz = -r1.xyz * cb1[0].www + cb1[0].xyz;
  r0.w = dot(r2.xyz, r2.xyz);
  r0.w = rsqrt(r0.w);
  r2.xyz = r2.xyz * r0.www;
  r0.w = dot(r0.xyz, r2.xyz);
  r0.w = -r0.w * r0.w + 1;
  r0.w = sqrt(r0.w);
  r0.w = cb2[5].z * r0.w;
  r0.xyz = -r0.xyz * r0.www + r1.xyz;
  r1.xyzw = cb4[10].xyzw * r0.yyyy;
  r1.xyzw = cb4[9].xyzw * r0.xxxx + r1.xyzw;
  r0.xyzw = cb4[11].xyzw * r0.zzzz + r1.xyzw;
  r0.xyzw = cb4[12].xyzw + r0.xyzw;
  r1.xyzw = cb3[1].xyzw * v0.yyyy;
  r1.xyzw = cb3[0].xyzw * v0.xxxx + r1.xyzw;
  r1.xyzw = cb3[2].xyzw * v0.zzzz + r1.xyzw;
  r1.xyzw = cb3[3].xyzw + r1.xyzw;
  r2.x = cmp(cb2[5].z != 0.000000);
  r0.xyzw = r2.xxxx ? r0.xyzw : r1.xyzw;

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

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

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

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

  r0.x = max(0, r0.z);
  r0.x = r0.x + -r0.z;
  o1.z = cb2[5].y * r0.x + r0.z;
  return;
}
 