// hlsltool.py -I ../112 --auto-fix-vertex-halo --fix-unity-reflection --only-autofixed --no-validate --ignore-other-errors feacc98e0cb6a1c9-vs_replace.txt
// 3DMigoto: feacc98e0cb6a1c9 | Matched 32 variants of 3 shaders: Beautiful Dissolves/Standard Dissolve, Beautiful Dissolves/Standard Dissolve (Specular setup), Beautiful Dissolves/Standard Dissolve NoCull Fixed
//
// ff000000:    Unity headers extracted from Standard-Dissolve NoCull Fixed.shader
// 00000fff:    Unity headers extracted from Standard-Dissolve.shader
// 00fff000:    Unity headers extracted from Standard-DissolveSpecular.shader
// 00fff000:    Shader "Beautiful Dissolves/Standard Dissolve (Specular setup)" {
// ff000000:    Shader "Beautiful Dissolves/Standard Dissolve NoCull Fixed" {
// 00000fff:    Shader "Beautiful Dissolves/Standard Dissolve" {
//                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
// 00fff000:       _SpecColor ("Specular", Color) = (0.2,0.2,0.2,1)
// ff000fff:      [Gamma]  _Metallic ("Metallic", Range(0,1)) = 0
// ff000fff:       _MetallicGlossMap ("Metallic", 2D) = "white" { }
// 00fff000:       _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
//                 _DissolveMap ("Dissolve Map", 2D) = "white" { }
//                 _DissolveAmount ("Dissolve Amount", Range(0,1)) = 0.5
//                 _GlowColor ("Glow Color", Color) = (0.2588,0.4118,0.8588,1)
//                 _GlowIntensity ("Glow Intensity", Float) = 1
//                 _OuterEdgeColor ("Outer Edge Color", Color) = (0,0.5,1,1)
//                 _InnerEdgeColor ("Inner Edge Color", Color) = (1,1,0,1)
//                 _OuterEdgeThickness ("Outer Edge Thickness", Range(0,1)) = 0.02
//                 _InnerEdgeThickness ("Inner Edge Thickness", Range(0,1)) = 0
//                [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
//                  Tags { "RenderType"="Opaque" "PerformanceChecks"="False" }
//                  Pass 2/4 {
//                    Name "FORWARD_DELTA"
//                    Tags { "LIGHTMODE"="ForwardAdd" "SHADOWSUPPORT"="true" "RenderType"="Opaque" "PerformanceChecks"="False" }
//                    ZWrite Off
// fffff000:          Cull Off
//                    Blend [_SrcBlend] One
// 00fff000:          GpuProgramID 102076
// ff000fff:          GpuProgramID 91253
//                    Program "vp" {
//                      SubProgram "d3d11 " {
// 00001001:              GpuProgramIndex 101
// 00002002:              GpuProgramIndex 103
// 00004004:              GpuProgramIndex 107
// 00008008:              GpuProgramIndex 109
// 00010010:              GpuProgramIndex 127
// 00020020:              GpuProgramIndex 129
// 00040040:              GpuProgramIndex 133
// 00080080:              GpuProgramIndex 135
// 00100100:              GpuProgramIndex 153
// 00200200:              GpuProgramIndex 155
// 00400400:              GpuProgramIndex 159
// 00800800:              GpuProgramIndex 161
// 01000000:              GpuProgramIndex 65
// 02000000:              GpuProgramIndex 67
// 04000000:              GpuProgramIndex 71
// 08000000:              GpuProgramIndex 73
// 10000000:              GpuProgramIndex 91
// 20000000:              GpuProgramIndex 93
// 40000000:              GpuProgramIndex 97
// 80000000:              GpuProgramIndex 99
//                      }
//                    }
//                  }
//                }
//              }
//
// ff000000: Unity 5.3 headers extracted from Standard-Dissolve NoCull Fixed.shader.decompressed:
// 00000fff: Unity 5.3 headers extracted from Standard-Dissolve.shader.decompressed:
// 00fff000: Unity 5.3 headers extracted from Standard-DissolveSpecular.shader.decompressed:
//             API d3d11
//             Shader model vs_4_0
//             undeciphered1: 201509030 46 0 0
// 00000400:   Keywords { "POINT" "SHADOWS_CUBE" "SHADOWS_SOFT" "_METALLICGLOSSMAP" "_NORMALMAP" }
// 00400000:   Keywords { "POINT" "SHADOWS_CUBE" "SHADOWS_SOFT" "_NORMALMAP" "_SPECGLOSSMAP" }
// 40040040:   Keywords { "POINT" "SHADOWS_CUBE" "SHADOWS_SOFT" "_NORMALMAP" }
// 04004004:   Keywords { "POINT" "SHADOWS_CUBE" "SHADOWS_SOFT" }
// 00000100:   Keywords { "POINT" "SHADOWS_CUBE" "_METALLICGLOSSMAP" "_NORMALMAP" }
// 00100000:   Keywords { "POINT" "SHADOWS_CUBE" "_NORMALMAP" "_SPECGLOSSMAP" }
// 10010010:   Keywords { "POINT" "SHADOWS_CUBE" "_NORMALMAP" }
// 01001001:   Keywords { "POINT" "SHADOWS_CUBE" }
// 00000800:   Keywords { "POINT_COOKIE" "SHADOWS_CUBE" "SHADOWS_SOFT" "_METALLICGLOSSMAP" "_NORMALMAP" }
// 00800000:   Keywords { "POINT_COOKIE" "SHADOWS_CUBE" "SHADOWS_SOFT" "_NORMALMAP" "_SPECGLOSSMAP" }
// 80080080:   Keywords { "POINT_COOKIE" "SHADOWS_CUBE" "SHADOWS_SOFT" "_NORMALMAP" }
// 08008008:   Keywords { "POINT_COOKIE" "SHADOWS_CUBE" "SHADOWS_SOFT" }
// 00000200:   Keywords { "POINT_COOKIE" "SHADOWS_CUBE" "_METALLICGLOSSMAP" "_NORMALMAP" }
// 00200000:   Keywords { "POINT_COOKIE" "SHADOWS_CUBE" "_NORMALMAP" "_SPECGLOSSMAP" }
// 20020020:   Keywords { "POINT_COOKIE" "SHADOWS_CUBE" "_NORMALMAP" }
// 02002002:   Keywords { "POINT_COOKIE" "SHADOWS_CUBE" }
//             undeciphered2: 1 0 4 0 0
//             undeciphered3: 155 5 0 0 1 2 3 4 4 5 7 8
//             ConstBuffer "$Globals" 400
//             Vector 160 [_MainTex_ST]
//             Vector 176 [_DetailAlbedoMap_ST]
//             Float 216 [_UVSec]
//             Matrix 320 [_LightMatrix0]
//             ConstBuffer "UnityPerCamera" 144
//             Vector 64 [_WorldSpaceCameraPos] 3
//             ConstBuffer "UnityLighting" 720
//             Vector 0 [_WorldSpaceLightPos0]
//             Vector 16 [_LightPositionRange]
//             ConstBuffer "UnityPerDraw" 352
//             Vector 336 [unity_WorldTransformParams]
//             Matrix 0 [glstate_matrix_mvp]
//             Matrix 192 [_Object2World]
//             Matrix 256 [_World2Object]
//             BindCB "$Globals" 0
//             BindCB "UnityPerCamera" 1
//             BindCB "UnityLighting" 2
//             BindCB "UnityPerDraw" 3
//
// 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:35:42 2017
cbuffer cb3 : register(b3)
{
  float4 cb3[22];
}

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

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

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




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



cbuffer UnityPerDraw : register(b11) {
	float4x4 glstate_matrix_mvp;
	float4x4 glstate_matrix_modelview0;
	float4x4 glstate_matrix_invtrans_modelview0;
	#define UNITY_MATRIX_MVP glstate_matrix_mvp
	#define UNITY_MATRIX_MV glstate_matrix_modelview0
	#define UNITY_MATRIX_IT_MV glstate_matrix_invtrans_modelview0

	uniform float4x4 _Object2World;
	uniform float4x4 _World2Object;
	uniform float4 unity_LODFade; // x is the fade value ranging within [0,1]. y is x quantized into 16 levels
	uniform float4 unity_WorldTransformParams; // w is usually 1.0, or -1.0 for odd-negative scale transforms
}


#include <matrix.hlsl>

void main( 
  float4 v0 : POSITION0,
  float3 v1 : NORMAL0,
  float4 v2 : TEXCOORD0,
  float2 v3 : TEXCOORD1,
  float4 v4 : TANGENT0,
  out float4 o0 : SV_POSITION0,
  out float4 o1 : TEXCOORD0,
  out float4 o2 : TEXCOORD1,
  out float4 o3 : TEXCOORD2,
  out float4 o4 : TEXCOORD3,
  out float4 o5 : TEXCOORD4,
  out float4 o6 : TEXCOORD5,
  out float3 o7 : TEXCOORD6)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;

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

// Unity reflection/specular 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 feacc98e0cb6a1c9-vs_replace.txt
float4 _WorldSpaceCameraPos = cb1[4];
float4 clip_space_adj = float4(-separation * convergence, 0, 0, 0);
float4 local_space_adj = mul(inverse(glstate_matrix_mvp), clip_space_adj);
float4 world_space_adj = mul(_Object2World, local_space_adj);
_WorldSpaceCameraPos.xyz -= world_space_adj.xyz;

  r0.xyzw = cb3[1].xyzw * v0.yyyy;
  r0.xyzw = cb3[0].xyzw * v0.xxxx + r0.xyzw;
  r0.xyzw = cb3[2].xyzw * v0.zzzz + r0.xyzw;
  o0.xyzw = cb3[3].xyzw * v0.wwww + r0.xyzw;
  r0.x = cmp(cb0[13].z == 0.000000);
  r0.xy = r0.xx ? v2.xy : v3.xy;
  o1.zw = r0.xy * cb0[11].xy + cb0[11].zw;
  o1.xy = v2.xy * cb0[10].xy + cb0[10].zw;
  r0.xyz = cb3[13].xyz * v0.yyy;
  r0.xyz = cb3[12].xyz * v0.xxx + r0.xyz;
  r0.xyz = cb3[14].xyz * v0.zzz + r0.xyz;
  r0.xyz = cb3[15].xyz * v0.www + r0.xyz;
  o2.xyz = -_WorldSpaceCameraPos.xyz + r0.xyz;
  r1.xyz = cb3[13].xyz * v4.yyy;
  r1.xyz = cb3[12].xyz * v4.xxx + r1.xyz;
  r1.xyz = cb3[14].xyz * v4.zzz + r1.xyz;
  r0.w = dot(r1.xyz, r1.xyz);
  r0.w = rsqrt(r0.w);
  r1.xyz = r1.xyz * r0.www;
  o3.xyz = r1.xyz;
  r2.xyz = -r0.xyz * cb2[0].www + cb2[0].xyz;
  o7.xyz = -cb2[1].xyz + r0.xyz;
  o3.w = r2.x;
  r0.x = cb3[16].x * v1.x;
  r0.y = cb3[17].x * v1.x;
  r0.z = cb3[18].x * v1.x;
  r3.x = cb3[16].y * v1.y;
  r3.y = cb3[17].y * v1.y;
  r3.z = cb3[18].y * v1.y;
  r0.xyz = r3.xyz + r0.xyz;
  r3.x = cb3[16].z * v1.z;
  r3.y = cb3[17].z * v1.z;
  r3.z = cb3[18].z * v1.z;
  r0.xyz = r3.xyz + r0.xyz;
  r0.w = dot(r0.xyz, r0.xyz);
  r0.w = rsqrt(r0.w);
  r0.xyz = r0.xyz * r0.www;
  r3.xyz = r0.zxy * r1.yzx;
  r1.xyz = r0.yzx * r1.zxy + -r3.xyz;
  o5.xyz = r0.xyz;
  r0.x = cb3[21].w * v4.w;
  o4.xyz = r1.xyz * r0.xxx;
  o4.w = r2.y;
  o5.w = r2.z;
  r0.xyzw = cb3[13].xyzw * v0.yyyy;
  r0.xyzw = cb3[12].xyzw * v0.xxxx + r0.xyzw;
  r0.xyzw = cb3[14].xyzw * v0.zzzz + r0.xyzw;
  r0.xyzw = cb3[15].xyzw * v0.wwww + r0.xyzw;
  r1.xyz = cb0[21].xyz * r0.yyy;
  r1.xyz = cb0[20].xyz * r0.xxx + r1.xyz;
  r0.xyz = cb0[22].xyz * r0.zzz + r1.xyz;
  o6.xyz = cb0[23].xyz * r0.www + r0.xyz;
  return;
}
