// asmtool.py -I ../.. --fix-unity-reflection --only-autofixed 0db3e725a3f4d656-ps.txt
// 3DMigoto: 0db3e725a3f4d656 |    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 130 11 2
//   undeciphered1a: 8
//   Keywords { "SPOT" }
//   undeciphered2: 1 7 4 7 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 6
//   SetTexture 1 [_FaceTex] 2D 3
//   SetTexture 2 [_OutlineTex] 2D 4
//   SetTexture 3 [_BumpMap] 2D 5
//   SetTexture 4 [_LightTexture0] 2D 1
//   SetTexture 5 [_LightTextureB0] 2D 2
//   SetTexture 6 [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:49 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_sampler s6, 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_resource_texture3d (float,float,float,float) t6
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 10
dcl_constantbuffer cb10[4], immediateIndexed

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

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

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

add r0.xyz, -v6.xyzx, cb2[0].xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
add r1.xyz, -v6.xyzx, r9.xyzx
dp3 r0.w, r1.xyzx, r1.xyzx
rsq r0.w, r0.w
div r2.xy, l(1.000000, 1.000000, 1.000000, 1.000000), cb0[97].zwzz
mov r2.z, l(0)
add r3.xyzw, -r2.xzzy, v1.xyxy
sample r4.xyzw, r3.xyxx, t0.xyzw, s6
add r2.xyzw, r2.xzzy, v1.xyxy
sample r5.xyzw, r2.xyxx, t0.xyzw, s6
sample r3.xyzw, r3.zwzz, t0.xyzw, s6
sample r2.xyzw, r2.zwzz, t0.xyzw, s6
sample r6.xyzw, v1.xyxx, t0.xyzw, s6
add r1.w, -r6.w, l(0.500000)
add r1.w, r1.w, -v2.z
mad r1.w, r1.w, v2.w, l(0.500000)
mul r3.x, cb0[76].x, cb0[92].w
mul r3.y, cb0[74].y, cb0[92].w
mul r3.xz, r3.xxyx, v2.wwww
mul r6.xyzw, v7.xyzw, cb0[73].xyzw
mul r4.x, v7.w, cb0[75].w
mad r4.yz, cb0[72].xxyx, cb1[0].yyyy, v1.zzwz
sample r7.xyzw, r4.yzyy, t1.xyzw, s3
mul r6.xyzw, r6.xyzw, r7.xyzw
mad r4.yz, cb0[74].zzwz, cb1[0].yyyy, v2.xxyx
sample r7.xyzw, r4.yzyy, t2.xyzw, s4
mul r5.xyz, r7.xyzx, cb0[75].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, v2.w, 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[92].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, v2.z, cb0[76].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[76].w, cb0[76].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[77].yyyy, r4.xyzw, r2.xyzw
add r4.x, -cb0[77].x, l(1.000000)
min r2.xyzw, r2.xyzw, r4.xxxx
mul r3.w, r3.w, cb0[76].y
mul r3.w, r3.w, cb0[98].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, s5
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[77].w, cb0[77].z
mad r2.w, r1.w, r2.w, cb0[77].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
add r2.w, -cb0[99].x, cb0[99].y
mad r1.w, r1.w, r2.w, cb0[99].x
mul r4.xyzw, v6.yyyy, cb0[69].xyzw
mad r4.xyzw, cb0[68].xyzw, v6.xxxx, r4.xyzw
mad r4.xyzw, cb0[70].xyzw, v6.zzzz, r4.xyzw
add r4.xyzw, r4.xyzw, cb0[71].xyzw
eq r2.w, cb3[0].x, l(1.000000)
if_nz r2.w
  eq r2.w, cb3[0].y, l(1.000000)
  mul r5.xyz, v6.yyyy, cb3[2].xyzx
  mad r5.xyz, cb3[1].xyzx, v6.xxxx, r5.xyzx
  mad r5.xyz, cb3[3].xyzx, v6.zzzz, r5.xyzx
  add r5.xyz, r5.xyzx, cb3[4].xyzx
  movc r5.xyz, r2.wwww, r5.xyzx, v6.xyzx
  add r5.xyz, r5.xyzx, -cb3[6].xyzx
  mul r5.yzw, r5.xxyz, cb3[5].xxyz
  mad r2.w, r5.y, l(0.250000), l(0.750000)
  mad r3.w, cb3[0].z, l(0.500000), l(0.750000)
  max r5.x, r2.w, r3.w
  sample r5.xyzw, r5.xzwx, t6.xyzw, s0
else
  mov r5.xyzw, l(1.000000,1.000000,1.000000,1.000000)
endif
dp4_sat r2.w, r5.xyzw, cb2[45].xyzw
lt r3.w, l(0.000000), r4.z
and r3.w, r3.w, l(0x3f800000)
div r5.xy, r4.xyxx, r4.wwww
add r5.xy, r5.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000)
sample r5.xyzw, r5.xyxx, t4.xyzw, s1
mul r3.w, r3.w, r5.w
dp3 r4.x, r4.xyzx, r4.xyzx
sample r4.xyzw, r4.xxxx, t5.xyzw, s2
mul r3.w, r3.w, r4.x
mul r2.w, r2.w, r3.w
dp3 r4.x, v3.xyzx, -r2.xyzx
dp3 r4.y, v4.xyzx, -r2.xyzx
dp3 r4.z, v5.xyzx, -r2.xyzx
mul r2.xyz, r2.wwww, cb0[2].xyzx
mad r1.xyz, r1.xyzx, r0.wwww, r0.xyzx
dp3 r0.w, r1.xyzx, r1.xyzx
rsq r0.w, r0.w
mul r1.xyz, r0.wwww, r1.xyzx
dp3 r0.x, r4.xyzx, r0.xyzx
dp3 r0.y, r4.xyzx, r1.xyzx
max r0.xy, r0.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000)
mul r0.z, r1.w, l(128.000000)
log r0.y, r0.y
mul r0.y, r0.y, r0.z
exp r0.y, r0.y
mul r1.xyz, r2.xyzx, r3.xyzx
mul r2.xyz, r2.xyzx, cb0[3].xyzx
mul r0.yzw, r0.yyyy, r2.xxyz
mad o0.xyz, r1.xyzx, r0.xxxx, r0.yzwy
mov o0.w, r6.w
ret
// Approximately 0 instruction slots used