// hlsltool.py -I ../112 --auto-fix-vertex-halo --fix-unity-reflection --only-autofixed --no-validate --ignore-other-errors b5d7a4f871e6a44c-vs_replace.txt
// 3DMigoto: b5d7a4f871e6a44c | Matched 2 variants of 1 shaders: Shader Forge/Crystal
//
//       Unity headers extracted from Crystal.shader
//       Shader "Shader Forge/Crystal" {
//         Properties {
//          _MainTex ("Base Color", 2D) = "white" { }
//          _Color ("Color", Color) = (0.501961,0.501961,0.501961,1)
//          _Metallic ("Metallic", Range(0,1)) = 0.666
//          _Gloss ("Gloss", Range(0,1)) = 0.8
//          _BumpMap ("Normal Map", 2D) = "bump" { }
//          _RefractionIntensity ("Refraction Intensity", Range(0,1)) = 0.6
//          _Opacity ("Opacity", Range(0,1)) = 0.6
//          _AmbientLight ("AmbientLight", Range(0,5)) = 3
//          _AnimationTexture ("AnimationTexture", 2D) = "white" { }
//         [HideInInspector]  _Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
//         }
//         Fallback "Diffuse"
//         SubShader 1/1 {
//           Tags { "QUEUE"="Transparent" "RenderType"="Transparent" }
//           GrabPass {
//            }
//           Pass 2/2 {
//             Name "FORWARD_DELTA"
//             Tags { "LIGHTMODE"="ForwardAdd" "QUEUE"="Transparent" "SHADOWSUPPORT"="true" "RenderType"="Transparent" }
//             Blend One One
//             GpuProgramID 116827
//             Program "vp" {
//               SubProgram "d3d11 " {
// 1:              GpuProgramIndex 13
// 2:              GpuProgramIndex 19
//               }
//             }
//           }
//         }
//       }
//
//    Unity 5.3 headers extracted from Crystal.shader.decompressed:
//      API d3d11
//      Shader model vs_4_0
//      undeciphered1: 201509030 38 0 0
// 1:   Keywords { "POINT" "SHADOWS_OFF" }
// 2:   Keywords { "POINT_COOKIE" "SHADOWS_OFF" }
//      undeciphered2: 1 0 2 0 0
//      undeciphered3: 139 4 0 0 1 2 3 4 7 8
//      ConstBuffer "$Globals" 256
//      Matrix 96 [_LightMatrix0]
//      ConstBuffer "UnityPerDraw" 352
//      Matrix 0 [glstate_matrix_mvp]
//      Matrix 192 [_Object2World]
//      Matrix 256 [_World2Object]
//      BindCB "$Globals" 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.38 on Thu Feb 09 12:32:23 2017
cbuffer cb1 : register(b1)
{
  float4 cb1[19];
}

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




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


void main( 
  float4 v0 : POSITION0,
  float3 v1 : NORMAL0,
  float4 v2 : TANGENT0,
  float2 v3 : TEXCOORD0,
  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;

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

  o6.xyzw = r0.xyzw;
  o1.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;
  r0.xyzw = cb1[15].xyzw * v0.wwww + r0.xyzw;
  o2.xyzw = r0.xyzw;
  r1.x = cb1[16].x * v1.x;
  r1.y = cb1[17].x * v1.x;
  r1.z = cb1[18].x * v1.x;
  r2.x = cb1[16].y * v1.y;
  r2.y = cb1[17].y * v1.y;
  r2.z = cb1[18].y * v1.y;
  r1.xyz = r2.xyz + r1.xyz;
  r2.x = cb1[16].z * v1.z;
  r2.y = cb1[17].z * v1.z;
  r2.z = cb1[18].z * v1.z;
  r1.xyz = r2.xyz + r1.xyz;
  r1.w = dot(r1.xyz, r1.xyz);
  r1.w = rsqrt(r1.w);
  r1.xyz = r1.xyz * r1.www;
  o3.xyz = r1.xyz;
  r2.xyz = cb1[13].xyz * v2.yyy;
  r2.xyz = cb1[12].xyz * v2.xxx + r2.xyz;
  r2.xyz = cb1[14].xyz * v2.zzz + r2.xyz;
  r1.w = dot(r2.xyz, r2.xyz);
  r1.w = rsqrt(r1.w);
  r2.xyz = r2.xyz * r1.www;
  o4.xyz = r2.xyz;
  r3.xyz = r2.yzx * r1.zxy;
  r1.xyz = r1.yzx * r2.zxy + -r3.xyz;
  r1.xyz = v2.www * r1.xyz;
  r1.w = dot(r1.xyz, r1.xyz);
  r1.w = rsqrt(r1.w);
  o5.xyz = r1.xyz * r1.www;
  r1.xyz = cb0[7].xyz * r0.yyy;
  r1.xyz = cb0[6].xyz * r0.xxx + r1.xyz;
  r0.xyz = cb0[8].xyz * r0.zzz + r1.xyz;
  o7.xyz = cb0[9].xyz * r0.www + r0.xyz;
  return;
}
 