// Light Shafts
// ---- Created with 3Dmigoto v1.2.39 on Mon May 23 03:48:07 2016
Texture2D<float4> t0 : register(t0);

SamplerState s0_s : register(s0);

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




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


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

  r0.x = 2.26303434 * cb0[10].z;
  r0.x = exp2(r0.x);
  r0.x = cb0[10].y * r0.x;
  r0.x = min(1, r0.x);

// Exactly the same as UE3 light shafts (and a common pattern in general), only
// challenge is identifying the right constant to adjust without the headers:
  r0.yz = -v0.xy * cb0[6].zw + cb0[0].xy + float2(StereoParams.Load(0).x / 2, 0);

  r0.xy = r0.yz * r0.xx;
  r0.zw = cb0[6].zw * v0.xy;
  r1.xyzw = r0.xyxy * float4(0.0833333358,0.0833333358,0.166666672,0.166666672) + r0.zwzw;
  r1.xyzw = cb0[6].xyxy * r1.xyzw;
  r1.xyzw = max(cb0[5].xyxy, r1.xyzw);
  r1.xyzw = min(cb0[5].zwzw, r1.xyzw);
  r2.xyz = t0.Sample(s0_s, r1.xy).xyz;
  r1.xyz = t0.Sample(s0_s, r1.zw).xyz;
  r3.xy = cb0[6].xy * r0.zw;
  r3.xy = max(cb0[5].xy, r3.xy);
  r3.xy = min(cb0[5].zw, r3.xy);
  r3.xyz = t0.Sample(s0_s, r3.xy).xyz;
  r2.xyz = r3.xyz + r2.xyz;
  r1.xyz = r2.xyz + r1.xyz;
  r2.xyzw = r0.xyxy * float4(0.25,0.25,0.333333343,0.333333343) + r0.zwzw;
  r2.xyzw = cb0[6].xyxy * r2.xyzw;
  r2.xyzw = max(cb0[5].xyxy, r2.xyzw);
  r2.xyzw = min(cb0[5].zwzw, r2.xyzw);
  r3.xyz = t0.Sample(s0_s, r2.xy).xyz;
  r2.xyz = t0.Sample(s0_s, r2.zw).xyz;
  r1.xyz = r3.xyz + r1.xyz;
  r1.xyz = r1.xyz + r2.xyz;
  r2.xyzw = r0.xyxy * float4(0.416666657,0.416666657,0.5,0.5) + r0.zwzw;
  r2.xyzw = cb0[6].xyxy * r2.xyzw;
  r2.xyzw = max(cb0[5].xyxy, r2.xyzw);
  r2.xyzw = min(cb0[5].zwzw, r2.xyzw);
  r3.xyz = t0.Sample(s0_s, r2.xy).xyz;
  r2.xyz = t0.Sample(s0_s, r2.zw).xyz;
  r1.xyz = r3.xyz + r1.xyz;
  r1.xyz = r1.xyz + r2.xyz;
  r2.xyzw = r0.xyxy * float4(0.583333313,0.583333313,0.666666687,0.666666687) + r0.zwzw;
  r2.xyzw = cb0[6].xyxy * r2.xyzw;
  r2.xyzw = max(cb0[5].xyxy, r2.xyzw);
  r2.xyzw = min(cb0[5].zwzw, r2.xyzw);
  r3.xyz = t0.Sample(s0_s, r2.xy).xyz;
  r2.xyz = t0.Sample(s0_s, r2.zw).xyz;
  r1.xyz = r3.xyz + r1.xyz;
  r1.xyz = r1.xyz + r2.xyz;
  r2.xyzw = r0.xyxy * float4(0.75,0.75,0.833333313,0.833333313) + r0.zwzw;
  r0.xy = r0.xy * float2(0.916666687,0.916666687) + r0.zw;
  r0.xy = cb0[6].xy * r0.xy;
  r0.xy = max(cb0[5].xy, r0.xy);
  r0.xy = min(cb0[5].zw, r0.xy);
  r0.xyz = t0.Sample(s0_s, r0.xy).xyz;
  r2.xyzw = cb0[6].xyxy * r2.xyzw;
  r2.xyzw = max(cb0[5].xyxy, r2.xyzw);
  r2.xyzw = min(cb0[5].zwzw, r2.xyzw);
  r3.xyz = t0.Sample(s0_s, r2.xy).xyz;
  r2.xyz = t0.Sample(s0_s, r2.zw).xyz;
  r1.xyz = r3.xyz + r1.xyz;
  r1.xyz = r1.xyz + r2.xyz;
  r0.xyz = r1.xyz + r0.xyz;
  o0.xyz = float3(0.0833333358,0.0833333358,0.0833333358) * r0.xyz;
  o0.w = 1;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.2.39 on Mon May 23 03:48:07 2016
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xy          0     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[11], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input_ps linear v0.xy
dcl_output o0.xyzw
dcl_temps 4
mul r0.x, cb0[10].z, l(2.26303434)
exp r0.x, r0.x
mul r0.x, r0.x, cb0[10].y
min r0.x, r0.x, l(1.000000)
mad r0.yz, -v0.xxyx, cb0[6].zzwz, cb0[0].xxyx
mul r0.xy, r0.xxxx, r0.yzyy
mul r0.zw, v0.xxxy, cb0[6].zzzw
mad r1.xyzw, r0.xyxy, l(0.0833333358, 0.0833333358, 0.166666672, 0.166666672), r0.zwzw
mul r1.xyzw, r1.xyzw, cb0[6].xyxy
max r1.xyzw, r1.xyzw, cb0[5].xyxy
min r1.xyzw, r1.xyzw, cb0[5].zwzw
sample_indexable(texture2d)(float,float,float,float) r2.xyz, r1.xyxx, t0.xyzw, s0
sample_indexable(texture2d)(float,float,float,float) r1.xyz, r1.zwzz, t0.xyzw, s0
mul r3.xy, r0.zwzz, cb0[6].xyxx
max r3.xy, r3.xyxx, cb0[5].xyxx
min r3.xy, r3.xyxx, cb0[5].zwzz
sample_indexable(texture2d)(float,float,float,float) r3.xyz, r3.xyxx, t0.xyzw, s0
add r2.xyz, r2.xyzx, r3.xyzx
add r1.xyz, r1.xyzx, r2.xyzx
mad r2.xyzw, r0.xyxy, l(0.250000, 0.250000, 0.333333343, 0.333333343), r0.zwzw
mul r2.xyzw, r2.xyzw, cb0[6].xyxy
max r2.xyzw, r2.xyzw, cb0[5].xyxy
min r2.xyzw, r2.xyzw, cb0[5].zwzw
sample_indexable(texture2d)(float,float,float,float) r3.xyz, r2.xyxx, t0.xyzw, s0
sample_indexable(texture2d)(float,float,float,float) r2.xyz, r2.zwzz, t0.xyzw, s0
add r1.xyz, r1.xyzx, r3.xyzx
add r1.xyz, r2.xyzx, r1.xyzx
mad r2.xyzw, r0.xyxy, l(0.416666657, 0.416666657, 0.500000, 0.500000), r0.zwzw
mul r2.xyzw, r2.xyzw, cb0[6].xyxy
max r2.xyzw, r2.xyzw, cb0[5].xyxy
min r2.xyzw, r2.xyzw, cb0[5].zwzw
sample_indexable(texture2d)(float,float,float,float) r3.xyz, r2.xyxx, t0.xyzw, s0
sample_indexable(texture2d)(float,float,float,float) r2.xyz, r2.zwzz, t0.xyzw, s0
add r1.xyz, r1.xyzx, r3.xyzx
add r1.xyz, r2.xyzx, r1.xyzx
mad r2.xyzw, r0.xyxy, l(0.583333313, 0.583333313, 0.666666687, 0.666666687), r0.zwzw
mul r2.xyzw, r2.xyzw, cb0[6].xyxy
max r2.xyzw, r2.xyzw, cb0[5].xyxy
min r2.xyzw, r2.xyzw, cb0[5].zwzw
sample_indexable(texture2d)(float,float,float,float) r3.xyz, r2.xyxx, t0.xyzw, s0
sample_indexable(texture2d)(float,float,float,float) r2.xyz, r2.zwzz, t0.xyzw, s0
add r1.xyz, r1.xyzx, r3.xyzx
add r1.xyz, r2.xyzx, r1.xyzx
mad r2.xyzw, r0.xyxy, l(0.750000, 0.750000, 0.833333313, 0.833333313), r0.zwzw
mad r0.xy, r0.xyxx, l(0.916666687, 0.916666687, 0.000000, 0.000000), r0.zwzz
mul r0.xy, r0.xyxx, cb0[6].xyxx
max r0.xy, r0.xyxx, cb0[5].xyxx
min r0.xy, r0.xyxx, cb0[5].zwzz
sample_indexable(texture2d)(float,float,float,float) r0.xyz, r0.xyxx, t0.xyzw, s0
mul r2.xyzw, r2.xyzw, cb0[6].xyxy
max r2.xyzw, r2.xyzw, cb0[5].xyxy
min r2.xyzw, r2.xyzw, cb0[5].zwzw
sample_indexable(texture2d)(float,float,float,float) r3.xyz, r2.xyxx, t0.xyzw, s0
sample_indexable(texture2d)(float,float,float,float) r2.xyz, r2.zwzz, t0.xyzw, s0
add r1.xyz, r1.xyzx, r3.xyzx
add r1.xyz, r2.xyzx, r1.xyzx
add r0.xyz, r0.xyzx, r1.xyzx
mul o0.xyz, r0.xyzx, l(0.0833333358, 0.0833333358, 0.0833333358, 0.000000)
mov o0.w, l(1.000000)
ret 
// Approximately 0 instruction slots used

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