// asmtool.py -I ../.. --fix-unity-reflection --only-autofixed 1b16e447f72f1bb5-ps.txt
// 3DMigoto: 1b16e447f72f1bb5 |    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 1/3 {
//          Name "FORWARD"
//          Tags { "LIGHTMODE"="ForwardBase" "QUEUE"="Transparent" "IGNOREPROJECTOR"="true" "RenderType"="Transparent" }
//          ZWrite Off
//          Cull [_CullMode]
//          Blend SrcAlpha OneMinusSrcAlpha
//          ColorMask RGB
//          GpuProgramID 58057
//          Program "fp" {
//            SubProgram "d3d11 " {
//              GpuProgramIndex 2
//            }
//          }
//        }
//      }
//    }
//
// Unity 5.3 headers extracted from TMPro_SDF-Surface.shader.decompressed:
//   API d3d11
//   Shader model ps_4_0
//   undeciphered1: 201510240 150 12 2
//   Keywords { "DIRECTIONAL" "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" }
//   undeciphered2: 1 6 5 6 0 0
//   undeciphered3: 0 0
//   ConstBuffer "$Globals" 672
//   Vector 48 [unity_ColorSpaceLuminance]
//   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]
//   Vector 304 [_ReflectFaceColor]
//   Vector 320 [_ReflectOutlineColor]
//   Float 528 [_ShaderFlags]
//   Float 540 [_ScaleRatioA]
//   Float 600 [_TextureWidth]
//   Float 604 [_TextureHeight]
//   Float 608 [_GradientScale]
//   Float 624 [_FaceShininess]
//   Float 628 [_OutlineShininess]
//   ConstBuffer "UnityPerCamera" 144
//   Vector 0 [_Time]
//   Vector 64 [_WorldSpaceCameraPos] 3
//   ConstBuffer "UnityLighting" 720
//   Vector 0 [_WorldSpaceLightPos0]
//   Vector 608 [unity_SHAr]
//   Vector 624 [unity_SHAg]
//   Vector 640 [unity_SHAb]
//   Vector 656 [unity_SHBr]
//   Vector 672 [unity_SHBg]
//   Vector 688 [unity_SHBb]
//   Vector 704 [unity_SHC]
//   ConstBuffer "UnityPerDraw" 352
//   Matrix 192 [unity_ObjectToWorld]
//   ConstBuffer "UnityProbeVolume" 112
//   Vector 0 [unity_ProbeVolumeParams]
//   Vector 80 [unity_ProbeVolumeSizeInv] 3
//   Vector 96 [unity_ProbeVolumeMin] 3
//   Matrix 16 [unity_ProbeVolumeWorldToObject]
//   SetTexture 0 [_MainTex] 2D 5
//   SetTexture 1 [_FaceTex] 2D 1
//   SetTexture 2 [_OutlineTex] 2D 2
//   SetTexture 3 [_BumpMap] 2D 3
//   SetTexture 4 [_Cube] CUBE 4
//   SetTexture 5 [unity_ProbeVolumeSH] 3D 0
//   BindCB "$Globals" 0
//   BindCB "UnityPerCamera" 1
//   BindCB "UnityLighting" 2
//   BindCB "UnityPerDraw" 3
//   BindCB "UnityProbeVolume" 4
//
// 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:44 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   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
//
//
// 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[45], immediateIndexed
dcl_constantbuffer cb3[15], immediateIndexed
dcl_constantbuffer cb4[7], 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_texturecube (float,float,float,float) t4
dcl_resource_texture3d (float,float,float,float) t5
dcl_input_ps linear v1.xyzw
dcl_input_ps linear v2.xyzw
dcl_input_ps linear v3.xyzw
dcl_input_ps linear v4.xyzw
dcl_input_ps linear v5.xyzw
dcl_input_ps linear v6.xy
dcl_input_ps linear v7.xyz
dcl_input_ps linear v8.xyz
dcl_output o0.xyzw
dcl_temps 11
dcl_constantbuffer cb10[4], immediateIndexed

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

ld_indexable(texture2d)(float,float,float,float) r9.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 1b16e447f72f1bb5-ps.txt

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

mov r0.y, v2.w
mov r0.z, v3.w
mov r0.w, v4.w
add r1.xyz, -r0.yzwy, r10.xyzx
dp3 r0.x, r1.xyzx, r1.xyzx
rsq r0.x, r0.x
div r2.xy, l(1.000000, 1.000000, 1.000000, 1.000000), cb0[37].zwzz
mov r2.z, l(0)
add r3.xyzw, -r2.xzzy, v1.xyxy
sample r4.xyzw, r3.xyxx, t0.xyzw, s5
add r2.xyzw, r2.xzzy, v1.xyxy
sample r5.xyzw, r2.xyxx, t0.xyzw, s5
sample r3.xyzw, r3.zwzz, t0.xyzw, s5
sample r2.xyzw, r2.zwzz, t0.xyzw, s5
sample r6.xyzw, v1.xyxx, t0.xyzw, s5
add r1.w, -r6.w, l(0.500000)
add r1.w, r1.w, -v6.x
mad r1.w, r1.w, v6.y, l(0.500000)
mul r3.x, cb0[17].x, cb0[33].w
mul r3.y, cb0[15].y, cb0[33].w
mul r3.xz, r3.xxyx, v6.yyyy
mul r6.xyzw, v5.xyzw, cb0[14].xyzw
mul r4.x, v5.w, cb0[16].w
mad r4.yz, cb0[13].xxyx, cb1[0].yyyy, v1.zzwz
sample r7.xyzw, r4.yzyy, t1.xyzw, s1
mul r6.xyzw, r6.xyzw, r7.xyzw
mad r4.yz, cb0[15].zzwz, cb1[0].yyyy, v1.zzwz
sample r7.xyzw, r4.yzyy, t2.xyzw, s2
mul r5.xyz, r7.xyzx, cb0[16].xyzx
mul r7.w, r4.x, r7.w
mad r4.x, -r3.x, l(0.500000), r1.w
mad r3.z, r3.z, l(0.500000), r4.x
mad r3.y, r3.y, v6.y, l(1.000000)
div_sat r3.y, r3.z, r3.y
add r3.y, -r3.y, l(1.000000)
mad_sat r1.w, r3.x, l(0.500000), r1.w
min r3.x, r3.x, l(1.000000)
sqrt r3.x, r3.x
mul r3.x, r1.w, r3.x
mul r6.xyz, r6.wwww, r6.xyzx
mul r7.xyz, r5.xyzx, r7.wwww
add r7.xyzw, -r6.xyzw, r7.xyzw
mad r6.xyzw, r3.xxxx, r7.xyzw, r6.xyzw
mul r6.xyzw, r3.yyyy, r6.xyzw
max r3.x, r6.w, l(0.000100)
div r3.xyz, r6.xyzx, r3.xxxx
mul r4.x, cb0[33].x, l(0.500000)
ge r4.y, r4.x, -r4.x
frc r4.x, |r4.x|
movc r4.x, r4.y, r4.x, -r4.x
ge r4.x, r4.x, l(0.500000)
add r4.y, v6.x, cb0[17].z
mov r2.x, r4.w
mov r2.y, r5.w
mov r2.z, r3.w
add r2.xyzw, r4.yyyy, r2.xyzw
add r3.w, cb0[17].w, cb0[17].x
max r3.w, r3.w, l(0.010000)
add r2.xyzw, r2.xyzw, l(-0.500000, -0.500000, -0.500000, -0.500000)
div r2.xyzw, r2.xyzw, r3.wwww
add_sat r2.xyzw, r2.xyzw, l(0.500000, 0.500000, 0.500000, 0.500000)
mad r5.xyzw, r2.xyzw, l(2.000000, 2.000000, 2.000000, 2.000000), l(-1.000000, -1.000000, -1.000000, -1.000000)
add r5.xyzw, -|r5.xyzw|, l(1.000000, 1.000000, 1.000000, 1.000000)
movc r2.xyzw, r4.xxxx, r5.xyzw, r2.xyzw
mul r4.xyzw, r2.xyzw, l(1.570796, 1.570796, 1.570796, 1.570796)
sincos r4.xyzw, null, r4.xyzw
add r4.xyzw, -r2.xyzw, r4.xyzw
mad r2.xyzw, cb0[18].yyyy, r4.xyzw, r2.xyzw
add r4.x, -cb0[18].x, l(1.000000)
min r2.xyzw, r2.xyzw, r4.xxxx
mul r3.w, r3.w, cb0[17].y
mul r3.w, r3.w, cb0[38].x
mul r3.w, r3.w, l(-2.000000)
mul r2.xz, r2.xxzx, r3.wwww
mad r2.yz, r2.wwyw, r3.wwww, -r2.zzxz
mov r2.xw, l(-1.000000,0,0,1.000000)
dp2 r2.w, r2.zwzz, r2.zwzz
rsq r2.w, r2.w
mul r4.yz, r2.wwww, l(0.000000, 1.000000, 0.000000, 0.000000)
mul r4.x, r2.w, r2.z
dp2 r2.w, r2.xyxx, r2.xyxx
rsq r2.w, r2.w
mov r2.z, l(0)
mul r2.xyz, r2.wwww, r2.xyzx
mul r5.xyz, r2.xyzx, r4.xyzx
mad r2.xyz, r4.zxyz, r2.yzxy, -r5.xyzx
sample r4.xyzw, v1.zwzz, t3.xyzw, s3
mad r4.xy, r4.wyww, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r2.w, r4.xyxx, r4.xyxx
min r2.w, r2.w, l(1.000000)
add r2.w, -r2.w, l(1.000000)
sqrt r4.z, r2.w
add r2.w, -cb0[18].w, cb0[18].z
mad r2.w, r1.w, r2.w, cb0[18].w
mad r4.xyz, r4.xyzx, r2.wwww, l(-0.000000, -0.000000, -1.000000, 0.000000)
mad r4.xyz, r6.wwww, r4.xyzx, l(0.000000, 0.000000, 1.000000, 0.000000)
add r2.xyz, r2.xyzx, -r4.xyzx
dp3 r2.w, r2.xyzx, r2.xyzx
rsq r2.w, r2.w
mul r2.xyz, r2.wwww, r2.xyzx
mul r4.xyz, r2.yyyy, cb3[13].xyzx
mad r4.xyz, cb3[12].xyzx, r2.xxxx, r4.xyzx
mad r4.xyz, cb3[14].xyzx, r2.zzzz, r4.xyzx
dp3 r2.w, v7.xyzx, r4.xyzx
add r2.w, r2.w, r2.w
mad r4.xyz, r4.xyzx, -r2.wwww, v7.xyzx
sample r4.xyzw, r4.xyzx, t4.xyzw, s4
add r5.xyz, -cb0[19].xyzx, cb0[20].xyzx
mad r5.xyz, r1.wwww, r5.xyzx, cb0[19].xyzx
mul r4.xyz, r4.xyzx, r5.xyzx
add r2.w, -cb0[39].x, cb0[39].y
mad r1.w, r1.w, r2.w, cb0[39].x
dp3 r5.x, v2.xyzx, -r2.xyzx
dp3 r5.y, v3.xyzx, -r2.xyzx
dp3 r5.z, v4.xyzx, -r2.xyzx
eq r2.x, cb4[0].x, l(1.000000)
if_nz r2.x
  eq r2.x, cb4[0].y, l(1.000000)
  mul r2.yzw, v3.wwww, cb4[2].xxyz
  mad r2.yzw, cb4[1].xxyz, v2.wwww, r2.yyzw
  mad r2.yzw, cb4[3].xxyz, v4.wwww, r2.yyzw
  add r2.yzw, r2.yyzw, cb4[4].xxyz
  movc r0.yzw, r2.xxxx, r2.yyzw, r0.yyzw
  add r0.yzw, r0.yyzw, -cb4[6].xxyz
  mul r2.yzw, r0.yyzw, cb4[5].xxyz
  mul r0.y, r2.y, l(0.250000)
  mul r0.z, cb4[0].z, l(0.500000)
  mad r0.w, -cb4[0].z, l(0.500000), l(0.250000)
  max r0.y, r0.z, r0.y
  min r2.x, r0.w, r0.y
  sample r7.xyzw, r2.xzwx, t5.xyzw, s0
  add r0.yzw, r2.xxzw, l(0.000000, 0.250000, 0.000000, 0.000000)
  sample r8.xyzw, r0.yzwy, t5.xyzw, s0
  add r0.yzw, r2.xxzw, l(0.000000, 0.500000, 0.000000, 0.000000)
  sample r2.xyzw, r0.yzwy, t5.xyzw, s0
  mov r5.w, l(1.000000)
  dp4 r6.x, r7.xyzw, r5.xyzw
  dp4 r6.y, r8.xyzw, r5.xyzw
  dp4 r6.z, r2.xyzw, r5.xyzw
else
  mov r5.w, l(1.000000)
  dp4 r2.x, cb2[38].xyzw, r5.xyzw
  dp4 r2.y, cb2[39].xyzw, r5.xyzw
  dp4 r2.z, cb2[40].xyzw, r5.xyzw
  mul r7.xyzw, r5.yzzx, r5.xyzz
  dp4 r8.x, cb2[41].xyzw, r7.xyzw
  dp4 r8.y, cb2[42].xyzw, r7.xyzw
  dp4 r8.z, cb2[43].xyzw, r7.xyzw
  mul r0.y, r5.y, r5.y
  mad r0.y, r5.x, r5.x, -r0.y
  mad r0.yzw, cb2[44].xxyz, r0.yyyy, r8.xxyz
  add r6.xyz, r0.yzwy, r2.xyzx
endif
add r0.yzw, r6.xxyz, v8.xxyz
max r0.yzw, r0.yyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
eq r2.x, cb0[3].w, l(0.000000)
log r2.yzw, r0.yyzw
mul r2.yzw, r2.yyzw, l(0.000000, 0.416666657, 0.416666657, 0.416666657)
exp r2.yzw, r2.yyzw
mad r2.yzw, r2.yyzw, l(0.000000, 1.055000, 1.055000, 1.055000), l(0.000000, -0.055000, -0.055000, -0.055000)
max r2.yzw, r2.yyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
movc r0.yzw, r2.xxxx, r2.yyzw, r0.yyzw
mad r1.xyz, r1.xyzx, r0.xxxx, cb2[0].xyzx
dp3 r0.x, r1.xyzx, r1.xyzx
rsq r0.x, r0.x
mul r1.xyz, r0.xxxx, r1.xyzx
dp3 r0.x, r5.xyzx, cb2[0].xyzx
max r0.x, r0.x, l(0.000000)
dp3 r1.x, r5.xyzx, r1.xyzx
max r1.x, r1.x, l(0.000000)
mul r1.y, r1.w, l(128.000000)
log r1.x, r1.x
mul r1.x, r1.x, r1.y
exp r1.x, r1.x
mul r1.yzw, r3.xxyz, cb0[6].xxyz
mul r2.xyz, cb0[6].xyzx, cb0[7].xyzx
mul r2.xyz, r1.xxxx, r2.xyzx
mad r1.xyz, r1.yzwy, r0.xxxx, r2.xyzx
mad r0.xyz, r3.xyzx, r0.yzwy, r1.xyzx
mad o0.xyz, r4.xyzx, r6.wwww, r0.xyzx
mov o0.w, r6.w
ret
// Approximately 0 instruction slots used