// asmtool.py -I ../.. --fix-unity-reflection --only-autofixed 7906a0c303a01415-ps.txt
// 3DMigoto: 7906a0c303a01415 |    Unity headers extracted from VolumetricFogAndMist_VolumetricFog
//    Shader "VolumetricFogAndMist/VolumetricFog" {
//      SubShader 1/1 {
//        Pass 2/5 {
//          ZWrite Off
//          Program "fp" {
//            SubProgram "d3d11" {
//            }
//          }
//        }
//      }
//    }
//
// Unity 5.3 headers extracted from VolumetricFogAndMist_VolumetricFog:
//   API d3d11
//   Shader model ps_4_0
//   undeciphered1: 201609010 122 2 10
//   undeciphered1a: 21
//   Keywords { "FOG_POINT_LIGHT3" }
//   undeciphered2: 1 2 2 2 0 0
//   undeciphered3: 0 0
//   ConstBuffer "$Globals" 512
//   Vector 64 [_CameraDepthTexture_TexelSize]
//   Float 172 [_FogAlpha]
//   Vector 176 [_Color] 3
//   Vector 192 [_FogDistance]
//   Vector 208 [_FogData]
//   Vector 224 [_FogWindDir] 3
//   Vector 240 [_FogStepping]
//   Vector 272 [_FogPointLightPosition0] 3
//   Vector 288 [_FogPointLightColor0] 3
//   Vector 304 [_FogPointLightPosition1] 3
//   Vector 320 [_FogPointLightColor1] 3
//   Vector 336 [_FogPointLightPosition2] 3
//   Vector 352 [_FogPointLightColor2] 3
//   Vector 368 [_FogPointLightPosition3] 3
//   Vector 384 [_FogPointLightColor3] 3
//   Vector 416 [_SunDir] 3
//   Vector 432 [_SunColor] 3
//   Vector 464 [_FogScatteringData2]
//   ConstBuffer "UnityPerCamera" 144
//   Vector 64 [_WorldSpaceCameraPos] 3
//   Vector 112 [_ZBufferParams]
//   SetTexture 0 [_CameraDepthTexture] 2D 1
//   SetTexture 1 [_NoiseTex] 2D 0
//   BindCB "$Globals" 0
//   BindCB "UnityPerCamera" 1
//
// 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:57:38 2019
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float
// TEXCOORD                 0   xy          1     NONE   float
// TEXCOORD                 1     zw        1     NONE   float     zw
// TEXCOORD                 2   xyz         2     NONE   float   xyz
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
// SV_Target                1   xyzw        1   TARGET   float   xyzw
//
ps_4_0
dcl_constantbuffer cb0[30], immediateIndexed
dcl_constantbuffer cb1[9], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_input_ps linear v1.zw
dcl_input_ps linear v2.xyz
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_temps 23
dcl_constantbuffer cb10[4], immediateIndexed

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

ld_indexable(texture2d)(float,float,float,float) r21.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 7906a0c303a01415-ps.txt

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

mad r0.xyzw, cb0[4].xyxy, l(0.000000, -0.750000, 0.000000, 0.750000), v1.zwzw
sample r1.xyzw, r0.xyxx, t0.xyzw, s1
sample r0.xyzw, r0.zwzz, t0.xyzw, s1
max r0.xyzw, r0.xxxx, r1.xxxx
mad r1.x, cb1[7].x, r0.w, cb1[7].y
div r1.x, l(1.000000, 1.000000, 1.000000, 1.000000), r1.x
mov r1.yz, -cb0[13].xxyx
add r2.y, r1.y, r22.y
mov r2.xz, r22.xxzx
mad r3.xyz, v2.xyzx, r1.xxxx, r2.xyzx
add r1.x, r3.y, l(0.000010)
lt r1.y, cb0[13].y, r2.y
lt r1.w, cb0[13].y, r1.x
and r1.y, r1.w, r1.y
lt r1.w, r2.y, r1.z
lt r2.w, r1.x, r1.z
and r1.w, r1.w, r2.w
or r1.y, r1.w, r1.y
if_z r1.y
  add r3.w, r3.y, l(0.000010)
  add r3.xyz, -r2.xyzx, r3.xwzx
  dp3 r1.y, r3.xyzx, r3.xyzx
  dp2 r1.w, r3.xzxx, r3.xzxx
  sqrt r1.yw, r1.yyyw
  div r4.xy, r3.xzxx, r1.wwww
  div r1.w, r1.w, r3.y
  max r2.w, r1.z, r2.y
  min r5.y, r2.w, cb0[13].y
  add r2.w, r2.y, -r5.y
  mul r2.w, r1.w, r2.w
  mad r5.xz, -r4.xxyx, r2.wwww, r22.xxzx
  min r2.w, r1.y, cb0[12].z
  add r6.xyz, -r2.xyzx, r5.xyzx
  dp3 r2.x, r6.xyzx, r6.xyzx
  sqrt r2.x, r2.x
  lt r2.z, r2.x, r2.w
  if_nz r2.z
    lt r2.z, l(0.000000), r1.w
    lt r3.w, l(-0.500000), r1.x
    and r2.z, r2.z, r3.w
    lt r3.w, r1.w, l(0.000000)
    lt r1.x, r1.x, l(0.500000)
    and r1.x, r1.x, r3.w
    and r1.x, r1.z, r1.x
    movc r6.y, r2.z, cb0[13].y, r1.x
    add r1.x, -r2.y, r6.y
    mul r1.x, r1.x, r1.w
    mad r6.xz, -r4.xxyx, r1.xxxx, r22.xxzx
    add r1.xzw, r5.xxyz, -r6.xxyz
    dp3 r1.x, r1.xzwx, r1.xzwx
    sqrt r1.x, r1.x
    add r1.z, -r2.x, r2.w
    min r1.x, r1.z, r1.x
    lt r1.w, l(0.000000), r1.x
    if_nz r1.w
      log r1.w, r1.x
      mul r1.w, r1.w, l(0.693147182)
      max r1.w, r1.w, l(0.000000)
      mad r1.w, r1.w, cb0[15].x, l(0.100000)
      mul r1.w, r1.w, cb0[13].z
      mul_sat r2.y, r2.w, cb0[15].y
      mul r1.w, r1.w, r2.y
      max r1.w, r1.w, l(0.010000)
      mul r2.yzw, r1.wwww, r3.xxyz
      div r2.yzw, r2.yyzw, r1.yyyy
      div r1.w, r1.x, r1.w
      add r4.xyz, r5.xyzx, -cb0[17].xyzx
      add r6.xyz, r5.xyzx, -cb0[19].xyzx
      add r7.xyz, r5.xyzx, -cb0[21].xyzx
      add r8.xyz, r5.xyzx, -cb0[23].xyzx
      mul r9.xz, r2.yywy, cb0[13].wwww
      mul r3.w, cb0[13].z, cb0[13].y
      div r9.y, r2.z, r3.w
      add r5.xz, r5.xxzx, cb0[14].xxzx
      mul r5.xz, r5.xxzx, cb0[13].wwww
      div r3.w, r5.y, r3.w
      ge r1.x, r1.x, r1.z
      mov r10.xyzw, l(0,0,0,0)
      mov r11.xyz, r4.xyzx
      mov r12.xyz, r6.xyzx
      mov r13.xyz, r7.xyzx
      mov r14.xyz, r8.xyzx
      mov r16.xz, r5.xxzx
      mov r1.z, r1.w
      mov r16.y, r3.w
      mov r15.xyzw, l(0,0,0,0)
      loop
        ge r4.w, l(1.000000), r1.z
        breakc_nz r4.w
        sample_l r17.xyzw, r16.xzxx, t1.xyzw, s0, l(0.000000)
        add r4.w, -|r16.y|, r17.w
        lt r5.y, l(0.000000), r4.w
        if_nz r5.y
          add r5.y, -r4.w, l(1.000000)
          mul r18.xyz, r5.yyyy, cb0[11].xyzx
          mul r19.w, r4.w, l(0.400000)
          dp3 r4.w, r11.xyzx, r11.xyzx
          div r4.w, l(1.000000, 1.000000, 1.000000, 1.000000), r4.w
          dp3 r5.y, r12.xyzx, r12.xyzx
          div r5.y, l(1.000000, 1.000000, 1.000000, 1.000000), r5.y
          dp3 r5.w, r13.xyzx, r13.xyzx
          div r5.w, l(1.000000, 1.000000, 1.000000, 1.000000), r5.w
          dp3 r6.w, r14.xyzx, r14.xyzx
          div r6.w, l(1.000000, 1.000000, 1.000000, 1.000000), r6.w
          mul r20.xyz, r5.wwww, cb0[22].xyzx
          mad r20.xyz, cb0[24].xyzx, r6.wwww, r20.xyzx
          mad r20.xyz, cb0[20].xyzx, r5.yyyy, r20.xyzx
          mad r20.xyz, cb0[18].xyzx, r4.wwww, r20.xyzx
          mad r17.xyz, r20.xyzx, r19.wwww, r17.xyzx
          mul r17.xyz, r19.wwww, r17.xyzx
          mul r19.xyz, r17.xyzx, r18.xyzx
          add r4.w, -r15.w, l(1.000000)
          mad r17.xyzw, r19.xyzw, r4.wwww, r15.xyzw
          lt r4.w, l(0.990000), r17.w
          if_nz r4.w
            mov r10.xyzw, r19.xyzw
            mov r15.xyzw, r17.xyzw
            break
          endif
          mov r10.xyzw, r19.xyzw
          mov r15.xyzw, r17.xyzw
        endif
        add r11.xyz, r2.yzwy, r11.xyzx
        add r12.xyz, r2.yzwy, r12.xyzx
        add r13.xyz, r2.yzwy, r13.xyzx
        add r14.xyz, r2.yzwy, r14.xyzx
        add r1.z, r1.z, l(-1.000000)
        add r16.xyz, r9.xyzx, r16.xyzx
      endloop
      lt r1.w, r15.w, l(0.990000)
      and r1.xw, r1.xxxw, l(0x3f800000, 0, 0, 0x3f800000)
      add r2.y, -r15.w, l(1.000000)
      mul r1.x, r1.z, r1.x
      mul r1.z, r1.w, r2.y
      mul r1.x, r1.x, r1.z
      mad r4.xyzw, r10.xyzw, r1.xxxx, r15.xyzw
      div r1.xyz, r3.xyzx, r1.yyyy
      dp3 r1.x, r1.xyzx, cb0[26].xyzx
      mul r1.x, r1.x, cb0[29].w
      max r1.x, r1.x, l(0.000000)
      mul r1.x, r1.x, r1.x
      mul r1.x, r1.x, r1.x
      mul r1.x, r1.x, r1.x
      mul r1.x, r4.w, r1.x
      add r1.yzw, -r4.xxyz, cb0[27].xxyz
      mad r4.xyz, r1.xxxx, r1.yzwy, r4.xyzx
      mul r1.xyzw, r4.xyzw, cb0[10].wwww
      add r2.x, -r2.x, cb0[12].z
      div_sat r2.x, r2.x, cb0[12].w
      mul r2.x, r2.x, r2.x
      mul o0.xyzw, r1.xyzw, r2.xxxx
    else
      mov o0.xyzw, l(0,0,0,0)
    endif
  else
    mov o0.xyzw, l(0,0,0,0)
  endif
else
  mov o0.xyzw, l(0,0,0,0)
endif
mov o1.xyzw, r0.xyzw
ret
// Approximately 0 instruction slots used