// asmtool.py -I ../.. --auto-fix-vertex-halo --fix-unusual-halo-with-inconsistent-w-optimisation --fix-unity-reflection --fix-unity-frustum-world --only-autofixed 718578218e84220c-vs.txt
// 3DMigoto: 718578218e84220c |    Unity headers extracted from TMPro_SDF.shader
//    Shader "TMPro/Distance Field" {
//      Properties {
//       _FaceTex ("Face Texture", 2D) = "white" { }
//       _FaceUVSpeedX ("Face UV Speed X", Range(-5.000000,5.000000)) = 0.000000
//       _FaceUVSpeedY ("Face UV Speed Y", Range(-5.000000,5.000000)) = 0.000000
//       _FaceColor ("Face 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" { }
//       _OutlineUVSpeedX ("Outline UV Speed X", Range(-5.000000,5.000000)) = 0.000000
//       _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
//       _Bevel ("Bevel", Range(0.000000,1.000000)) = 0.500000
//       _BevelOffset ("Bevel Offset", Range(-0.500000,0.500000)) = 0.000000
//       _BevelWidth ("Bevel Width", Range(-0.500000,0.500000)) = 0.000000
//       _BevelClamp ("Bevel Clamp", Range(0.000000,1.000000)) = 0.000000
//       _BevelRoundness ("Bevel Roundness", Range(0.000000,1.000000)) = 0.000000
//       _LightAngle ("Light Angle", Range(0.000000,6.283185)) = 3.141600
//       _SpecularColor ("Specular", Color) = (1.000000,1.000000,1.000000,1.000000)
//       _SpecularPower ("Specular", Range(0.000000,4.000000)) = 2.000000
//       _Reflectivity ("Reflectivity", Range(5.000000,15.000000)) = 10.000000
//       _Diffuse ("Diffuse", Range(0.000000,1.000000)) = 0.500000
//       _Ambient ("Ambient", Range(1.000000,0.000000)) = 0.500000
//       _BumpMap ("Normal map", 2D) = "bump" { }
//       _BumpOutline ("Bump Outline", Range(0.000000,1.000000)) = 0.000000
//       _BumpFace ("Bump Face", Range(0.000000,1.000000)) = 0.000000
//       _ReflectFaceColor ("Reflection Color", Color) = (0.000000,0.000000,0.000000,1.000000)
//       _ReflectOutlineColor ("Reflection Color", Color) = (0.000000,0.000000,0.000000,1.000000)
//       _Cube ("Reflection Cubemap", CUBE) = "black" { }
//       _EnvMatrixRotation ("Texture Rotation", Vector) = (0.000000,0.000000,0.000000,0.000000)
//       _UnderlayColor ("Border Color", Color) = (0.000000,0.000000,0.000000,0.500000)
//       _UnderlayOffsetX ("Border OffsetX", Range(-1.000000,1.000000)) = 0.000000
//       _UnderlayOffsetY ("Border OffsetY", Range(-1.000000,1.000000)) = 0.000000
//       _UnderlayDilate ("Border Dilate", Range(-1.000000,1.000000)) = 0.000000
//       _UnderlaySoftness ("Border Softness", 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
//       _MaskCoord ("Mask Coordinates", Vector) = (0.000000,0.000000,100000.000000,100000.000000)
//       _MaskSoftnessX ("Mask SoftnessX", Float) = 0.000000
//       _MaskSoftnessY ("Mask SoftnessY", Float) = 0.000000
//       _StencilComp ("Stencil Comparison", Float) = 8.000000
//       _Stencil ("Stencil ID", Float) = 0.000000
//       _StencilOp ("Stencil Operation", Float) = 0.000000
//       _StencilWriteMask ("Stencil Write Mask", Float) = 255.000000
//       _StencilReadMask ("Stencil Read Mask", Float) = 255.000000
//      }
//      Fallback "TMPro/Mobile/Distance Field"
//      SubShader 1/1 {
//        Tags { "QUEUE"="Transparent" "IGNOREPROJECTOR"="true" "RenderType"="Transparent" }
//        Pass 1/1 {
//          Tags { "QUEUE"="Transparent" "IGNOREPROJECTOR"="true" "RenderType"="Transparent" }
//          ZTest [_ZTestMode]
//          ZWrite Off
//          Cull [_CullMode]
//          Stencil {
//             Ref [_Stencil]
//             ReadMask [_StencilReadMask]
//             WriteMask [_StencilWriteMask]
//             Comp [_StencilComp]
//             Pass [_StencilOp]
//            }
//          Blend One OneMinusSrcAlpha
//          GpuProgramID 5314
//          Program "vp" {
//            SubProgram "d3d11 " {
//              GpuProgramIndex 0
//            }
//          }
//        }
//      }
//    }
//
// Unity 5.3 headers extracted from TMPro_SDF.shader.decompressed:
//   API d3d11
//   Shader model vs_4_0
//   undeciphered1: 201510240 66 0 0
//   undeciphered2: 1 0 4 0 0 0
//   undeciphered3: 31 5 0 0 2 1 1 2 3 4 4 5
//   ConstBuffer "$Globals" 544
//   Vector 112 [_FaceColor]
//   Float 128 [_FaceDilate]
//   Float 132 [_OutlineSoftness]
//   Vector 144 [_OutlineColor]
//   Float 160 [_OutlineWidth]
//   Float 420 [_WeightNormal]
//   Float 424 [_WeightBold]
//   Float 428 [_ScaleRatioA]
//   Float 440 [_VertexOffsetX]
//   Float 444 [_VertexOffsetY]
//   Float 496 [_GradientScale]
//   Float 500 [_ScaleX]
//   Float 504 [_ScaleY]
//   Float 508 [_PerspectiveFilter]
//   Matrix 240 [_EnvMatrix]
//   ConstBuffer "UnityPerCamera" 144
//   Vector 64 [_WorldSpaceCameraPos] 3
//   Vector 96 [_ScreenParams]
//   ConstBuffer "UnityPerDraw" 352
//   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:58:55 2018
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// NORMAL                   0   xyz         1     NONE   float   xyz
// COLOR                    0   xyzw        2     NONE   float   xyzw
// TEXCOORD                 0   xy          3     NONE   float   xy
// TEXCOORD                 1   xy          4     NONE   float   xy
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyzw
// COLOR                    0   xyzw        1     NONE   float   xyzw
// COLOR                    1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 0   x           3     NONE   float   x
// TEXCOORD                 4    yzw        3     NONE   float    yzw
// TEXCOORD                 1   xyzw        4     NONE   float   xyzw
// TEXCOORD                 2   xyzw        5     NONE   float   xyzw
// TEXCOORD                 3   xyzw        6     NONE   float   xyzw
//
vs_4_0
dcl_constantbuffer cb0[32], immediateIndexed
dcl_constantbuffer cb1[9], immediateIndexed
dcl_constantbuffer cb2[22], immediateIndexed
dcl_constantbuffer cb3[4], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyz
dcl_input v2.xyzw
dcl_input v3.xy
dcl_input v4.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.x
dcl_output o3.yzw
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_output o6.xyzw
dcl_temps 5
dcl_constantbuffer cb10[4], immediateIndexed

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

ld_indexable(texture2d)(float,float,float,float) r3.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 718578218e84220c-vs.txt

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

add r0.xy, v0.xyxx, cb0[27].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
mad r1.xyzw, cb2[3].xyzw, v0.wwww, r1.xyzw
mov o0.xyzw, r1.xyzw
mul o1.xyzw, v2.xyzw, cb0[7].xyzw
mul o2.w, v2.w, cb0[9].w
mov o2.xyz, cb0[9].xyzx
mul r1.xyz, r0.yyyy, cb2[13].xyzx
mad r1.xyz, cb2[12].xyzx, r0.xxxx, r1.xyzx
mov o6.xy, r0.xyxx
mad r0.xyz, cb2[14].xyzx, v0.zzzz, r1.xyzx
mad r0.xyz, cb2[15].xyzx, v0.wwww, r0.xyzx
add r0.xyz, -r0.xyzx, r4.xyzx
mul r1.xyz, r0.yyyy, cb0[16].xyzx
mad r1.xyz, cb0[15].xyzx, r0.xxxx, r1.xyzx
mad o3.yzw, cb0[17].xxyz, r0.zzzz, r1.xxyz
mov o3.x, v2.w
round_ni r0.w, v4.x
mul o4.z, r0.w, l(0.00122070313)
frc r0.w, v4.x
mul o4.w, r0.w, l(5.000000)
mov o4.xy, v3.xyxx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
mul r1.x, v1.x, cb2[16].x
mul r1.y, v1.x, cb2[17].x
mul r1.z, v1.x, cb2[18].x
mul r2.x, v1.y, cb2[16].y
mul r2.y, v1.y, cb2[17].y
mul r2.z, v1.y, cb2[18].y
add r1.xyz, r1.xyzx, r2.xyzx
mul r2.x, v1.z, cb2[16].z
mul r2.y, v1.z, cb2[17].z
mul r2.z, v1.z, cb2[18].z
add r1.xyz, r1.xyzx, r2.xyzx
dp3 r0.w, r1.xyzx, r1.xyzx
rsq r0.w, r0.w
mul r1.xyz, r0.wwww, r1.xyzx
dp3 r0.x, r1.xyzx, r0.xyzx
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[31].yyzy
div r0.yz, r1.wwww, r0.yyzy
dp2 r0.w, r0.yzyy, r0.yzyy
div o6.zw, l(0.000000, 0.000000, 0.500000, 0.500000), r0.yyyz
rsq r0.y, r0.w
mul r0.z, |v4.y|, cb0[31].x
mul r0.y, r0.y, r0.z
mul r0.z, r0.y, l(1.500000)
add r0.w, -cb0[31].w, l(1.000000)
mul r0.w, r0.w, r0.z
mad r0.y, r0.y, l(1.500000), -r0.w
mad r0.x, |r0.x|, r0.y, r0.w
eq r0.y, cb3[3].w, l(0.000000)
movc r0.y, r0.y, r0.x, r0.z
ge r0.x, l(0.000000), v4.y
and r0.x, r0.x, l(0x3f800000)
add r0.z, -cb0[26].y, cb0[26].z
mad r0.x, r0.x, r0.z, cb0[26].y
div r0.x, r0.x, cb0[31].x
mul r0.z, cb0[8].x, cb0[26].w
mad r0.w, r0.z, l(0.500000), r0.x
mov o5.yw, r0.yyyw
div r0.x, l(0.500000), r0.y
mad r0.y, -cb0[10].x, cb0[26].w, l(1.000000)
mad r0.y, -cb0[8].y, cb0[26].w, r0.y
mad r0.y, r0.y, l(0.500000), -r0.x
add o5.x, -r0.w, r0.y
add r0.y, -r0.w, l(0.500000)
add o5.z, r0.x, r0.y
ret
// Approximately 0 instruction slots used