// asmtool.py -I ../.. --fix-unity-reflection --only-autofixed 0f8dfc920670e8d6-ps.txt
// 3DMigoto: 0f8dfc920670e8d6 |    Unity headers extracted from TextMeshPro_Distance Field (Surface)
//    Shader "TextMeshPro/Distance Field (Surface)" {
//      CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI"
//      SubShader 1/1 {
//        LOD 300
//        Tags { "IGNOREPROJECTOR"="true" "QUEUE"="Transparent" "RenderType"="Transparent" }
//        Pass 2/3 {
//          Name "FORWARD"
//          Tags { "IGNOREPROJECTOR"="true" "LIGHTMODE"="FORWARDADD" "QUEUE"="Transparent" "RenderType"="Transparent" }
//          ZWrite Off
//          Program "fp" {
//            SubProgram "d3d11" {
//            }
//          }
//        }
//      }
//    }
//
// Unity 5.3 headers extracted from TextMeshPro_Distance Field (Surface):
//   API d3d11
//   Shader model ps_4_0
//   undeciphered1: 201609010 120 10 2
//   undeciphered1a: 7
//   Keywords { "DIRECTIONAL_COOKIE" }
//   undeciphered2: 1 6 4 6 0 0
//   undeciphered3: 0 0
//   ConstBuffer "$Globals" 1648
//   Vector 32 [_LightColor0]
//   Vector 48 [_SpecColor]
//   Float 1152 [_FaceUVSpeedX]
//   Float 1156 [_FaceUVSpeedY]
//   Vector 1168 [_FaceColor]
//   Float 1188 [_OutlineSoftness]
//   Float 1192 [_OutlineUVSpeedX]
//   Float 1196 [_OutlineUVSpeedY]
//   Vector 1200 [_OutlineColor]
//   Float 1216 [_OutlineWidth]
//   Float 1220 [_Bevel]
//   Float 1224 [_BevelOffset]
//   Float 1228 [_BevelWidth]
//   Float 1232 [_BevelClamp]
//   Float 1236 [_BevelRoundness]
//   Float 1240 [_BumpOutline]
//   Float 1244 [_BumpFace]
//   Float 1472 [_ShaderFlags]
//   Float 1484 [_ScaleRatioA]
//   Float 1560 [_TextureWidth]
//   Float 1564 [_TextureHeight]
//   Float 1568 [_GradientScale]
//   Float 1584 [_FaceShininess]
//   Float 1588 [_OutlineShininess]
//   Matrix 1088 [unity_WorldToLight]
//   ConstBuffer "UnityPerCamera" 144
//   Vector 0 [_Time]
//   Vector 64 [_WorldSpaceCameraPos] 3
//   ConstBuffer "UnityLighting" 752
//   Vector 0 [_WorldSpaceLightPos0]
//   Vector 720 [unity_OcclusionMaskSelector]
//   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 2
//   SetTexture 2 [_OutlineTex] 2D 3
//   SetTexture 3 [_BumpMap] 2D 4
//   SetTexture 4 [_LightTexture0] 2D 1
//   SetTexture 5 [unity_ProbeVolumeSH] 3D 0
//   BindCB "$Globals" 0
//   BindCB "UnityPerCamera" 1
//   BindCB "UnityLighting" 2
//   BindCB "UnityProbeVolume" 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 17:51:57 2019
//
//
// 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   xy          2     NONE   float   xy
// TEXCOORD                 6     zw        2     NONE   float     zw
// TEXCOORD                 2   xyz         3     NONE   float   xyz
// TEXCOORD                 3   xyz         4     NONE   float   xyz
// TEXCOORD                 4   xyz         5     NONE   float   xyz
// TEXCOORD                 5   xyz         6     NONE   float   xyz
// COLOR                    0   xyzw        7     NONE   float   xyzw
// TEXCOORD                 7   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[100], immediateIndexed
dcl_constantbuffer cb1[9], immediateIndexed
dcl_constantbuffer cb2[46], immediateIndexed
dcl_constantbuffer cb3[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_texture2d (float,float,float,float) t4
dcl_resource_texture3d (float,float,float,float) t5
dcl_input_ps linear v1.xyzw
dcl_input_ps linear v2.xy
dcl_input_ps linear v2.zw
dcl_input_ps linear v3.xyz
dcl_input_ps linear v4.xyz
dcl_input_ps linear v5.xyz
dcl_input_ps linear v6.xyz
dcl_input_ps linear v7.xyzw
dcl_output o0.xyzw
dcl_temps 9
dcl_constantbuffer cb10[4], immediateIndexed

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

ld_indexable(texture2d)(float,float,float,float) r7.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 0f8dfc920670e8d6-ps.txt

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

add r0.xyz, -v6.xyzx, r8.xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
div r1.xy, l(1.000000, 1.000000, 1.000000, 1.000000), cb0[97].zwzz
mov r1.z, l(0)
add r2.xyzw, -r1.xzzy, v1.xyxy
sample r3.xyzw, r2.xyxx, t0.xyzw, s5
add r1.xyzw, r1.xzzy, v1.xyxy
sample r4.xyzw, r1.xyxx, t0.xyzw, s5
sample r2.xyzw, r2.zwzz, t0.xyzw, s5
sample r1.xyzw, r1.zwzz, t0.xyzw, s5
sample r5.xyzw, v1.xyxx, t0.xyzw, s5
add r2.x, -r5.w, l(0.500000)
add r2.x, r2.x, -v2.z
mad r2.x, r2.x, v2.w, l(0.500000)
mul r2.y, cb0[76].x, cb0[92].w
mul r2.y, r2.y, v2.w
mul r2.z, cb0[74].y, cb0[92].w
mul r3.x, r2.z, v2.w
mul r5.xyzw, v7.xyzw, cb0[73].xyzw
mul r3.y, v7.w, cb0[75].w
mad r4.xy, cb0[72].xyxx, cb1[0].yyyy, v1.zwzz
sample r6.xyzw, r4.xyxx, t1.xyzw, s2
mul r5.xyzw, r5.xyzw, r6.xyzw
mad r4.xy, cb0[74].zwzz, cb1[0].yyyy, v2.xyxx
sample r6.xyzw, r4.xyxx, t2.xyzw, s3
mul r4.xyz, r6.xyzx, cb0[75].xyzx
mul r6.w, r3.y, r6.w
mad r3.y, -r2.y, l(0.500000), r2.x
mad r3.x, r3.x, l(0.500000), r3.y
mad r2.z, r2.z, v2.w, l(1.000000)
div_sat r2.z, r3.x, r2.z
add r2.z, -r2.z, l(1.000000)
mad_sat r2.x, r2.y, l(0.500000), r2.x
min r2.y, r2.y, l(1.000000)
sqrt r2.y, r2.y
mul r2.y, r2.y, r2.x
mul r5.xyz, r5.wwww, r5.xyzx
mul r6.xyz, r4.xyzx, r6.wwww
add r6.xyzw, -r5.xyzw, r6.xyzw
mad r5.xyzw, r2.yyyy, r6.xyzw, r5.xyzw
mul r5.xyzw, r2.zzzz, r5.xyzw
max r2.y, r5.w, l(0.000100)
div r3.xyz, r5.xyzx, r2.yyyy
mul r2.y, cb0[92].x, l(0.500000)
ge r2.z, r2.y, -r2.y
frc r2.y, |r2.y|
movc r2.y, r2.z, r2.y, -r2.y
ge r2.y, r2.y, l(0.500000)
add r2.z, v2.z, cb0[76].z
mov r1.x, r3.w
mov r1.y, r4.w
mov r1.z, r2.w
add r1.xyzw, r2.zzzz, r1.xyzw
add r2.z, cb0[76].w, cb0[76].x
max r2.z, r2.z, l(0.010000)
add r1.xyzw, r1.xyzw, l(-0.500000, -0.500000, -0.500000, -0.500000)
div r1.xyzw, r1.xyzw, r2.zzzz
add_sat r1.xyzw, r1.xyzw, l(0.500000, 0.500000, 0.500000, 0.500000)
mad r4.xyzw, r1.xyzw, l(2.000000, 2.000000, 2.000000, 2.000000), l(-1.000000, -1.000000, -1.000000, -1.000000)
add r4.xyzw, -|r4.xyzw|, l(1.000000, 1.000000, 1.000000, 1.000000)
movc r1.xyzw, r2.yyyy, r4.xyzw, r1.xyzw
mul r4.xyzw, r1.xyzw, l(1.570796, 1.570796, 1.570796, 1.570796)
sincos r4.xyzw, null, r4.xyzw
add r4.xyzw, -r1.xyzw, r4.xyzw
mad r1.xyzw, cb0[77].yyyy, r4.xyzw, r1.xyzw
add r2.y, -cb0[77].x, l(1.000000)
min r1.xyzw, r1.xyzw, r2.yyyy
mul r2.y, r2.z, cb0[76].y
mul r2.y, r2.y, cb0[98].x
mul r2.y, r2.y, l(-2.000000)
mul r1.xz, r1.xxzx, r2.yyyy
mad r1.yz, r1.wwyw, r2.yyyy, -r1.zzxz
mov r1.xw, l(-1.000000,0,0,1.000000)
dp2 r1.w, r1.zwzz, r1.zwzz
rsq r1.w, r1.w
mul r4.yz, r1.wwww, l(0.000000, 1.000000, 0.000000, 0.000000)
mul r4.x, r1.w, r1.z
dp2 r1.w, r1.xyxx, r1.xyxx
rsq r1.w, r1.w
mov r1.z, l(0)
mul r1.xyz, r1.wwww, r1.xyzx
mul r2.yzw, r1.xxyz, r4.xxyz
mad r1.xyz, r4.zxyz, r1.yzxy, -r2.yzwy
sample r4.xyzw, v1.zwzz, t3.xyzw, s4
mad r4.xy, r4.wyww, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r1.w, r4.xyxx, r4.xyxx
min r1.w, r1.w, l(1.000000)
add r1.w, -r1.w, l(1.000000)
sqrt r4.z, r1.w
add r1.w, -cb0[77].w, cb0[77].z
mad r1.w, r2.x, r1.w, cb0[77].w
mad r2.yzw, r4.xxyz, r1.wwww, l(0.000000, -0.000000, -0.000000, -1.000000)
mad r2.yzw, r5.wwww, r2.yyzw, l(0.000000, 0.000000, 0.000000, 1.000000)
add r1.xyz, r1.xyzx, -r2.yzwy
dp3 r1.w, r1.xyzx, r1.xyzx
rsq r1.w, r1.w
mul r1.xyz, r1.wwww, r1.xyzx
add r1.w, -cb0[99].x, cb0[99].y
mad r1.w, r2.x, r1.w, cb0[99].x
mul r2.xy, v6.yyyy, cb0[69].xyxx
mad r2.xy, cb0[68].xyxx, v6.xxxx, r2.xyxx
mad r2.xy, cb0[70].xyxx, v6.zzzz, r2.xyxx
add r2.xy, r2.xyxx, cb0[71].xyxx
eq r2.z, cb3[0].x, l(1.000000)
if_nz r2.z
  eq r2.z, cb3[0].y, l(1.000000)
  mul r4.xyz, v6.yyyy, cb3[2].xyzx
  mad r4.xyz, cb3[1].xyzx, v6.xxxx, r4.xyzx
  mad r4.xyz, cb3[3].xyzx, v6.zzzz, r4.xyzx
  add r4.xyz, r4.xyzx, cb3[4].xyzx
  movc r4.xyz, r2.zzzz, r4.xyzx, v6.xyzx
  add r4.xyz, r4.xyzx, -cb3[6].xyzx
  mul r4.yzw, r4.xxyz, cb3[5].xxyz
  mad r2.z, r4.y, l(0.250000), l(0.750000)
  mad r2.w, cb3[0].z, l(0.500000), l(0.750000)
  max r4.x, r2.w, r2.z
  sample r4.xyzw, r4.xzwx, t5.xyzw, s0
else
  mov r4.xyzw, l(1.000000,1.000000,1.000000,1.000000)
endif
dp4_sat r2.z, r4.xyzw, cb2[45].xyzw
sample r4.xyzw, r2.xyxx, t4.xyzw, s1
mul r2.x, r2.z, r4.w
dp3 r4.x, v3.xyzx, -r1.xyzx
dp3 r4.y, v4.xyzx, -r1.xyzx
dp3 r4.z, v5.xyzx, -r1.xyzx
mul r1.xyz, r2.xxxx, cb0[2].xyzx
mad r0.xyz, r0.xyzx, r0.wwww, cb2[0].xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
dp3 r0.w, r4.xyzx, cb2[0].xyzx
dp3 r0.x, r4.xyzx, r0.xyzx
max r0.xw, r0.xxxw, l(0.000000, 0.000000, 0.000000, 0.000000)
mul r0.y, r1.w, l(128.000000)
log r0.x, r0.x
mul r0.x, r0.x, r0.y
exp r0.x, r0.x
mul r2.xyz, r1.xyzx, r3.xyzx
mul r1.xyz, r1.xyzx, cb0[3].xyzx
mul r0.xyz, r0.xxxx, r1.xyzx
mad o0.xyz, r2.xyzx, r0.wwww, r0.xyzx
mov o0.w, r5.w
ret
// Approximately 0 instruction slots used