// asmtool.py -I ../.. --auto-fix-vertex-halo --fix-unusual-halo-with-inconsistent-w-optimisation --fix-unity-reflection --fix-unity-frustum-world --only-autofixed a322a0e310854a52-vs.txt
// 3DMigoto: a322a0e310854a52 | 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 1/2 {
// 1:        Pass 1/3 {
//             Name "FORWARD"
//             Tags { "LIGHTMODE"="ForwardBase" "QUEUE"="Transparent" "IGNOREPROJECTOR"="true" "RenderType"="Transparent" }
//             ZWrite Off
//             Cull [_CullMode]
//             Blend SrcAlpha OneMinusSrcAlpha
//             ColorMask RGB
// 1:          GpuProgramID 58057
// 2:          GpuProgramID 63223
//             Program "vp" {
//               SubProgram "d3d11 " {
//                 GpuProgramIndex 0
//               }
//             }
//           }
//         }
//       }
//
// 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 73 0 0
//      Keywords { "DIRECTIONAL" "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" }
//      undeciphered2: 1 0 4 0 0 0
//      undeciphered3: 159 6 0 0 2 1 1 2 3 4 4 5 7 8
//      ConstBuffer "$Globals" 672
//      Float 240 [_FaceDilate]
//      Float 532 [_WeightNormal]
//      Float 536 [_WeightBold]
//      Float 540 [_ScaleRatioA]
//      Float 552 [_VertexOffsetX]
//      Float 556 [_VertexOffsetY]
//      Float 608 [_GradientScale]
//      Float 612 [_ScaleX]
//      Float 616 [_ScaleY]
//      Float 620 [_PerspectiveFilter]
//      Vector 640 [_MainTex_ST]
//      Vector 656 [_FaceTex_ST]
//      Matrix 352 [_EnvMatrix]
//      ConstBuffer "UnityPerCamera" 144
//      Vector 64 [_WorldSpaceCameraPos] 3
//      Vector 96 [_ScreenParams]
//      ConstBuffer "UnityPerDraw" 352
//      Vector 336 [unity_WorldTransformParams]
//      Matrix 0 [glstate_matrix_mvp]
//      Matrix 192 [unity_ObjectToWorld]
//      Matrix 256 [unity_WorldToObject]
//      ConstBuffer "UnityPerFrame" 272
//      Matrix 0 [glstate_matrix_projection]
//      BindCB "$Globals" 0
//      BindCB "UnityPerCamera" 1
//      BindCB "UnityPerDraw" 2
//      BindCB "UnityPerFrame" 3
//
// 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:59:02 2018
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// TANGENT                  0   xyzw        1     NONE   float   xyzw
// NORMAL                   0   xyz         2     NONE   float   xyz
// TEXCOORD                 0   xyzw        3     NONE   float   xy
// TEXCOORD                 1   xyzw        4     NONE   float   xy
// TEXCOORD                 2   xyzw        5     NONE   float
// TEXCOORD                 3   xyzw        6     NONE   float
// COLOR                    0   xyzw        7     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyzw        3     NONE   float   xyzw
// TEXCOORD                 3   xyzw        4     NONE   float   xyzw
// COLOR                    0   xyzw        5     NONE   float   xyzw
// TEXCOORD                 4   xy          6     NONE   float   xy
// TEXCOORD                 5   xyz         7     NONE   float   xyz
// TEXCOORD                 6   xyz         8     NONE   float   xyz
//
vs_4_0
dcl_constantbuffer cb0[42], immediateIndexed
dcl_constantbuffer cb1[9], immediateIndexed
dcl_constantbuffer cb2[22], immediateIndexed
dcl_constantbuffer cb3[2], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyzw
dcl_input v2.xyz
dcl_input v3.xy
dcl_input v4.xy
dcl_input v7.xyzw
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_output o6.xy
dcl_output o7.xyz
dcl_output o8.xyz
dcl_temps 7
dcl_constantbuffer cb10[4], immediateIndexed

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

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


// Unity reflection/specular 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 a322a0e310854a52-vs.txt

mul r5.w, -r5.x, r5.y
mad r6.xyz, -r5.wwww, cb10[0].xyzw, cb1[4].xyzw

add r0.xy, v0.xyxx, cb0[34].zwzz
mul r1.xyzw, r0.yyyy, cb2[1].xyzw
mad r1.xyzw, cb2[0].xyzw, r0.xxxx, r1.xyzw
mad r1.xyzw, cb2[2].xyzw, v0.zzzz, r1.xyzw
add o0.xyzw, r1.xyzw, cb2[3].xyzw
round_ni r0.w, v4.x
mul r1.z, r0.w, cb0[41].x
frc r0.w, v4.x
mul r1.w, r0.w, cb0[41].y
mad o1.zw, r1.zzzw, l(0.000000, 0.000000, 0.00122070313, 5.000000), cb0[41].zzzw
mad o1.xy, v3.xyxx, cb0[40].xyxx, cb0[40].zwzz
mul r1.xyz, r6.yyyy, cb2[17].xyzx
mad r1.xyz, cb2[16].xyzx, r6.xxxx, r1.xyzx
mad r1.xyz, cb2[18].xyzx, r6.zzzz, r1.xyzx
add r1.xyz, r1.xyzx, cb2[19].xyzx
mov r0.z, v0.z
add r1.xyz, -r0.xyzx, r1.xyzx
dp3 r0.z, v2.xyzx, r1.xyzx
lt r0.w, l(0.000000), r0.z
lt r0.z, r0.z, l(0.000000)
iadd r0.z, -r0.w, r0.z
itof r0.z, r0.z
mul r1.xyz, r0.zzzz, v2.xyzx
mov r2.y, cb2[16].y
mov r2.z, cb2[17].y
mov r2.x, cb2[18].y
mul r2.xyz, r1.yyyy, r2.xyzx
mov r3.y, cb2[16].x
mov r3.z, cb2[17].x
mov r3.x, cb2[18].x
mad r1.xyw, r3.xyxz, r1.xxxx, r2.xyxz
mov r2.y, cb2[16].z
mov r2.z, cb2[17].z
mov r2.x, cb2[18].z
mad r1.xyz, r2.xyzx, r1.zzzz, r1.xywx
dp3 r0.z, r1.xyzx, r1.xyzx
rsq r0.z, r0.z
mul r1.xyz, r0.zzzz, r1.xyzx
mov o2.z, r1.y
mul r2.xyz, v1.yyyy, cb2[13].yzxy
mad r2.xyz, cb2[12].yzxy, v1.xxxx, r2.xyzx
mad r2.xyz, cb2[14].yzxy, v1.zzzz, r2.xyzx
dp3 r0.z, r2.xyzx, r2.xyzx
rsq r0.z, r0.z
mul r2.xyz, r0.zzzz, r2.xyzx
mul r3.xyz, r1.xyzx, r2.xyzx
mad r3.xyz, r1.zxyz, r2.yzxy, -r3.xyzx
mul r0.z, v1.w, cb2[21].w
mul r3.xyz, r0.zzzz, r3.xyzx
mov o2.y, r3.x
mov o2.x, r2.z
mul r4.xyz, r0.yyyy, cb2[13].xyzx
mad r4.xyz, cb2[12].xyzx, r0.xxxx, r4.xyzx
mad r4.xyz, cb2[14].xyzx, v0.zzzz, r4.xyzx
mad r4.xyz, cb2[15].xyzx, v0.wwww, r4.xyzx
mov o2.w, r4.x
mov o3.x, r2.x
mov o4.x, r2.y
mov o3.z, r1.z
mov o3.y, r3.y
mov o4.y, r3.z
mov o3.w, r4.y
mov o4.z, r1.x
mov o4.w, r4.z
add r2.xyz, -r4.xyzx, r6.xyzx
mov o5.xyzw, v7.xyzw
mul r0.y, r0.y, cb2[1].w
mad r0.x, cb2[0].w, r0.x, r0.y
mad r0.x, cb2[2].w, v0.z, r0.x
mad r0.x, cb2[3].w, v0.w, r0.x
mul r0.yz, cb1[6].yyyy, cb3[1].xxyx
mad r0.yz, cb3[0].xxyx, cb1[6].xxxx, r0.yyzy
mul r0.yz, r0.yyzy, cb0[38].yyzy
div r0.xy, r0.xxxx, r0.yzyy
dp2 r0.x, r0.xyxx, r0.xyxx
rsq r0.x, r0.x
mul r0.y, |v4.y|, cb0[38].x
mul r0.x, r0.x, r0.y
mul r0.y, r0.x, l(1.500000)
add r0.z, -cb0[38].w, l(1.000000)
mul r0.y, r0.z, r0.y
mad r0.x, r0.x, l(1.500000), -r0.y
dp3 r0.z, r2.xyzx, r2.xyzx
rsq r0.z, r0.z
mul r3.xyz, r0.zzzz, r2.xyzx
dp3 r0.z, r1.yzxy, r3.xyzx
mad o6.y, |r0.z|, r0.x, r0.y
ge r0.x, l(0.000000), v4.y
and r0.x, r0.x, l(0x3f800000)
add r0.y, -cb0[33].y, cb0[33].z
mad r0.x, r0.x, r0.y, cb0[33].y
div r0.x, r0.x, cb0[38].x
mul r0.y, cb0[15].x, cb0[33].w
mad o6.x, r0.y, l(0.500000), r0.x
mul r0.xyz, r2.yyyy, cb0[23].xyzx
mad r0.xyz, cb0[22].xyzx, r2.xxxx, r0.xyzx
mad o7.xyz, cb0[24].xyzx, r2.zzzz, r0.xyzx
mov o8.xyz, l(0,0,0,0)
ret
// Approximately 0 instruction slots used