// asmtool.py -I ../.. --auto-fix-vertex-halo --fix-unusual-halo-with-inconsistent-w-optimisation --fix-unity-reflection --fix-unity-frustum-world --only-autofixed 2d0936b0b4e2bbf5-vs.txt
// 3DMigoto: 2d0936b0b4e2bbf5 | Matched 2 variants of 2 shaders: TMPro/Distance Field (Surface), TMPro/Mobile/Distance Field (Surface)
//
// 2:    Unity headers extracted from TMPro_SDF-Surface-Mobile.shader
// 1:    Unity headers extracted from TMPro_SDF-Surface.shader
// 1:    Shader "TMPro/Distance Field (Surface)" {
// 2:    Shader "TMPro/Mobile/Distance Field (Surface)" {
//         Properties {
//          _FaceTex ("Fill Texture", 2D) = "white" { }
// 1:       _FaceUVSpeedX ("Face UV Speed X", Range(-5.000000,5.000000)) = 0.000000
// 1:       _FaceUVSpeedY ("Face UV Speed Y", Range(-5.000000,5.000000)) = 0.000000
//          _FaceColor ("Fill Color", Color) = (1.000000,1.000000,1.000000,1.000000)
//          _FaceDilate ("Face Dilate", Range(-1.000000,1.000000)) = 0.000000
//          _OutlineColor ("Outline Color", Color) = (0.000000,0.000000,0.000000,1.000000)
//          _OutlineTex ("Outline Texture", 2D) = "white" { }
// 1:       _OutlineUVSpeedX ("Outline UV Speed X", Range(-5.000000,5.000000)) = 0.000000
// 1:       _OutlineUVSpeedY ("Outline UV Speed Y", Range(-5.000000,5.000000)) = 0.000000
//          _OutlineWidth ("Outline Thickness", Range(0.000000,1.000000)) = 0.000000
//          _OutlineSoftness ("Outline Softness", Range(0.000000,1.000000)) = 0.000000
// 1:       _Bevel ("Bevel", Range(0.000000,1.000000)) = 0.500000
// 1:       _BevelOffset ("Bevel Offset", Range(-0.500000,0.500000)) = 0.000000
// 1:       _BevelWidth ("Bevel Width", Range(-0.500000,0.500000)) = 0.000000
// 1:       _BevelClamp ("Bevel Clamp", Range(0.000000,1.000000)) = 0.000000
// 1:       _BevelRoundness ("Bevel Roundness", Range(0.000000,1.000000)) = 0.000000
// 1:       _BumpMap ("Normalmap", 2D) = "bump" { }
// 1:       _BumpOutline ("Bump Outline", Range(0.000000,1.000000)) = 0.500000
// 1:       _BumpFace ("Bump Face", Range(0.000000,1.000000)) = 0.500000
// 1:       _ReflectFaceColor ("Face Color", Color) = (0.000000,0.000000,0.000000,1.000000)
// 1:       _ReflectOutlineColor ("Outline Color", Color) = (0.000000,0.000000,0.000000,1.000000)
// 1:       _Cube ("Reflection Cubemap", CUBE) = "black" { }
// 1:       _EnvMatrixRotation ("Texture Rotation", Vector) = (0.000000,0.000000,0.000000,0.000000)
// 1:       _SpecColor ("Specular Color", Color) = (0.000000,0.000000,0.000000,1.000000)
// 1:       _FaceShininess ("Face Shininess", Range(0.000000,1.000000)) = 0.000000
// 1:       _OutlineShininess ("Outline Shininess", Range(0.000000,1.000000)) = 0.000000
//          _GlowColor ("Color", Color) = (0.000000,1.000000,0.000000,0.500000)
//          _GlowOffset ("Offset", Range(-1.000000,1.000000)) = 0.000000
//          _GlowInner ("Inner", Range(0.000000,1.000000)) = 0.050000
//          _GlowOuter ("Outer", Range(0.000000,1.000000)) = 0.050000
//          _GlowPower ("Falloff", Range(1.000000,0.000000)) = 0.750000
//          _WeightNormal ("Weight Normal", Float) = 0.000000
//          _WeightBold ("Weight Bold", Float) = 0.500000
//          _ShaderFlags ("Flags", Float) = 0.000000
//          _ScaleRatioA ("Scale RatioA", Float) = 1.000000
//          _ScaleRatioB ("Scale RatioB", Float) = 1.000000
//          _ScaleRatioC ("Scale RatioC", Float) = 1.000000
//          _MainTex ("Font Atlas", 2D) = "white" { }
//          _TextureWidth ("Texture Width", Float) = 512.000000
//          _TextureHeight ("Texture Height", Float) = 512.000000
//          _GradientScale ("Gradient Scale", Float) = 5.000000
//          _ScaleX ("Scale X", Float) = 1.000000
//          _ScaleY ("Scale Y", Float) = 1.000000
//          _PerspectiveFilter ("Perspective Correction", Range(0.000000,1.000000)) = 0.875000
//          _VertexOffsetX ("Vertex OffsetX", Float) = 0.000000
//          _VertexOffsetY ("Vertex OffsetY", Float) = 0.000000
//         }
//         SubShader 1/1 {
//           LOD 300
//           Tags { "QUEUE"="Transparent" "IGNOREPROJECTOR"="true" "RenderType"="Transparent" }
// 2:        Pass 2/2 {
// 1:        Pass 3/3 {
//             Name "CASTER"
//             Tags { "LIGHTMODE"="SHADOWCASTER" "QUEUE"="Transparent" "IGNOREPROJECTOR"="true" "SHADOWSUPPORT"="true" "RenderType"="Transparent" }
//             Cull Off
//             ColorMask RGB
//             Offset 1.000000, 1.000000
// 2:          GpuProgramID 128536
// 1:          GpuProgramID 141481
//             Program "vp" {
//               SubProgram "d3d11 " {
// 1:              GpuProgramIndex 13
// 2:              GpuProgramIndex 3
//               }
//             }
//           }
//         }
//       }
//
// 2: Unity 5.3 headers extracted from TMPro_SDF-Surface-Mobile.shader.decompressed:
// 1: Unity 5.3 headers extracted from TMPro_SDF-Surface.shader.decompressed:
//      API d3d11
//      Shader model vs_4_0
//      undeciphered1: 201510240 15 0 0
//      Keywords { "SHADOWS_DEPTH" }
//      undeciphered2: 1 0 3 0 0 0
//      undeciphered3: 9 2 0 0 3 4
//      ConstBuffer "$Globals" 128
//      Vector 96 [_MainTex_ST]
//      Float 112 [_OutlineWidth]
//      Float 116 [_FaceDilate]
//      Float 120 [_ScaleRatioA]
//      ConstBuffer "UnityShadows" 416
//      Vector 80 [unity_LightShadowBias]
//      ConstBuffer "UnityPerDraw" 352
//      Matrix 0 [glstate_matrix_mvp]
//      BindCB "$Globals" 0
//      BindCB "UnityShadows" 1
//      BindCB "UnityPerDraw" 2
//
// Headers extracted with DarkStarSword's extract_unity53_shaders.py
// https://github.com/DarkStarSword/3d-fixes

//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.3.12 on Thu Dec 06 16:58:46 2018
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyz
// NORMAL                   0   xyz         1     NONE   float
// TEXCOORD                 0   xyzw        2     NONE   float   xy
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 1   xy          1     NONE   float   xy
// TEXCOORD                 2     z         1     NONE   float     z
//
vs_4_0
dcl_constantbuffer cb0[8], immediateIndexed
dcl_constantbuffer cb1[6], immediateIndexed
dcl_constantbuffer cb2[4], immediateIndexed
dcl_input v0.xyz
dcl_input v2.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xy
dcl_output o1.z
dcl_temps 3

// 3DMigoto StereoParams:
dcl_resource_texture2d (float,float,float,float) t125

ld_indexable(texture2d)(float,float,float,float) r2.xyzw, l(0, 0, 0, 0), t125.xyzw

mul r0.xyzw, v0.yyyy, cb2[1].xyzw
mad r0.xyzw, cb2[0].xyzw, v0.xxxx, r0.xyzw
mad r0.xyzw, cb2[2].xyzw, v0.zzzz, r0.xyzw
add r0.xyzw, r0.xyzw, cb2[3].xyzw

// Relocated to here with asmtool.py
mov o0.xyw, r0.xyxw

// Automatic vertex shader halo fix inserted with DarkStarSword's asmtool.py:
// asmtool.py -I ../.. --auto-fix-vertex-halo --fix-unusual-halo-with-inconsistent-w-optimisation --fix-unity-reflection --fix-unity-frustum-world --only-autofixed 2d0936b0b4e2bbf5-vs.txt
ne r2.w, r0.w, l(1.0)
if_nz r2.w
  add r2.w, r0.w, -r2.y
  mad r0.x, r2.w, r2.x, r0.x
endif

div r1.x, cb1[5].x, r0.w
max r1.x, r1.x, l(-1.000000)
min r1.x, r1.x, l(0.000000)
add r0.z, r0.z, r1.x
min r1.x, r0.w, r0.z

// mov o0.xyw, r0.xyxw // Relocated from here with asmtool.py

add r0.x, -r0.z, r1.x
mad o0.z, cb1[5].y, r0.x, r0.z
mad r0.x, -cb0[7].x, cb0[7].z, l(1.000000)
mad r0.x, -cb0[7].y, cb0[7].z, r0.x
mul o1.z, r0.x, l(0.500000)
mad o1.xy, v2.xyxx, cb0[6].xyxx, cb0[6].zwzz
ret
// Approximately 0 instruction slots used