// ---- Created with 3Dmigoto v1.2.35 on Tue Apr 26 22:30:27 2016

cbuffer CBDofParam : register(b0)
{
  float4 g_vDepthComputeParam : packoffset(c0);
  float4 g_vNearFarParam : packoffset(c1);
  float4 g_vScreenSize : packoffset(c2);
  float4 g_vLensParam : packoffset(c3);
  float4 g_vNoBlurDist : packoffset(c4);
  float4 g_vVelomapParam : packoffset(c5);
  float4 g_vClipCoC : packoffset(c6);
  float4 g_vSampleScale : packoffset(c7);
  float4 g_vDebugMode : packoffset(c8);
}

SamplerState SS_ClampPoint_s : register(s2);
SamplerState SS_ClampLinear_s : register(s3);
Texture2D<float4> g_CoCTex : register(t2);


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


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

  r0.xy = -g_vScreenSize.zw + v1.xy;
  r0.xy = g_CoCTex.Sample(SS_ClampLinear_s, r0.xy).xw;
  r1.xyzw = g_CoCTex.Sample(SS_ClampPoint_s, v1.xy).xyzw;
  r0.xy = max(r1.xw, r0.xy);
  r0.y = r1.w + r0.y;
  r2.xyzw = g_vScreenSize.zwzw * float4(0,-1,1,-1) + v1.xyxy;
  r0.zw = g_CoCTex.Sample(SS_ClampLinear_s, r2.xy).xw;
  r2.xy = g_CoCTex.Sample(SS_ClampLinear_s, r2.zw).xw;
  r0.w = max(r0.w, r1.w);
  r0.x = max(r0.z, r0.x);
  r0.x = max(r2.x, r0.x);
  r0.z = max(r2.y, r1.w);
  r0.y = r0.y + r0.w;
  r0.y = r0.y + r0.z;
  r2.xyzw = g_vScreenSize.zwzw * float4(-1,0,1,0) + v1.xyxy;
  r0.zw = g_CoCTex.Sample(SS_ClampLinear_s, r2.xy).xw;
  r2.xy = g_CoCTex.Sample(SS_ClampLinear_s, r2.zw).xw;
  r0.w = max(r0.w, r1.w);
  r0.x = max(r0.z, r0.x);
  r0.x = max(r2.x, r0.x);
  r0.z = max(r2.y, r1.w);
  r0.y = r0.y + r0.w;
  r0.y = r0.y + r0.z;
  r2.xyzw = g_vScreenSize.zwzw * float4(-1,1,0,1) + v1.xyxy;
  r0.zw = g_CoCTex.Sample(SS_ClampLinear_s, r2.xy).xw;
  r2.xy = g_CoCTex.Sample(SS_ClampLinear_s, r2.zw).xw;
  r0.w = max(r0.w, r1.w);
  r0.x = max(r0.z, r0.x);
  r0.x = max(r2.x, r0.x);
  r0.z = max(r2.y, r1.w);
  r0.y = r0.y + r0.w;
  r0.y = r0.y + r0.z;
  r0.zw = g_vScreenSize.zw + v1.xy;
  r0.zw = g_CoCTex.Sample(SS_ClampLinear_s, r0.zw).xw;
  r0.w = max(r0.w, r1.w);
  o0.x = max(r0.z, r0.x);
  o0.yz = r1.yz;
  r0.x = r0.y + r0.w;
  o0.w = 0.111111112 * r0.x;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20546
//
//
// Buffer Definitions: 
//
// cbuffer CBDofParam
// {
//
//   float4 g_vDepthComputeParam;       // Offset:    0 Size:    16 [unused]
//   float4 g_vNearFarParam;            // Offset:   16 Size:    16 [unused]
//   float4 g_vScreenSize;              // Offset:   32 Size:    16
//   float4 g_vLensParam;               // Offset:   48 Size:    16 [unused]
//   float4 g_vNoBlurDist;              // Offset:   64 Size:    16 [unused]
//   float4 g_vVelomapParam;            // Offset:   80 Size:    16 [unused]
//   float4 g_vClipCoC;                 // Offset:   96 Size:    16 [unused]
//   float4 g_vSampleScale;             // Offset:  112 Size:    16 [unused]
//   float4 g_vDebugMode;               // Offset:  128 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// SS_ClampPoint                     sampler      NA          NA    2        1
// SS_ClampLinear                    sampler      NA          NA    3        1
// g_CoCTex                          texture  float4          2d    2        1
// CBDofParam                        cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float       
// TEXCOORD                 0   xy          1     NONE   float   xy  
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[3], immediateIndexed
dcl_sampler s2, mode_default
dcl_sampler s3, mode_default
dcl_resource_texture2d (float,float,float,float) t2
dcl_input_ps linear v1.xy
dcl_output o0.xyzw
dcl_temps 3
add r0.xy, v1.xyxx, -cb0[2].zwzz
sample_indexable(texture2d)(float,float,float,float) r0.xy, r0.xyxx, t2.xwyz, s3
sample_indexable(texture2d)(float,float,float,float) r1.xyzw, v1.xyxx, t2.xyzw, s2
max r0.xy, r0.xyxx, r1.xwxx
add r0.y, r0.y, r1.w
mad r2.xyzw, cb0[2].zwzw, l(0.000000, -1.000000, 1.000000, -1.000000), v1.xyxy
sample_indexable(texture2d)(float,float,float,float) r0.zw, r2.xyxx, t2.yzxw, s3
sample_indexable(texture2d)(float,float,float,float) r2.xy, r2.zwzz, t2.xwyz, s3
max r0.w, r1.w, r0.w
max r0.x, r0.x, r0.z
max r0.x, r0.x, r2.x
max r0.z, r1.w, r2.y
add r0.y, r0.w, r0.y
add r0.y, r0.z, r0.y
mad r2.xyzw, cb0[2].zwzw, l(-1.000000, 0.000000, 1.000000, 0.000000), v1.xyxy
sample_indexable(texture2d)(float,float,float,float) r0.zw, r2.xyxx, t2.yzxw, s3
sample_indexable(texture2d)(float,float,float,float) r2.xy, r2.zwzz, t2.xwyz, s3
max r0.w, r1.w, r0.w
max r0.x, r0.x, r0.z
max r0.x, r0.x, r2.x
max r0.z, r1.w, r2.y
add r0.y, r0.w, r0.y
add r0.y, r0.z, r0.y
mad r2.xyzw, cb0[2].zwzw, l(-1.000000, 1.000000, 0.000000, 1.000000), v1.xyxy
sample_indexable(texture2d)(float,float,float,float) r0.zw, r2.xyxx, t2.yzxw, s3
sample_indexable(texture2d)(float,float,float,float) r2.xy, r2.zwzz, t2.xwyz, s3
max r0.w, r1.w, r0.w
max r0.x, r0.x, r0.z
max r0.x, r0.x, r2.x
max r0.z, r1.w, r2.y
add r0.y, r0.w, r0.y
add r0.y, r0.z, r0.y
add r0.zw, v1.xxxy, cb0[2].zzzw
sample_indexable(texture2d)(float,float,float,float) r0.zw, r0.zwzz, t2.yzxw, s3
max r0.w, r1.w, r0.w
max o0.x, r0.x, r0.z
mov o0.yz, r1.yyzy
add r0.x, r0.w, r0.y
mul o0.w, r0.x, l(0.111111)
ret 
// Approximately 40 instruction slots used

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
