//AO
// 3DMigoto: 78d5fb5441b0019a | Matched 9 variants of 1 shaders: Hidden/HBAO
//
//         Unity headers extracted from HBAO.shader
//         Shader "Hidden/HBAO" {
//           Properties {
//            _MainTex ("", 2D) = "" { }
//            _HBAOTex ("", 2D) = "" { }
//           }
//           Fallback Off
//           SubShader 1/1 {
//             Pass 19/31 {
//               ZTest Always
//               ZWrite Off
//               Cull Off
//               GpuProgramID 1180094
//               Program "fp" {
//                 SubProgram "d3d11 " {
// 001:              GpuProgramIndex 757
// 002:              GpuProgramIndex 759
// 004:              GpuProgramIndex 761
// 008:              GpuProgramIndex 769
// 010:              GpuProgramIndex 771
// 020:              GpuProgramIndex 773
// 040:              GpuProgramIndex 781
// 080:              GpuProgramIndex 783
// 100:              GpuProgramIndex 785
//                 }
//               }
//             }
//           }
//         }
//
//      Unity 5.3 headers extracted from HBAO.shader.decompressed:
//        API d3d11
//        Shader model ps_4_0
//        undeciphered1: 201509030 42 0 0
// 008:   Keywords { "DEFERRED_SHADING_ON" }
// 010:   Keywords { "NORMALS_CAMERA" "DEFERRED_SHADING_ON" }
// 080:   Keywords { "NORMALS_CAMERA" "ORTHOGRAPHIC_PROJECTION_ON" }
// 002:   Keywords { "NORMALS_CAMERA" }
// 020:   Keywords { "NORMALS_RECONSTRUCT" "DEFERRED_SHADING_ON" }
// 100:   Keywords { "NORMALS_RECONSTRUCT" "ORTHOGRAPHIC_PROJECTION_ON" }
// 004:   Keywords { "NORMALS_RECONSTRUCT" }
// 040:   Keywords { "ORTHOGRAPHIC_PROJECTION_ON" }
//        undeciphered2: 1 1 2 1 0
//        undeciphered3: 0 0
//        ConstBuffer "UnityPerCamera" 144
//        Vector 80 [_ProjectionParams]
//        Vector 96 [_ScreenParams]
//        ConstBuffer "FrequentlyUpdatedUniforms" 176
//        Float 132 [_BlurSharpness]
//        SetTexture 0 [_MainTex] 2D 0
//        BindCB "UnityPerCamera" 0
//        BindCB "FrequentlyUpdatedUniforms" 1
//
// Headers extracted with DarkStarSword's extract_unity53_shaders.py
// https://raw.githubusercontent.com/DarkStarSword/3d-fixes/master/extract_unity53_shaders.py

// ---- Created with 3Dmigoto v1.2.38 on Thu Feb 09 12:29:31 2017
Texture2D<float4> t0 : register(t0);

SamplerState s0_s : register(s0);

cbuffer cb1 : register(b1)
{
  float4 cb1[9];
}

cbuffer cb0 : register(b0)
{
  float4 cb0[7];
}




// 3Dmigoto declarations
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);


void main( 
  float2 v0 : TEXCOORD0,
  float2 w0 : TEXCOORD1,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.yw = float2(-0,0);
  r1.x = -1 + cb0[6].z;
  r0.x = -r1.x;
  r0.xy = v0.xy + r0.xy;
  r2.xyzw = t0.SampleLevel(s0_s, r0.xy, 0).xyzw;
  r0.x = dot(r2.xy, float2(1,0.00392156886));
  r3.xyzw = t0.SampleLevel(s0_s, v0.xy, 0).xyzw;
  r0.y = dot(r3.xy, float2(1,0.00392156886));
  r0.x = r0.x + -r0.y;
  r0.x = cb0[5].z * r0.x;
  r0.x = cb1[8].y * r0.x;
  r0.x = -r0.x * r0.x + -0.5;
  r0.x = exp2(r0.x);
  r1.y = r0.x * r2.w + r3.w;
  r0.x = 1 + r0.x;
  o0.xy = r3.xy;
  r0.z = -2.5 * r1.x;
  r0.zw = v0.xy + r0.zw;
  r2.xyzw = t0.SampleLevel(s0_s, r0.zw, 0).xyzw;
  r0.z = dot(r2.xy, float2(1,0.00392156886));
  r0.z = r0.z + -r0.y;
  r0.z = cb0[5].z * r0.z;
  r0.z = cb1[8].y * r0.z;
  r0.z = -r0.z * r0.z + -2;
  r0.z = exp2(r0.z);
  r0.w = r0.z * r2.w + r1.y;
  r0.x = r0.x + r0.z;
  r2.x = v0.x + r1.x;
  r1.x = 2.5 * r1.x;
  r2.y = v0.y;
  r2.xyzw = t0.SampleLevel(s0_s, r2.xy, 0).xyzw;
  r0.z = dot(r2.xy, float2(1,0.00392156886));
  r0.z = r0.z + -r0.y;
  r0.z = cb0[5].z * r0.z;
  r0.z = cb1[8].y * r0.z;
  r0.z = -r0.z * r0.z + -0.5;
  r0.z = exp2(r0.z);
  r0.w = r0.z * r2.w + r0.w;
  r0.x = r0.x + r0.z;
  r1.y = 0;
  r1.xy = v0.xy + r1.xy;
  r1.xyzw = t0.SampleLevel(s0_s, r1.xy, 0).xyzw;
  r0.z = dot(r1.xy, float2(1,0.00392156886));
  r0.y = r0.z + -r0.y;
  r0.y = cb0[5].z * r0.y;
  r0.y = cb1[8].y * r0.y;
  r0.y = -r0.y * r0.y + -2;
  r0.y = exp2(r0.y);
  r0.z = r0.y * r1.w + r0.w;
  r0.x = r0.x + r0.y;
  o0.w = r0.z / r0.x;
  o0.z = 1;
  return;
}