//Sun rays PS.
// ---- Created with 3Dmigoto v1.3.11 on Thu Aug 09 18:15:29 2018
//
//cbuffer _Globals : register(b0)
//{
//  float4 uDiffuseColor : packoffset(c0);
//  float4 uEnvironmentColor : packoffset(c1);
//  float4 uLightAmbience : packoffset(c2);
//  float uFogNear : packoffset(c3);
//  float uFogFar : packoffset(c3.y);
//  float3 uFogColor : packoffset(c4);
//  int uFullBright : packoffset(c4.w);
//  float uExposure : packoffset(c5);
//  float3 uLightCoordinate : packoffset(c5.y);
//}
//
//SamplerState uTexSample0_s : register(s0);
//Texture2D<float4> uTex0 : 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,
//  float4 v2 : COLOR0,
//  out float4 o0 : SV_TARGET0)
//{
//  float4 r0,r1,r2,r3,r10,r11;
//  uint4 bitmask, uiDest;
//  float4 fDest;
//
//  float4 stereo = StereoParams.Load(0);
//  float4 iniparams3 = IniParams.Load(int2(3,0));
//  
//  r10.xyz=uLightCoordinate.xyz;
//  r11.xy=v1.xy;
//  
//  r10.x+=stereo.x*0.5;
//  r11.x-=stereo.x*0.5;
//  
//  
//  r0.xy = cmp(r10.xy < float2(0,0));
//  r0.x = (int)r0.y | (int)r0.x;
//  if (r0.x != 0) {
//    if (-1 != 0) discard;
//    return;
//  }
//  r0.xy = cmp(float2(1,1) < r10.xy);
//  r0.x = (int)r0.y | (int)r0.x;
//  if (r0.x != 0) {
//    if (-1 != 0) discard;
//    return;
//  }
//  r0.xy = -r10.xy + v1.xy;
//  r1.xyzw = uTex0.SampleLevel(uTexSample0_s, v1.xy, 0).xyzw;
//  r2.xyz = r1.xyz;
//  r2.w = 1;
//  r0.zw = v1.xy;
//  r1.w = 0;
//  while (true) {
//    r3.x = cmp((int)r1.w >= 100);
//    if (r3.x != 0) break;
//    r0.zw = -r0.xy * float2(0.0083999997,0.0083999997) + r0.zw;
//    r3.xy = saturate(r0.zw);
//    r3.xyzw = uTex0.SampleLevel(uTexSample0_s, r3.xy, 0).xyzw;
//    r2.xyzw = r3.xyzw * float4(3.5,3.5,3.5,3.5) + r2.xyzw;
//    r1.w = (int)r1.w + 1;
//  }
//  r0.xy = float2(-0.5,-0.5) + r10.xy;
//  r0.xy = r0.xy + r0.xy;
//  r0.x = dot(r0.xy, r0.xy);
//  r0.x = sqrt(r0.x);
//  r0.x = saturate(1.75 + -r0.x);
//  r0.x = uExposure * r0.x;
//  r0.xyzw = r2.xyzw * r0.xxxx;
//  o0.xyzw = v2.xyzw * r0.xyzw;
//  return;
//}
//
///*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.18773
//
//   using 3Dmigoto v1.3.11 on Thu Aug 09 18:15:29 2018
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
//   float4 uDiffuseColor;              // Offset:    0 Size:    16 [unused]
//   float4 uEnvironmentColor;          // Offset:   16 Size:    16 [unused]
//   float4 uLightAmbience;             // Offset:   32 Size:    16 [unused]
//   float uFogNear;                    // Offset:   48 Size:     4 [unused]
//   float uFogFar;                     // Offset:   52 Size:     4 [unused]
//   float3 uFogColor;                  // Offset:   64 Size:    12 [unused]
//   int uFullBright;                   // Offset:   76 Size:     4 [unused]
//   float uExposure;                   // Offset:   80 Size:     4
//   float3 uLightCoordinate;           // Offset:   84 Size:    12
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// uTexSample0                       sampler      NA          NA    0        1
// uTex0                             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
// COLOR                    0   xyzw        2     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
//
ps_4_0
dcl_constantbuffer cb0[6], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xyzw
dcl_output o0.xyzw
//dcl_temps 4
dcl_temps 30

//StereoParams:
dcl_resource_texture2d (float,float,float,float) t125
ld_indexable(texture2d)(float,float,float,float) r25.xyzw, l(0, 0, 0, 0), t125.xyzw

//IniParams:
dcl_resource_texture1d (float,float,float,float) t120
ld_indexable(texture1d)(float,float,float,float) r28.xyzw, l(3, 0, 0, 0), t120.xyzw

mov r26.xyz, cb0[5].xyz
mad r26.y, r25.x, l(0.500000), r26.y

mov r27.xy, v1.xy
mad r27.x, r25.x, l(-0.500000), r27.x

mov r21.xy, v1.xy
mad r21.x, r25.x, l(0.500000), r21.x

lt r0.xy, r26.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000)
or r0.x, r0.y, r0.x
if_nz r0.x
  discard_nz l(-1)
  ret
endif
lt r0.xy, l(1.000000, 1.000000, 0.000000, 0.000000), r26.yzyy
or r0.x, r0.y, r0.x
if_nz r0.x
  discard_nz l(-1)
  ret
endif
add r0.xy, v1.xyxx, -r26.yzyy
sample_l r1.xyzw, v1.xyxx, t0.xyzw, s0, l(0.000000)
mov r2.xyz, r1.xyzx
mov r2.w, l(1.000000)
mov r0.zw, v1.xxxy
mov r1.w, l(0)
loop
  ige r3.x, r1.w, l(100)
  breakc_nz r3.x
  mad r0.zw, -r0.xxxy, l(0.000000, 0.000000, 0.008400, 0.008400), r0.zzzw
  mov_sat r3.xy, r0.zwzz
  sample_l r3.xyzw, r3.xyxx, t0.xyzw, s0, l(0.000000)
  mad r2.xyzw, r3.xyzw, l(3.500000, 3.500000, 3.500000, 3.500000), r2.xyzw
  iadd r1.w, r1.w, l(1)
endloop
add r0.xy, r26.yzyy, l(-0.500000, -0.500000, 0.000000, 0.000000)
add r0.xy, r0.xyxx, r0.xyxx
dp2 r0.x, r0.xyxx, r0.xyxx
sqrt r0.x, r0.x
add_sat r0.x, -r0.x, l(1.750000)
mul r0.x, r0.x, cb0[5].x
mul r0.xyzw, r0.xxxx, r2.xyzw
mul o0.xyzw, r0.xyzw, v2.xyzw
ret
// Approximately 36 instruction slots used
