//Bloom.
// ---- Created with 3Dmigoto v1.2.45 on Sat Oct 29 08:55:46 2016
Texture2D<float4> t1 : register(t1);

Texture2D<float4> t0 : register(t0);

SamplerState s1_s : register(s1);

SamplerState s0_s : register(s0);

cbuffer cb2 : register(b2)
{
  float4 cb2[19];
}

cbuffer cb12 : register(b12)
{
  float4 cb12[45];
}




// 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,r3;
  uint4 bitmask, uiDest;
  float4 fDest;

  float4 stereo = StereoParams.Load(0);
  float4 iniparams = IniParams.Load(0);
  float separation = stereo.x;
  float convergence = stereo.y;
  
  if (iniparams.y==1)
  {
	discard;
  }
  
  r0.xyz = t1.Sample(s1_s, v1.xy).xyz;
  r0.xyz = cb2[1].www * r0.xyz;
  r0.w = dot(r0.xyz, float3(0.212500006,0.715399981,0.0720999986));
  r1.x = cmp(cb2[1].x < 0.5);
  r0.xyz = float3(0,0,0);
  r1.y = 0;
  while (true) {
    r1.z = cmp((int)r1.y >= 15);
    if (r1.z != 0) break;
    r1.zw = cb2[r1.y+3].xy + v1.xy;
    if (r1.x != 0) {
      r2.xy = cb12[43].xy * r1.zw;
      r2.xy = max(float2(0,0), r2.xy);
      r3.x = min(cb12[44].z, r2.x);
      r3.y = min(cb12[43].y, r2.y);
      r2.xyz = t0.Sample(s0_s, r3.xy).xyz;
      r2.xyz = cb2[1].www * r2.xyz;
    } else {
      r3.xyz = t0.Sample(s0_s, r1.zw).xyz;
      r2.xyz = cb2[1].www * r3.xyz;
    }
    r2.xyz = -cb2[0].xxx + r2.xyz;
    r2.xyz = max(float3(0,0,0), r2.xyz);
    r2.xyz = cb2[0].yyy * r2.xyz;
    r0.xyz = r2.xyz * cb2[r1.y+3].zzz + r0.xyz;
    r1.y = (int)r1.y + 1;
  }
  r1.x = cb2[1].z;
  r1.w = 1;
  o0.xyzw = r1.xxxw * r0.xyzw;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.2.45 on Sat Oct 29 08:55:46 2016
//
//
// 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 cb12[45], immediateIndexed
dcl_constantbuffer cb2[19], dynamicIndexed
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.xy
dcl_output o0.xyzw
dcl_temps 4
sample_indexable(texture2d)(float,float,float,float) r0.xyz, v1.xyxx, t1.xyzw, s1
mul r0.xyz, r0.xyzx, cb2[1].wwww
dp3 r0.w, r0.xyzx, l(0.212500, 0.715400, 0.072100, 0.000000)
lt r1.x, cb2[1].x, l(0.500000)
mov r0.xyz, l(0,0,0,0)
mov r1.y, l(0)
loop 
  ige r1.z, r1.y, l(15)
  breakc_nz r1.z
  add r1.zw, v1.xxxy, cb2[r1.y + 3].xxxy
  if_nz r1.x
    mul r2.xy, r1.zwzz, cb12[43].xyxx
    max r2.xy, r2.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000)
    min r3.x, r2.x, cb12[44].z
    min r3.y, r2.y, cb12[43].y
    sample_indexable(texture2d)(float,float,float,float) r2.xyz, r3.xyxx, t0.xyzw, s0
    mul r2.xyz, r2.xyzx, cb2[1].wwww
  else 
    sample_indexable(texture2d)(float,float,float,float) r3.xyz, r1.zwzz, t0.xyzw, s0
    mul r2.xyz, r3.xyzx, cb2[1].wwww
  endif 
  add r2.xyz, r2.xyzx, -cb2[0].xxxx
  max r2.xyz, r2.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
  mul r2.xyz, r2.xyzx, cb2[0].yyyy
  mad r0.xyz, r2.xyzx, cb2[r1.y + 3].zzzz, r0.xyzx
  iadd r1.y, r1.y, l(1)
endloop 
mov r1.x, cb2[1].z
mov r1.w, l(1.000000)
mul o0.xyzw, r0.xyzw, r1.xxxw
ret 
// Approximately 0 instruction slots used

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