// Floor effect

cbuffer cb3 : register(b3)
{
  float4 cb3[4] : packoffset(c0);
}

cbuffer cb2 : register(b2)
{
  float4 cb2[22] : packoffset(c0);
}

cbuffer cb1 : register(b1)
{
  float4 cb1[12] : packoffset(c0);
}

cbuffer cb0 : register(b0)
{
  float4 cb0[139] : packoffset(c0);
}

SamplerState s0_s_s : register(s0);
SamplerState s1_s_s : register(s1);
SamplerState s2_s_s : register(s2);
SamplerState s3_s_s : register(s3);
SamplerState s4_s_s : register(s4);
SamplerState s5_s_s : register(s5);
SamplerState s6_s_s : register(s6);
Texture2D<float4> t0 : register(t0);
Texture2D<float4> t1 : register(t1);
Texture2D<float4> t2 : register(t2);
Texture2D<float4> t3 : register(t3);
Texture2D<float4> t4 : register(t4);
Texture2D<float4> t5 : register(t5);
Texture2D<float4> t6 : register(t6);


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

#include "matrix.hlsl"

void main( 
  linear centroid float4 v0 : TEXCOORD10,
  linear centroid float4 v1 : TEXCOORD11,
  float4 v2 : TEXCOORD0,
  float4 v3 : TEXCOORD4,
  float4 v4 : SV_Position0,
  uint v5 : SV_IsFrontFace0,
  out float4 o0 : SV_Target0,
  out float4 o1 : SV_Target1,
  out float4 o2 : SV_Target2,
  out float4 o3 : SV_Target3,
  out float4 o4 : SV_Target4,
  out float4 o5 : SV_Target5)
{
  float4 r0,r1,r2,r3,r4;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyzw = cb0[37].xyzw * v4.yyyy;
  r0.xyzw = v4.xxxx * cb0[36].xyzw + r0.xyzw;
  r0.xyzw = v4.zzzz * cb0[38].xyzw + r0.xyzw;
  r0.xyzw = cb0[39].xyzw + r0.xyzw;
  r0.xyz = r0.xyz / r0.www;
  
  // Common SVPositionToTranslatedWorld fix:
float4 s = StereoParams.Load(0);
matrix TranslatedWorldToClip = MATRIX(cb0, 0);
matrix ClipToTranslatedWorld = MATRIX(cb0, 32);
float4 t = mul(r0.xyz, TranslatedWorldToClip);
t.x -= s.x * (t.w - s.y);
r0.xyz = mul(t, ClipToTranslatedWorld);
  
  r0.xyz = -cb0[56].xyz + r0.xyz;
  r1.xyz = -cb1[8].xyz + r0.xyz;
  r2.xyz = float3(1,1,1) + cb1[9].xyz;
  r1.xyz = cmp(r2.xyz < abs(r1.xyz));
  r0.w = (int)r1.x | (int)r1.y;
  r0.w = (int)r0.w | (int)r1.z;
  r0.w = (int)r0.w;
  r0.w = cmp(0 != r0.w);
  r0.z = dot(r0.xyz, float3(0.577000022,0.577000022,0.577000022));
  r1.xyzw = float4(0.00100000005,0.00100000005,0.00200000009,0.00200000009) * r0.xyxy;
  r0.x = 0.00200000009 * r0.z;
  r0.x = frac(r0.x);
  r0.x = cmp(0.5 < r0.x);
  r0.xyz = r0.xxx ? float3(0,1,1) : float3(1,1,0);
  r2.xyz = max(float3(0,0,0), cb3[2].xyz);
  r0.xyz = r0.www ? r0.xyz : r2.xyz;
  r0.w = cmp(0 < cb0[122].x);
  r0.xyz = r0.www ? r0.xyz : r2.xyz;
  r2.xyz = v1.xyz * v0.zxy;
  r2.xyz = v1.zxy * v0.xyz + -r2.xyz;
  r2.xyz = v1.www * r2.xyz;
  r3.xy = t2.Sample(s2_s_s, v2.xy).xy;
  r3.xy = r3.xy * float2(2,2) + float2(-1,-1);
  r0.w = dot(r3.xy, r3.xy);
  r0.w = 1 + -r0.w;
  r0.w = max(0, r0.w);
  r3.z = sqrt(r0.w);
  r3.xyz = r3.xyz * cb0[120].www + cb0[120].xyz;
  r0.w = dot(r3.xyz, r3.xyz);
  r0.w = rsqrt(r0.w);
  r3.xyz = r3.xyz * r0.www;
  r2.xyz = r3.yyy * r2.xyz;
  r2.xyz = r3.xxx * v0.yzx + r2.xyz;
  r2.xyz = r3.zzz * v1.yzx + r2.xyz;
  r0.w = dot(r2.xyz, r2.xyz);
  r0.w = rsqrt(r0.w);
  r2.xyz = r2.xyz * r0.www;
  r3.xy = v3.xy * float2(1,0.5) + float2(0,0.5);
  r3.xyzw = t0.Sample(s0_s_s, r3.xy).xyzw;
  r4.xyzw = r3.xyzw * cb2[19].xyzw + cb2[21].xyzw;
  r2.w = 1;
  r0.w = dot(r4.xyzw, r2.xyzw);
  o1.xyz = r2.zxy * float3(0.5,0.5,0.5) + float3(0.5,0.5,0.5);
  r0.w = max(0, r0.w);
  r2.xy = float2(1,0.5) * v3.xy;
  r2.xyzw = t0.Sample(s0_s_s, r2.xy).xyzw;
  r2.w = r3.w * 0.00392156886 + r2.w;
  r2.xyz = r2.xyz * r2.xyz;
  r2.xyz = r2.xyz * cb2[18].xyz + cb2[20].xyz;
  r2.w = -0.00196078443 + r2.w;
  r2.w = r2.w * cb2[18].w + cb2[20].w;
  r2.w = exp2(r2.w);
  r2.w = -0.0185813606 + r2.w;
  r0.w = r2.w * r0.w;
  r2.xyz = r0.www * r2.xyz;
  r2.xyz = cb0[138].xyz * r2.xyz;
  r3.xyz = t3.Sample(s3_s_s, r1.xy).xyz;
  r4.xyz = t4.Sample(s4_s_s, v2.xy).xyz;
  r4.xyz = r4.xyz + -r3.xyz;
  r3.xyz = r4.xyz * float3(0.5,0.5,0.5) + r3.xyz;
  r3.xyz = saturate(cb3[3].xyz * r3.xyz);
  r4.xyz = r3.xyz * cb0[118].www + cb0[118].xyz;
  o3.xyz = r3.xyz;
  r3.xyz = cb0[119].www * float3(0.0399999991,0.0399999991,0.0399999991) + cb0[119].xyz;
  r3.xyz = r3.xyz * float3(0.449999988,0.449999988,0.449999988) + r4.xyz;
  r3.xyz = -r2.xyz * r4.xyz + r3.xyz;
  r4.xyz = r4.xyz * r2.xyz;
  r0.w = dot(r2.xyz, float3(0.300000012,0.589999974,0.109999999));
  r0.w = 0.00390625 + r0.w;
  r0.w = log2(r0.w);
  r0.w = r0.w * 0.0625 + 0.5;
  r2.xyz = cb0[126].yyy * r3.xyz + r4.xyz;
  o0.xyz = r2.xyz + r0.xyz;
  o0.w = 0;
  o1.w = cb1[11].x;
  r0.x = t5.Sample(s5_s_s, r1.zw).x;
  r0.y = t6.Sample(s6_s_s, r1.zw).x;
  r0.xy = float2(1,1) + -r0.xy;
  r0.x = r0.y * r0.x;
  r0.x = saturate(r0.x * 3 + -1);
  o2.z = r0.x * cb0[121].y + cb0[121].x;
  o2.xyw = float3(0,0.5,0.75686276);
  r0.xyz = float3(0.0078125,0.0078125,0.0078125) * v4.xyx;
  r0.xyz = frac(r0.xyz);
  r0.xyz = r0.xyz * float3(128,128,128) + float3(-64.3406219,-72.4656219,-64.3406219);
  r0.xyz = r0.xyz * r0.xyy;
  r0.x = dot(r0.xyz, float3(20.390625,60.703125,2.42812085));
  r0.x = frac(r0.x);
  r0.x = -0.5 + r0.x;
  o3.w = r0.x * 0.00392156886 + r0.w;
  o4.xyzw = float4(0,0,0,0);
  r0.xyzw = t1.Sample(s1_s_s, v3.zw).xyzw;
  r1.xyzw = cb2[7].xyzw * float4(-0.5,-0.5,-0.5,-0.5) + float4(0.5,0.5,0.5,0.5);
  r0.xyzw = saturate(r0.xyzw * cb2[7].xyzw + r1.xyzw);
  r0.xyzw = r0.xyzw * r0.xyzw;
  o5.xyzw = cb2[6].xyzw * r0.xyzw;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20789
//
//   using 3Dmigoto v1.2.57 on Fri Apr 28 19:29:40 2017
//
//
// Buffer Definitions: 
//
// cbuffer cb3
// {
//
//   float4 cb3[4];                     // Offset:    0 Size:    64
//
// }
//
// cbuffer cb2
// {
//
//   float4 cb2[22];                    // Offset:    0 Size:   352
//
// }
//
// cbuffer cb1
// {
//
//   float4 cb1[12];                    // Offset:    0 Size:   192
//
// }
//
// cbuffer cb0
// {
//
//   float4 cb0[139];                   // Offset:    0 Size:  2224
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// s0_s                              sampler      NA          NA    0        1
// s1_s                              sampler      NA          NA    1        1
// s2_s                              sampler      NA          NA    2        1
// s3_s                              sampler      NA          NA    3        1
// s4_s                              sampler      NA          NA    4        1
// s5_s                              sampler      NA          NA    5        1
// s6_s                              sampler      NA          NA    6        1
// t0                                texture  float4          2d    0        1
// t1                                texture  float4          2d    1        1
// t2                                texture  float4          2d    2        1
// t3                                texture  float4          2d    3        1
// t4                                texture  float4          2d    4        1
// t5                                texture  float4          2d    5        1
// t6                                texture  float4          2d    6        1
// cb0                               cbuffer      NA          NA    0        1
// cb1                               cbuffer      NA          NA    1        1
// cb2                               cbuffer      NA          NA    2        1
// cb3                               cbuffer      NA          NA    3        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                10   xyzw        0     NONE   float   xyz 
// TEXCOORD                11   xyzw        1     NONE   float   xyzw
// TEXCOORD                 0   xyzw        2     NONE   float   xy  
// TEXCOORD                 4   xyzw        3     NONE   float   xyzw
// SV_Position              0   xyzw        4      POS   float   xyz 
// SV_IsFrontFace           0   x           5    FFACE    uint       
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
// SV_Target                1   xyzw        1   TARGET   float   xyzw
// SV_Target                2   xyzw        2   TARGET   float   xyzw
// SV_Target                3   xyzw        3   TARGET   float   xyzw
// SV_Target                4   xyzw        4   TARGET   float   xyzw
// SV_Target                5   xyzw        5   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb3[4], immediateIndexed
dcl_constantbuffer cb2[22], immediateIndexed
dcl_constantbuffer cb1[12], immediateIndexed
dcl_constantbuffer cb0[139], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, mode_default
dcl_sampler s4, mode_default
dcl_sampler s5, mode_default
dcl_sampler s6, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texture2d (float,float,float,float) t4
dcl_resource_texture2d (float,float,float,float) t5
dcl_resource_texture2d (float,float,float,float) t6
dcl_input_ps linear centroid v0.xyz
dcl_input_ps linear centroid v1.xyzw
dcl_input_ps linear v2.xy
dcl_input_ps linear v3.xyzw
dcl_input_ps_siv linear noperspective v4.xyz, position
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_temps 5
mul r0.xyzw, v4.yyyy, cb0[37].xyzw
mad r0.xyzw, v4.xxxx, cb0[36].xyzw, r0.xyzw
mad r0.xyzw, v4.zzzz, cb0[38].xyzw, r0.xyzw
add r0.xyzw, r0.xyzw, cb0[39].xyzw
div r0.xyz, r0.xyzx, r0.wwww
add r0.xyz, r0.xyzx, -cb0[56].xyzx
add r1.xyz, r0.xyzx, -cb1[8].xyzx
add r2.xyz, cb1[9].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r1.xyz, r2.xyzx, |r1.xyzx|
or r0.w, r1.x, r1.y
or r0.w, r0.w, r1.z
itof r0.w, r0.w
ne r0.w, l(0.000000, 0.000000, 0.000000, 0.000000), r0.w
dp3 r0.z, r0.xyzx, l(0.577000, 0.577000, 0.577000, 0.000000)
mul r1.xyzw, r0.xyxy, l(0.001000, 0.001000, 0.002000, 0.002000)
mul r0.x, r0.z, l(0.002000)
frc r0.x, r0.x
lt r0.x, l(0.500000), r0.x
movc r0.xyz, r0.xxxx, l(0,1.000000,1.000000,0), l(1.000000,1.000000,0,0)
max r2.xyz, cb3[2].xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
movc r0.xyz, r0.wwww, r0.xyzx, r2.xyzx
lt r0.w, l(0.000000), cb0[122].x
movc r0.xyz, r0.wwww, r0.xyzx, r2.xyzx
mul r2.xyz, v0.zxyz, v1.xyzx
mad r2.xyz, v1.zxyz, v0.xyzx, -r2.xyzx
mul r2.xyz, r2.xyzx, v1.wwww
sample_indexable(texture2d)(float,float,float,float) r3.xy, v2.xyxx, t2.xyzw, s2
mad r3.xy, r3.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r0.w, r3.xyxx, r3.xyxx
add r0.w, -r0.w, l(1.000000)
max r0.w, r0.w, l(0.000000)
sqrt r3.z, r0.w
mad r3.xyz, r3.xyzx, cb0[120].wwww, cb0[120].xyzx
dp3 r0.w, r3.xyzx, r3.xyzx
rsq r0.w, r0.w
mul r3.xyz, r0.wwww, r3.xyzx
mul r2.xyz, r2.xyzx, r3.yyyy
mad r2.xyz, r3.xxxx, v0.yzxy, r2.xyzx
mad r2.xyz, r3.zzzz, v1.yzxy, r2.xyzx
dp3 r0.w, r2.xyzx, r2.xyzx
rsq r0.w, r0.w
mul r2.xyz, r0.wwww, r2.xyzx
mad r3.xy, v3.xyxx, l(1.000000, 0.500000, 0.000000, 0.000000), l(0.000000, 0.500000, 0.000000, 0.000000)
sample_indexable(texture2d)(float,float,float,float) r3.xyzw, r3.xyxx, t0.xyzw, s0
mad r4.xyzw, r3.xyzw, cb2[19].xyzw, cb2[21].xyzw
mov r2.w, l(1.000000)
dp4 r0.w, r4.xyzw, r2.xyzw
mad o1.xyz, r2.zxyz, l(0.500000, 0.500000, 0.500000, 0.000000), l(0.500000, 0.500000, 0.500000, 0.000000)
max r0.w, r0.w, l(0.000000)
mul r2.xy, v3.xyxx, l(1.000000, 0.500000, 0.000000, 0.000000)
sample_indexable(texture2d)(float,float,float,float) r2.xyzw, r2.xyxx, t0.xyzw, s0
mad r2.w, r3.w, l(0.00392156886), r2.w
mul r2.xyz, r2.xyzx, r2.xyzx
mad r2.xyz, r2.xyzx, cb2[18].xyzx, cb2[20].xyzx
add r2.w, r2.w, l(-0.00196078443)
mad r2.w, r2.w, cb2[18].w, cb2[20].w
exp r2.w, r2.w
add r2.w, r2.w, l(-0.0185813606)
mul r0.w, r0.w, r2.w
mul r2.xyz, r2.xyzx, r0.wwww
mul r2.xyz, r2.xyzx, cb0[138].xyzx
sample_indexable(texture2d)(float,float,float,float) r3.xyz, r1.xyxx, t3.xyzw, s3
sample_indexable(texture2d)(float,float,float,float) r4.xyz, v2.xyxx, t4.xyzw, s4
add r4.xyz, -r3.xyzx, r4.xyzx
mad r3.xyz, r4.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000), r3.xyzx
mul_sat r3.xyz, r3.xyzx, cb3[3].xyzx
mad r4.xyz, r3.xyzx, cb0[118].wwww, cb0[118].xyzx
mov o3.xyz, r3.xyzx
mad r3.xyz, cb0[119].wwww, l(0.040000, 0.040000, 0.040000, 0.000000), cb0[119].xyzx
mad r3.xyz, r3.xyzx, l(0.450000, 0.450000, 0.450000, 0.000000), r4.xyzx
mad r3.xyz, -r2.xyzx, r4.xyzx, r3.xyzx
mul r4.xyz, r2.xyzx, r4.xyzx
dp3 r0.w, r2.xyzx, l(0.300000, 0.590000, 0.110000, 0.000000)
add r0.w, r0.w, l(0.00390625000)
log r0.w, r0.w
mad r0.w, r0.w, l(0.062500), l(0.500000)
mad r2.xyz, cb0[126].yyyy, r3.xyzx, r4.xyzx
add o0.xyz, r0.xyzx, r2.xyzx
mov o0.w, l(0)
mov o1.w, cb1[11].x
sample_indexable(texture2d)(float,float,float,float) r0.x, r1.zwzz, t5.xyzw, s5
sample_indexable(texture2d)(float,float,float,float) r0.y, r1.zwzz, t6.yxzw, s6
add r0.xy, -r0.xyxx, l(1.000000, 1.000000, 0.000000, 0.000000)
mul r0.x, r0.x, r0.y
mad_sat r0.x, r0.x, l(3.000000), l(-1.000000)
mad o2.z, r0.x, cb0[121].y, cb0[121].x
mov o2.xyw, l(0,0.500000,0,0.756862760)
mul r0.xyz, v4.xyxx, l(0.00781250000, 0.00781250000, 0.00781250000, 0.000000)
frc r0.xyz, r0.xyzx
mad r0.xyz, r0.xyzx, l(128.000000, 128.000000, 128.000000, 0.000000), l(-64.340622, -72.465622, -64.340622, 0.000000)
mul r0.xyz, r0.xyyx, r0.xyzx
dp3 r0.x, r0.xyzx, l(20.390625, 60.703125, 2.42812085, 0.000000)
frc r0.x, r0.x
add r0.x, r0.x, l(-0.500000)
mad o3.w, r0.x, l(0.00392156886), r0.w
mov o4.xyzw, l(0,0,0,0)
sample_indexable(texture2d)(float,float,float,float) r0.xyzw, v3.zwzz, t1.xyzw, s1
mad r1.xyzw, cb2[7].xyzw, l(-0.500000, -0.500000, -0.500000, -0.500000), l(0.500000, 0.500000, 0.500000, 0.500000)
mad_sat r0.xyzw, r0.xyzw, cb2[7].xyzw, r1.xyzw
mul r0.xyzw, r0.xyzw, r0.xyzw
mul o5.xyzw, r0.xyzw, cb2[6].xyzw
ret 
// Approximately 102 instruction slots used

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