// asmtool.py -I ../.. --fix-unity-reflection --only-autofixed 2a7115933a70a737-ps.txt
// 3DMigoto: 2a7115933a70a737 |    Unity headers extracted from TMPro_SDF-Surface.shader
//    Shader "TMPro/Distance Field (Surface)" {
//      Properties {
//       _FaceTex ("Fill 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 ("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" { }
//       _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
//       _BumpMap ("Normalmap", 2D) = "bump" { }
//       _BumpOutline ("Bump Outline", Range(0.000000,1.000000)) = 0.500000
//       _BumpFace ("Bump Face", Range(0.000000,1.000000)) = 0.500000
//       _ReflectFaceColor ("Face Color", Color) = (0.000000,0.000000,0.000000,1.000000)
//       _ReflectOutlineColor ("Outline 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)
//       _SpecColor ("Specular Color", Color) = (0.000000,0.000000,0.000000,1.000000)
//       _FaceShininess ("Face Shininess", Range(0.000000,1.000000)) = 0.000000
//       _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" }
//        Pass 2/3 {
//          Name "FORWARD"
//          Tags { "LIGHTMODE"="ForwardAdd" "QUEUE"="Transparent" "IGNOREPROJECTOR"="true" "RenderType"="Transparent" }
//          ZWrite Off
//          Cull [_CullMode]
//          Blend SrcAlpha One
//          ColorMask RGB
//          GpuProgramID 92919
//          Program "fp" {
//            SubProgram "d3d11 " {
//              GpuProgramIndex 10
//            }
//          }
//        }
//      }
//    }
//
// Unity 5.3 headers extracted from TMPro_SDF-Surface.shader.decompressed:
//   API d3d11
//   Shader model ps_4_0
//   undeciphered1: 201510240 118 10 0
//   Keywords { "SPOT" }
//   undeciphered2: 1 6 3 6 0 0
//   undeciphered3: 0 0
//   ConstBuffer "$Globals" 672
//   Vector 96 [_LightColor0]
//   Vector 112 [_SpecColor]
//   Float 208 [_FaceUVSpeedX]
//   Float 212 [_FaceUVSpeedY]
//   Vector 224 [_FaceColor]
//   Float 244 [_OutlineSoftness]
//   Float 248 [_OutlineUVSpeedX]
//   Float 252 [_OutlineUVSpeedY]
//   Vector 256 [_OutlineColor]
//   Float 272 [_OutlineWidth]
//   Float 276 [_Bevel]
//   Float 280 [_BevelOffset]
//   Float 284 [_BevelWidth]
//   Float 288 [_BevelClamp]
//   Float 292 [_BevelRoundness]
//   Float 296 [_BumpOutline]
//   Float 300 [_BumpFace]
//   Float 528 [_ShaderFlags]
//   Float 540 [_ScaleRatioA]
//   Float 600 [_TextureWidth]
//   Float 604 [_TextureHeight]
//   Float 608 [_GradientScale]
//   Float 624 [_FaceShininess]
//   Float 628 [_OutlineShininess]
//   Matrix 144 [unity_WorldToLight]
//   ConstBuffer "UnityPerCamera" 144
//   Vector 0 [_Time]
//   Vector 64 [_WorldSpaceCameraPos] 3
//   ConstBuffer "UnityLighting" 720
//   Vector 0 [_WorldSpaceLightPos0]
//   SetTexture 0 [_MainTex] 2D 5
//   SetTexture 1 [_FaceTex] 2D 2
//   SetTexture 2 [_OutlineTex] 2D 3
//   SetTexture 3 [_BumpMap] 2D 4
//   SetTexture 4 [_LightTexture0] 2D 0
//   SetTexture 5 [_LightTextureB0] 2D 1
//   BindCB "$Globals" 0
//   BindCB "UnityPerCamera" 1
//   BindCB "UnityLighting" 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
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyz         2     NONE   float   xyz
// TEXCOORD                 2   xyz         3     NONE   float   xyz
// TEXCOORD                 3   xyz         4     NONE   float   xyz
// TEXCOORD                 4   xyz         5     NONE   float   xyz
// COLOR                    0   xyzw        6     NONE   float   xyzw
// TEXCOORD                 5   xy          7     NONE   float   xy
// TEXCOORD                 6   xyz         8     NONE   float
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
//
ps_4_0
dcl_constantbuffer cb0[40], immediateIndexed
dcl_constantbuffer cb1[9], immediateIndexed
dcl_constantbuffer cb2[1], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, mode_default
dcl_sampler s4, mode_default
dcl_sampler s5, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texture2d (float,float,float,float) t4
dcl_resource_texture2d (float,float,float,float) t5
dcl_input_ps linear v1.xyzw
dcl_input_ps linear v2.xyz
dcl_input_ps linear v3.xyz
dcl_input_ps linear v4.xyz
dcl_input_ps linear v5.xyz
dcl_input_ps linear v6.xyzw
dcl_input_ps linear v7.xy
dcl_output o0.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 ../.. --fix-unity-reflection --only-autofixed 2a7115933a70a737-ps.txt

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

add r0.x, v7.x, cb0[17].z
div r1.xy, l(1.000000, 1.000000, 1.000000, 1.000000), cb0[37].zwzz
mov r1.z, l(0)
add r2.xyzw, -r1.xzzy, v1.xyxy
add r1.xyzw, r1.xzzy, v1.xyxy
sample r3.xyzw, r2.xyxx, t0.wxyz, s5
sample r2.xyzw, r2.zwzz, t0.xyzw, s5
mov r3.z, r2.w
sample r2.xyzw, r1.xyxx, t0.xyzw, s5
sample r1.xyzw, r1.zwzz, t0.xyzw, s5
mov r3.w, r1.w
mov r3.y, r2.w
add r0.xyzw, r0.xxxx, r3.xyzw
add r0.xyzw, r0.xyzw, l(-0.500000, -0.500000, -0.500000, -0.500000)
add r1.x, cb0[17].w, cb0[17].x
max r1.x, r1.x, l(0.010000)
div r0.xyzw, r0.xyzw, r1.xxxx
mul r1.x, r1.x, cb0[17].y
mul r1.x, r1.x, cb0[38].x
mul r1.x, r1.x, l(-2.000000)
add_sat r0.xyzw, r0.xyzw, l(0.500000, 0.500000, 0.500000, 0.500000)
mad r2.xyzw, r0.xyzw, l(2.000000, 2.000000, 2.000000, 2.000000), l(-1.000000, -1.000000, -1.000000, -1.000000)
add r2.xyzw, -|r2.xyzw|, l(1.000000, 1.000000, 1.000000, 1.000000)
mul r1.y, cb0[33].x, l(0.500000)
ge r1.z, r1.y, -r1.y
frc r1.y, |r1.y|
movc r1.y, r1.z, r1.y, -r1.y
ge r1.y, r1.y, l(0.500000)
movc r0.xyzw, r1.yyyy, r2.xyzw, r0.xyzw
mul r2.xyzw, r0.xyzw, l(1.570796, 1.570796, 1.570796, 1.570796)
sincos r2.xyzw, null, r2.xyzw
add r2.xyzw, -r0.xyzw, r2.xyzw
mad r0.xyzw, cb0[18].yyyy, r2.xyzw, r0.xyzw
add r1.y, -cb0[18].x, l(1.000000)
min r0.xyzw, r0.xyzw, r1.yyyy
mul r0.xz, r1.xxxx, r0.xxzx
mad r0.yz, r0.wwyw, r1.xxxx, -r0.zzxz
mov r0.xw, l(-1.000000,0,0,1.000000)
dp2 r1.x, r0.xyxx, r0.xyxx
rsq r1.x, r1.x
dp2 r0.w, r0.zwzz, r0.zwzz
rsq r0.w, r0.w
mul r2.x, r0.w, r0.z
mul r2.yz, r0.wwww, l(0.000000, 1.000000, 0.000000, 0.000000)
mov r0.z, l(0)
mul r0.xyz, r1.xxxx, r0.xyzx
mul r1.xyz, r0.xyzx, r2.xyzx
mad r0.xyz, r2.zxyz, r0.yzxy, -r1.xyzx
mad r1.xy, cb0[15].zwzz, cb1[0].yyyy, v1.zwzz
sample r1.xyzw, r1.xyxx, t2.xyzw, s3
mul r1.xyz, r1.xyzx, cb0[16].xyzx
mul r0.w, v6.w, cb0[16].w
mul r2.w, r1.w, r0.w
mul r2.xyz, r1.xyzx, r2.wwww
mad r1.xy, cb0[13].xyxx, cb1[0].yyyy, v1.zwzz
sample r1.xyzw, r1.xyxx, t1.xyzw, s2
mul r3.xyzw, v6.xyzw, cb0[14].xyzw
mul r1.xyzw, r1.xyzw, r3.xyzw
mul r1.xyz, r1.wwww, r1.xyzx
add r2.xyzw, -r1.xyzw, r2.xyzw
mul r0.w, cb0[17].x, cb0[33].w
mul r0.w, r0.w, v7.y
min r3.x, r0.w, l(1.000000)
sqrt r3.x, r3.x
sample r4.xyzw, v1.xyxx, t0.xyzw, s5
add r3.y, -r4.w, l(0.500000)
add r3.y, r3.y, -v7.x
mad r3.y, r3.y, v7.y, l(0.500000)
mad_sat r3.z, r0.w, l(0.500000), r3.y
mad r0.w, -r0.w, l(0.500000), r3.y
mul r3.x, r3.x, r3.z
mad r1.xyzw, r3.xxxx, r2.xyzw, r1.xyzw
mul r2.x, cb0[15].y, cb0[33].w
mul r2.y, r2.x, v7.y
mad r2.x, r2.x, v7.y, l(1.000000)
mad r0.w, r2.y, l(0.500000), r0.w
div_sat r0.w, r0.w, r2.x
add r0.w, -r0.w, l(1.000000)
mul r1.xyzw, r0.wwww, r1.xyzw
add r0.w, -cb0[18].w, cb0[18].z
mad r0.w, r3.z, r0.w, cb0[18].w
sample r2.xyzw, v1.zwzz, t3.xyzw, s4
mad r2.xy, r2.wyww, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r2.w, r2.xyxx, r2.xyxx
min r2.w, r2.w, l(1.000000)
add r2.w, -r2.w, l(1.000000)
sqrt r2.z, r2.w
mad r2.xyz, r2.xyzx, r0.wwww, l(-0.000000, -0.000000, -1.000000, 0.000000)
mad r2.xyz, r1.wwww, r2.xyzx, l(0.000000, 0.000000, 1.000000, 0.000000)
add r0.xyz, r0.xyzx, -r2.xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
dp3 r2.x, v2.xyzx, -r0.xyzx
dp3 r2.y, v3.xyzx, -r0.xyzx
dp3 r2.z, v4.xyzx, -r0.xyzx
add r0.xyz, -v5.xyzx, cb2[0].xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
add r3.xyw, -v5.xyxz, r6.xyxz
dp3 r0.w, r3.xywx, r3.xywx
rsq r0.w, r0.w
mad r3.xyw, r3.xyxw, r0.wwww, r0.xyxz
dp3 r0.x, r2.xyzx, r0.xyzx
dp3 r0.y, r3.xywx, r3.xywx
rsq r0.y, r0.y
mul r0.yzw, r0.yyyy, r3.xxyw
dp3 r0.y, r2.xyzx, r0.yzwy
max r0.xy, r0.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000)
log r0.y, r0.y
add r0.z, -cb0[39].x, cb0[39].y
mad r0.z, r3.z, r0.z, cb0[39].x
mul r0.z, r0.z, l(128.000000)
mul r0.y, r0.y, r0.z
exp r0.y, r0.y
mul r2.xyzw, v5.yyyy, cb0[10].xyzw
mad r2.xyzw, cb0[9].xyzw, v5.xxxx, r2.xyzw
mad r2.xyzw, cb0[11].xyzw, v5.zzzz, r2.xyzw
add r2.xyzw, r2.xyzw, cb0[12].xyzw
div r0.zw, r2.xxxy, r2.wwww
add r0.zw, r0.zzzw, l(0.000000, 0.000000, 0.500000, 0.500000)
sample r3.xyzw, r0.zwzz, t4.xyzw, s0
lt r0.z, l(0.000000), r2.z
dp3 r0.w, r2.xyzx, r2.xyzx
sample r2.xyzw, r0.wwww, t5.xyzw, s1
and r0.z, r0.z, l(0x3f800000)
mul r0.z, r3.w, r0.z
mul r0.z, r2.x, r0.z
mul r2.xyz, r0.zzzz, cb0[6].xyzx
mul r3.xyz, r2.xyzx, cb0[7].xyzx
mul r0.yzw, r0.yyyy, r3.xxyz
max r2.w, r1.w, l(0.000100)
div r1.xyz, r1.xyzx, r2.wwww
mov o0.w, r1.w
mul r1.xyz, r2.xyzx, r1.xyzx
mad o0.xyz, r1.xyzx, r0.xxxx, r0.yzwy
ret
// Approximately 0 instruction slots used