//Depth of field 2.
// ---- Created with 3Dmigoto v1.2.64 on Sat Sep 09 17:25:11 2017

cbuffer _Globals : register(b0)
{
  float4 _gradation_pos_dir : packoffset(c0);
  float _gradation_length : packoffset(c1);
  float4 _gradation_color_A : packoffset(c2);
  float4 _gradation_color_B : packoffset(c3);
}

SamplerState _tex_rendertarget_samplerstate_s : register(s0);
Texture2D<float4> _tex_rendertarget : register(t0);


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

  float4 iniparams = IniParams.Load(0);
  if (iniparams.y==1)
  {
	//discard;
  }
  
  r0.xy = -_gradation_pos_dir.xy + v1.xy;
  r0.x = dot(r0.xy, _gradation_pos_dir.zw);
  r0.x = saturate(r0.x / _gradation_length);
  r0.y = 1 + -r0.x;
  r1.xyzw = _gradation_color_B.xyzw * r0.xxxx;
  r0.xyzw = _gradation_color_A.xyzw * r0.yyyy + r1.xyzw;
  r1.xyzw = float4(1,1,1,1) + -r0.xyzw;
  r2.xyzw = r0.xyzw * float4(2,2,2,2) + float4(-1,-1,-1,-1);
  r3.xyzw = _tex_rendertarget.Sample(_tex_rendertarget_samplerstate_s, v1.xy).xyzw;
  r4.xyzw = sqrt(r3.xyzw);
  r2.xyzw = r4.xyzw * r2.xyzw;
  r4.xyzw = r3.xyzw + r3.xyzw;
  r1.xyzw = r4.xyzw * r1.xyzw + r2.xyzw;
  r2.xyzw = cmp(r0.xyzw < float4(0.5,0.5,0.5,0.5));
  r5.xyzw = r2.xyzw ? float4(0,0,0,0) : float4(1,1,1,1);
  r2.xyzw = r2.xyzw ? float4(1,1,1,1) : 0;
  r1.xyzw = r5.xyzw * r1.xyzw;
  r5.xyzw = -r0.xyzw * float4(2,2,2,2) + float4(1,1,1,1);
  r6.xyzw = r3.xyzw * r3.xyzw;
  r5.xyzw = r6.xyzw * r5.xyzw;
  r0.xyzw = r4.xyzw * r0.xyzw + r5.xyzw;
  r0.xyzw = saturate(r0.xyzw * r2.xyzw + r1.xyzw);
  r1.x = 1 + -_gradation_color_A.w;
  r1.xyzw = r3.xyzw * r1.xxxx;
  o0.xyzw = r0.xyzw * _gradation_color_A.wwww + r1.xyzw;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20789
//
//   using 3Dmigoto v1.2.64 on Sat Sep 09 17:25:11 2017
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   float4 _gradation_pos_dir;         // Offset:    0 Size:    16
//   float _gradation_length;           // Offset:   16 Size:     4
//   float4 _gradation_color_A;         // Offset:   32 Size:    16
//   float4 _gradation_color_B;         // Offset:   48 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// _tex_rendertarget_samplerstate    sampler      NA          NA    0        1
// _tex_rendertarget                 texture  float4          2d    0        1
// $Globals                          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[4], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input_ps linear v1.xy
dcl_output o0.xyzw
dcl_temps 7
add r0.xy, v1.xyxx, -cb0[0].xyxx
dp2 r0.x, r0.xyxx, cb0[0].zwzz
div_sat r0.x, r0.x, cb0[1].x
add r0.y, -r0.x, l(1.000000)
mul r1.xyzw, r0.xxxx, cb0[3].xyzw
mad r0.xyzw, cb0[2].xyzw, r0.yyyy, r1.xyzw
add r1.xyzw, -r0.xyzw, l(1.000000, 1.000000, 1.000000, 1.000000)
mad r2.xyzw, r0.xyzw, l(2.000000, 2.000000, 2.000000, 2.000000), l(-1.000000, -1.000000, -1.000000, -1.000000)
sample_indexable(texture2d)(float,float,float,float) r3.xyzw, v1.xyxx, t0.xyzw, s0
sqrt r4.xyzw, r3.xyzw
mul r2.xyzw, r2.xyzw, r4.xyzw
add r4.xyzw, r3.xyzw, r3.xyzw
mad r1.xyzw, r4.xyzw, r1.xyzw, r2.xyzw
lt r2.xyzw, r0.xyzw, l(0.500000, 0.500000, 0.500000, 0.500000)
movc r5.xyzw, r2.xyzw, l(0,0,0,0), l(1.000000,1.000000,1.000000,1.000000)
and r2.xyzw, r2.xyzw, l(0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000)
mul r1.xyzw, r1.xyzw, r5.xyzw
mad r5.xyzw, -r0.xyzw, l(2.000000, 2.000000, 2.000000, 2.000000), l(1.000000, 1.000000, 1.000000, 1.000000)
mul r6.xyzw, r3.xyzw, r3.xyzw
mul r5.xyzw, r5.xyzw, r6.xyzw
mad r0.xyzw, r4.xyzw, r0.xyzw, r5.xyzw
mad_sat r0.xyzw, r0.xyzw, r2.xyzw, r1.xyzw
add r1.x, -cb0[2].w, l(1.000000)
mul r1.xyzw, r1.xxxx, r3.xyzw
mad o0.xyzw, r0.xyzw, cb0[2].wwww, r1.xyzw
ret 
// Approximately 26 instruction slots used

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