// 3DMigoto: 24e8dfc72e18a620 |    Unity headers extracted from AmbientOcclusion.shader
//    Shader "Hidden/Image Effects/Cinematic/AmbientOcclusion" {
//      Properties {
//       _MainTex ("", 2D) = "" { }
//       _OcclusionTexture ("", 2D) = "" { }
//      }
//      SubShader 1/1 {
//        Pass 1/9 {
//          ZTest Always
//          ZWrite Off
//          Cull Off
//          GpuProgramID 60980
//          Program "fp" {
//            SubProgram "d3d11 " {
//              GpuProgramIndex 3
//            }
//          }
//        }
//      }
//    }
//
// Unity 5.3 headers extracted from AmbientOcclusion.shader.decompressed:
//   API d3d11
//   Shader model ps_4_0
//   undeciphered1: 201510240 107 3 1
//   undeciphered2: 1 2 3 2 0 0
//   undeciphered3: 0 0
//   ConstBuffer "$Globals" 176
//   ScalarInt 96 [_SampleCount]
//   Float 160 [_Intensity]
//   Float 164 [_Radius]
//   Float 168 [_Downsample]
//   ConstBuffer "UnityPerCamera" 144
//   Vector 80 [_ProjectionParams]
//   Vector 96 [_ScreenParams]
//   Vector 112 [_ZBufferParams]
//   Vector 128 [unity_OrthoParams]
//   ConstBuffer "UnityPerCameraRare" 352
//   Matrix 96 [unity_CameraProjection]
//   SetTexture 0 [_CameraDepthNormalsTexture] 2D 1
//   SetTexture 1 [_CameraDepthTexture] 2D 0
//   BindCB "$Globals" 0
//   BindCB "UnityPerCamera" 1
//   BindCB "UnityPerCameraRare" 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.2.61 on Thu Aug 17 01:03:46 2017
//
//
// 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   xy          2     NONE   float   xy  
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
//
ps_4_0
dcl_constantbuffer cb0[11], immediateIndexed
dcl_constantbuffer cb1[9], immediateIndexed
dcl_constantbuffer cb2[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.xy
dcl_output o0.xyzw
dcl_temps 10
dcl_resource_texture2d (float,float,float,float) t125
ld_indexable(texture2d)(float,float,float,float) r8.xyzw, l(0, 0, 0, 0), t125.xyzw

// It looks like this shader is already stereo capable, so just patch in the
// separation value into the projection matrix. This shader doesn't seem to use
// the -stereo*convergence cell, though that doesn't seem to matter.
mov r9.xyzw, cb2[8].xyzw
add r9.x, r9.x, r8.x

sample r0.xyzw, v2.xyxx, t0.xyzw, s1
mad r0.xyz, r0.xyzx, l(3.555400, 3.555400, 0.000000, 0.000000), l(-1.777700, -1.777700, 1.000000, 0.000000)
dp3 r0.z, r0.xyzx, r0.xyzx
div r0.z, l(2.000000), r0.z
mul r1.yz, r0.xxyx, r0.zzzz
add r1.w, r0.z, l(-1.000000)
mul r0.xyz, r1.yzwy, l(1.000000, 1.000000, -1.000000, 0.000000)
sample r2.xyzw, v2.xyxx, t1.xyzw, s0
add r0.w, -cb1[8].w, l(1.000000)
mul r1.x, r2.x, cb1[7].x
mad r2.x, -cb1[8].w, r1.x, l(1.000000)
mad r1.x, r0.w, r1.x, cb1[7].y
div r1.x, r2.x, r1.x
lt r2.xy, v2.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000)
or r2.x, r2.y, r2.x
lt r2.yz, l(0.000000, 1.000000, 1.000000, 0.000000), v2.xxyx
or r2.y, r2.z, r2.y
and r2.xy, r2.xyxx, l(1, 1, 0, 0)
iadd r2.x, r2.y, r2.x
itof r2.x, r2.x
ge r2.y, r1.x, l(0.999990)
and r2.y, r2.y, l(0x3f800000)
add r2.x, r2.y, r2.x
mul r2.x, r2.x, l(100000000.000000)
mad r2.z, r1.x, cb1[5].z, r2.x
mad r3.xy, v1.zwzz, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
add r3.xy, r3.xyxx, -r9.xyxx
mov r4.x, cb2[6].x
mov r4.y, cb2[7].y
div r3.xy, r3.xyxx, r4.xyxx
add r1.x, -r2.z, l(1.000000)
mad r1.x, cb1[8].w, r1.x, r2.z
mul r2.xy, r1.xxxx, r3.xyxx
mul r3.xy, v2.xyxx, cb0[10].zzzz
mul r3.xy, r3.xyxx, cb1[6].xyxx
round_ni r3.xy, r3.xyxx
dp2 r1.x, l(0.0671105608, 0.00583714992, 0.000000, 0.000000), r3.xyxx
frc r1.x, r1.x
mul r1.x, r1.x, l(52.982918)
frc r1.x, r1.x
itof r2.w, cb0[6].x
mov r3.x, l(12.989800)
mov r3.zw, l(0,0,0,0)
loop 
  ige r4.z, r3.w, cb0[6].x
  breakc_nz r4.z
  itof r4.z, r3.w
  mul r4.z, r4.z, l(1.000100)
  round_ni r3.y, r4.z
  mul r4.z, r3.y, l(78.233002)
  sincos r4.z, null, r4.z
  mul r4.z, r4.z, l(43758.546875)
  frc r4.z, r4.z
  add r4.z, r1.x, r4.z
  frc r4.z, r4.z
  mad r5.z, r4.z, l(2.000000), l(-1.000000)
  dp2 r4.z, r3.xyxx, l(1.000000, 78.233002, 0.000000, 0.000000)
  sincos r4.z, null, r4.z
  mul r4.z, r4.z, l(43758.546875)
  frc r4.z, r4.z
  add r4.z, r1.x, r4.z
  mul r4.z, r4.z, l(6.28318548)
  sincos r6.x, r7.x, r4.z
  mad r4.z, -r5.z, r5.z, l(1.000000)
  sqrt r4.z, r4.z
  mov r7.y, r6.x
  mul r5.xy, r4.zzzz, r7.xyxx
  add r3.y, r3.y, l(1.000000)
  div r3.y, r3.y, r2.w
  sqrt r3.y, r3.y
  mul r3.y, r3.y, cb0[10].y
  mul r5.xyz, r3.yyyy, r5.xyzx
  dp3 r3.y, -r0.xyzx, r5.xyzx
  ge r3.y, r3.y, l(0.000000)
  movc r5.xyz, r3.yyyy, -r5.xyzx, r5.xyzx
  add r5.xyz, r2.xyzx, r5.xyzx
  mul r4.zw, r5.yyyy, cb2[7].xxxy
  mad r4.zw, cb2[6].xxxy, r5.xxxx, r4.zzzw
  mad r4.zw, r9.xxxy, r5.zzzz, r4.zzzw
  add r3.y, -r5.z, l(1.000000)
  mad r3.y, cb1[8].w, r3.y, r5.z
  div r4.zw, r4.zzzw, r3.yyyy
  add r4.zw, r4.zzzw, l(0.000000, 0.000000, 1.000000, 1.000000)
  mul r5.xy, r4.zwzz, l(0.500000, 0.500000, 0.000000, 0.000000)
  sample r5.xyzw, r5.xyxx, t1.xyzw, s0
  mul r3.y, r5.x, cb1[7].x
  mad r5.x, -cb1[8].w, r3.y, l(1.000000)
  mad r3.y, r0.w, r3.y, cb1[7].y
  div r3.y, r5.x, r3.y
  lt r5.xy, r4.zwzz, l(0.000000, 0.000000, 0.000000, 0.000000)
  or r5.x, r5.y, r5.x
  lt r5.yz, l(0.000000, 2.000000, 2.000000, 0.000000), r4.zzwz
  or r5.y, r5.z, r5.y
  and r5.xy, r5.xyxx, l(1, 1, 0, 0)
  iadd r5.x, r5.y, r5.x
  itof r5.x, r5.x
  ge r5.y, r3.y, l(0.999990)
  and r5.y, r5.y, l(0x3f800000)
  add r5.x, r5.y, r5.x
  mul r5.x, r5.x, l(100000000.000000)
  mad r5.z, r3.y, cb1[5].z, r5.x
  add r4.zw, r4.zzzw, -r9.xxxy
  add r4.zw, r4.zzzw, l(0.000000, 0.000000, -1.000000, -1.000000)
  div r4.zw, r4.zzzw, r4.xxxy
  add r3.y, -r5.z, l(1.000000)
  mad r3.y, cb1[8].w, r3.y, r5.z
  mul r5.xy, r3.yyyy, r4.zwzz
  add r5.xyz, -r2.xyzx, r5.xyzx
  dp3 r3.y, r5.xyzx, r0.xyzx
  mad r3.y, -r2.z, l(0.002000), r3.y
  max r3.y, r3.y, l(0.000000)
  dp3 r4.z, r5.xyzx, r5.xyzx
  add r4.z, r4.z, l(0.000100)
  div r3.y, r3.y, r4.z
  add r3.z, r3.y, r3.z
  iadd r3.w, r3.w, l(1)
endloop 
mul r0.x, r3.z, cb0[10].y
mul r0.x, r0.x, cb0[10].x
div r0.x, r0.x, r2.w
log r0.x, r0.x
mul r0.x, r0.x, l(0.600000)
exp o0.x, r0.x
mad o0.yzw, r1.yyzw, l(0.000000, 0.500000, 0.500000, -0.500000), l(0.000000, 0.500000, 0.500000, 0.500000)
ret 
// Approximately 0 instruction slots used