// asmtool.py -I ../.. --auto-fix-vertex-halo --fix-unusual-halo-with-inconsistent-w-optimisation --fix-unity-reflection --fix-unity-frustum-world --only-autofixed d3f2dd8589075ce8-vs.txt
// 3DMigoto: d3f2dd8589075ce8 | Matched 4 variants of 3 shaders: TextMeshPro/Mobile/Distance Field, TextMeshPro/Mobile/Distance Field - Masking, TextMeshPro/Mobile/Distance Field Overlay
//
// c:    Unity headers extracted from TextMeshPro_Mobile_Distance Field
// 2:    Unity headers extracted from TextMeshPro_Mobile_Distance Field - Masking
// 1:    Unity headers extracted from TextMeshPro_Mobile_Distance Field Overlay
// 2:    Shader "TextMeshPro/Mobile/Distance Field - Masking" {
// 1:    Shader "TextMeshPro/Mobile/Distance Field Overlay" {
// c:    Shader "TextMeshPro/Mobile/Distance Field" {
//         CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI"
//         SubShader 1/1 {
// 1:        Tags { "IGNOREPROJECTOR"="true" "QUEUE"="Overlay" "RenderType"="Transparent" }
// e:        Tags { "IGNOREPROJECTOR"="true" "QUEUE"="Transparent" "RenderType"="Transparent" }
//           Pass 1/1 {
// 1:          Tags { "IGNOREPROJECTOR"="true" "QUEUE"="Overlay" "RenderType"="Transparent" }
// e:          Tags { "IGNOREPROJECTOR"="true" "QUEUE"="Transparent" "RenderType"="Transparent" }
//             ZWrite Off
//             Program "vp" {
//               SubProgram "d3d11" {
//               }
//             }
//           }
//         }
//       }
//
// 2: Unity 5.3 headers extracted from TextMeshPro_Mobile_Distance Field - Masking:
// 1: Unity 5.3 headers extracted from TextMeshPro_Mobile_Distance Field Overlay:
// c: Unity 5.3 headers extracted from TextMeshPro_Mobile_Distance Field:
//      API d3d11
//      Shader model vs_4_0
//      undeciphered1: 201609010 69 0 0
//      undeciphered1a: 5
// 8:   Keywords { "OUTLINE_ON" }
//      undeciphered2: 1 0 4 0 0 0
//      undeciphered3: 31 5 0 0 1 2 2 1 3 4 4 5
// d:   ConstBuffer "$Globals" 464
// 2:   ConstBuffer "$Globals" 512
//      Vector 48 [_FaceColor]
//      Float 64 [_FaceDilate]
//      Float 68 [_OutlineSoftness]
//      Vector 80 [_OutlineColor]
//      Float 96 [_OutlineWidth]
//      Float 356 [_WeightNormal]
//      Float 360 [_WeightBold]
//      Float 364 [_ScaleRatioA]
//      Float 376 [_VertexOffsetX]
//      Float 380 [_VertexOffsetY]
//      Vector 416 [_ClipRect]
//      Float 432 [_MaskSoftnessX]
//      Float 436 [_MaskSoftnessY]
//      Float 448 [_GradientScale]
//      Float 452 [_ScaleX]
//      Float 456 [_ScaleY]
//      Float 460 [_PerspectiveFilter]
//      ConstBuffer "UnityPerCamera" 144
//      Vector 64 [_WorldSpaceCameraPos] 3
//      Vector 96 [_ScreenParams]
//      ConstBuffer "UnityPerDraw" 160
//      Matrix 0 [unity_ObjectToWorld]
//      Matrix 64 [unity_WorldToObject]
//      ConstBuffer "UnityPerFrame" 384
//      Matrix 80 [glstate_matrix_projection]
//      Matrix 272 [unity_MatrixVP]
//      BindCB "$Globals" 0
//      BindCB "UnityPerCamera" 1
//      BindCB "UnityPerDraw" 2
//      BindCB "UnityPerFrame" 3
//
// Headers extracted with DarkStarSword's extract_unity55_shaders.py
// https://github.com/DarkStarSword/3d-fixes

//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.3.16 on Sun Apr 21 18:02:33 2019
//
//
// 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    y
//
//
// 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   xyzw        3     NONE   float   xyzw
// TEXCOORD                 1   xyzw        4     NONE   float   xyzw
// TEXCOORD                 2   xyzw        5     NONE   float   xyzw
//
vs_4_0
dcl_constantbuffer cb0[29], immediateIndexed
dcl_constantbuffer cb1[9], immediateIndexed
dcl_constantbuffer cb2[7], immediateIndexed
dcl_constantbuffer cb3[24], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyz
dcl_input v2.xyzw
dcl_input v3.xy
dcl_input v4.y
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_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 d3f2dd8589075ce8-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[23].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 r2.xyzw, r1.xyzw, cb2[3].xyzw
mad r1.xyz, cb2[3].xyzx, v0.wwww, r1.xyzx
add r1.xyz, -r1.xyzx, r6.xyzx
mul r3.xyzw, r2.yyyy, cb3[18].xyzw
mad r3.xyzw, cb3[17].xyzw, r2.xxxx, r3.xyzw
mad r3.xyzw, cb3[19].xyzw, r2.zzzz, r3.xyzw
mad r2.xyzw, cb3[20].xyzw, r2.wwww, r3.xyzw
mov o0.xyzw, r2.xyzw
mul r3.xyzw, v2.xyzw, cb0[3].xyzw
mul r3.xyz, r3.wwww, r3.xyzx
mov o1.xyzw, r3.xyzw
mul r4.w, v2.w, cb0[5].w
mul r4.xyz, r4.wwww, cb0[5].xyzx
add r4.xyzw, -r3.xyzw, r4.xyzw
dp3 r0.z, r1.xyzx, r1.xyzx
rsq r0.z, r0.z
mul r1.xyz, r0.zzzz, r1.xyzx
dp3 r2.x, v1.xyzx, cb2[4].xyzx
dp3 r2.y, v1.xyzx, cb2[5].xyzx
dp3 r2.z, v1.xyzx, cb2[6].xyzx
dp3 r0.z, r2.xyzx, r2.xyzx
rsq r0.z, r0.z
mul r2.xyz, r0.zzzz, r2.xyzx
dp3 r0.z, r2.xyzx, r1.xyzx
mul r1.xy, cb1[6].yyyy, cb3[6].xyxx
mad r1.xy, cb3[5].xyxx, cb1[6].xxxx, r1.xyxx
mul r1.xy, |r1.xyxx|, cb0[28].yzyy
div r1.xy, r2.wwww, r1.xyxx
dp2 r0.w, r1.xyxx, r1.xyxx
mad r1.xy, cb0[27].xyxx, l(0.250000, 0.250000, 0.000000, 0.000000), r1.xyxx
div o5.zw, l(0.000000, 0.000000, 0.250000, 0.250000), r1.xxxy
rsq r0.w, r0.w
mul r1.x, |v4.y|, cb0[28].x
mul r0.w, r0.w, r1.x
mul r1.x, r0.w, l(1.500000)
add r1.y, -cb0[28].w, l(1.000000)
mul r1.y, r1.y, |r1.x|
mad r0.w, r0.w, l(1.500000), -r1.y
mad r0.z, |r0.z|, r0.w, r1.y
eq r0.w, cb3[8].w, l(0.000000)
movc r0.z, r0.w, r0.z, r1.x
mul r0.w, cb0[4].y, cb0[22].w
mad r0.w, r0.w, r0.z, l(1.000000)
div r1.x, r0.z, r0.w
mul r0.z, cb0[6].x, cb0[22].w
mul r0.z, r0.z, l(0.500000)
mul r0.w, r1.x, r0.z
add r0.w, r0.w, r0.w
min r0.w, r0.w, l(1.000000)
sqrt r0.w, r0.w
mad o2.xyzw, r0.wwww, r4.xyzw, r3.xyzw
max r2.xyzw, cb0[26].xyzw, l(-20000000000.000000, -20000000000.000000, -20000000000.000000, -20000000000.000000)
min r2.xyzw, r2.xyzw, l(20000000000.000000, 20000000000.000000, 20000000000.000000, 20000000000.000000)
add r1.yz, r0.xxyx, -r2.xxyx
mad r0.xy, r0.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), -r2.xyxx
add o5.xy, -r2.zwzz, r0.xyxx
add r0.xy, -r2.xyxx, r2.zwzz
div o3.zw, r1.yyyz, r0.xxxy
mov o3.xy, v3.xyxx
ge r0.x, l(0.000000), v4.y
and r0.x, r0.x, l(0x3f800000)
add r0.y, -cb0[22].y, cb0[22].z
mad r0.x, r0.x, r0.y, cb0[22].y
mad r0.x, r0.x, l(0.250000), cb0[4].x
mul r0.x, r0.x, cb0[22].w
mad r0.x, -r0.x, l(0.500000), l(0.500000)
mad r1.w, r0.x, r1.x, l(-0.500000)
mad o4.y, -r0.z, r1.x, r1.w
mad o4.z, r0.z, r1.x, r1.w
mov o4.xw, r1.xxxw
ret
// Approximately 0 instruction slots used