//Temporal antialiasing (TAA).
// ---- Created with 3Dmigoto v1.3.16 on Wed Oct  6 23:04:10 2021

cbuffer fblock : register(b0)
{
  float4 renderpositiontoviewtexture : packoffset(c0);
  float4 lightprepassinverseparams : packoffset(c1);
  float4 prevviewposition : packoffset(c2);
  float4 prevviewprojectionmatrixrcx : packoffset(c3);
  float4 prevviewprojectionmatrixrcy : packoffset(c4);
  float4 prevviewprojectionmatrixrcw : packoffset(c5);
  float4 projectionmatrixz : packoffset(c6);
  float4 blurstep : packoffset(c7);
  float4 motionblurparms : packoffset(c8);
  float4 texsize : packoffset(c9);
  float4 tsaaparm : packoffset(c10);
}

cbuffer cb13 : register(b13)
{
  float4 cb13[40];
}

SamplerState viewdepthmap_samp_state_s : register(s0);
SamplerState tex3_samp_state_s : register(s1);
SamplerState tex0_samp_state_s : register(s2);
SamplerState tex7_samp_state_s : register(s3);
SamplerState tex1_samp_state_s : register(s4);
SamplerState tex5_samp_state_s : register(s5);
SamplerState tex6_samp_state_s : register(s6);
Texture2D<float4> viewdepthmap_samp : register(t0);
Texture2D<float4> tex3_samp : register(t1);
Texture2D<float4> tex0_samp : register(t2);
Texture2D<float4> tex7_samp : register(t3);
Texture2D<float4> tex1_samp : register(t4);
Texture2D<float4> tex5_samp : register(t5);
Texture2D<float4> tex6_samp : register(t6);


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


void main(
  float4 v0 : TEXCOORD1,
  float4 v1 : TEXCOORD2,
  float4 v2 : SV_Position0,
  out float4 o0 : SV_Target0,
  out float4 o1 : SV_Target1,
  out float4 o2 : SV_Target2)
{
  float4 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16,r17,r18,r20,r21;
  uint4 bitmask, uiDest;
  float4 fDest;
  
  float4 stereo = StereoParams.Load(0);
  float4 iniparams5 = IniParams.Load(int2(5,0));
  
  r0.xy = v2.xy * renderpositiontoviewtexture.zw + renderpositiontoviewtexture.xy;
  r0.z = viewdepthmap_samp.SampleLevel(viewdepthmap_samp_state_s, r0.xy, 0).x;
  
  r21.xyzw = -v1.xyzw + v0.xyzw;
  r21.xyzw = r0.zzzz * r21.xyzw + v1.xyzw;
  
  r20=v0;
  r20.x+=stereo.x*(r21.w*stereo.y-1)*cb13[0].x/r0.z;
  r20.y+=stereo.x*(r21.w*stereo.y-1)*cb13[1].x/r0.z;
  r20.z+=stereo.x*(r21.w*stereo.y-1)*cb13[2].x/r0.z;
  
  r1.xyzw = -v1.xyzw + r20.xyzw;
  r1.xyzw = r0.zzzz * r1.xyzw + v1.xyzw;
  r1.xyz = r1.xyz / r1.www;
  r1.xyz = lightprepassinverseparams.xyz + r1.xyz;
  r1.xyz = -prevviewposition.xyz + r1.xyz;
  r1.w = 1;
  r2.x = dot(r1.xyzw, prevviewprojectionmatrixrcx.xyzw);
  r2.y = dot(r1.xyzw, prevviewprojectionmatrixrcy.xyzw);
  r0.w = dot(r1.xyzw, prevviewprojectionmatrixrcw.xyzw);
  
  r2.x+=stereo.x*(r0.w-stereo.y);
  
  r1.xy = r2.xy / r0.ww;
  r1.xy = r1.xy * float2(0.5,0.5) + float2(0.5,0.5);
  r2.xy = tex3_samp.SampleLevel(tex3_samp_state_s, r0.xy, 0).xy;
  r0.w = cmp(r2.x < 1);
  r1.z = 1 + -r1.y;
  r1.xy = -r1.xz + r0.xy;
  r1.xy = r0.ww ? r2.xy : r1.xy;
  r1.zw = cmp(r1.xy != r1.xy);
  r1.z = (int)r1.w | (int)r1.z;
  r2.zw = (int2)r1.xy & int2(0x7fffffff,0x7fffffff);
  r2.zw = cmp((int2)r2.zw == int2(0x7f800000,0x7f800000));
  r1.z = (int)r1.z | (int)r2.z;
  r1.z = (int)r2.w | (int)r1.z;
  r1.w = projectionmatrixz.z + r0.z;
  r3.w = projectionmatrixz.w / r1.w;
  r1.w = cmp(blurstep.y == 0.000000);
  r1.w = r0.w ? r1.w : 0;
  r1.w = (int)r1.w | (int)r1.z;
  r4.xy = r1.ww ? float2(0,0) : r1.xy;
  r2.zw = motionblurparms.zz * r4.xy;
  r1.w = dot(r2.zw, r2.zw);
  r1.w = rsqrt(r1.w);
  r1.w = saturate(motionblurparms.w * r1.w);
  r2.zw = r2.zw * r1.ww;
  r2.zw = motionblurparms.xy * r2.zw;
  r1.w = dot(r2.zw, r2.zw);
  r4.z = sqrt(r1.w);
  r1.w = -renderpositiontoviewtexture.z * 0.00999999978 + r4.z;
  r1.w = cmp(0 >= r1.w);
  r3.xyz = r1.www ? float3(0,0,0) : r4.xyz;
  r2.zw = blurstep.yx * r3.zz;
  r1.w = r0.w ? r2.z : r2.w;
  r1.w = blurstep.z * r1.w;
  r3.z = r0.w ? r1.w : r2.w;
  r4.xyz = tex0_samp.SampleLevel(tex0_samp_state_s, r0.xy, 0).xyz;
  r5.w = dot(r4.xyz, float3(0.212599993,0.715200007,0.0722000003));
  r1.w = r5.w * 4 + 4;
  r6.xyz = saturate(r4.xyz / r1.www);
  r1.xy = r1.zz ? float2(-0,-0) : -r1.xy;
  r1.xy = r1.xy + r0.xy;
  r1.zw = r1.xy * float2(2,2) + float2(-1,-1);
  r7.xyzw = tex7_samp.SampleLevel(tex7_samp_state_s, r0.xy, 0).xyzw;
  r1.zw = cmp(abs(r1.zw) >= float2(1,1));
  r1.z = (int)r1.w | (int)r1.z;
  r0.z = cmp(r0.z >= 1);
  r0.z = (int)r0.z | (int)r1.z;
  r8.xyz = float3(4,4,4) * r6.xyz;
  r1.z = dot(r6.xyz, float3(0.212599993,0.715200007,0.0722000003));
  r1.z = -r1.z * 4 + 1;
  r8.xyz = r8.xyz / r1.zzz;
  r9.xyz = r8.xyz * r7.www + r7.xyz;
  r10.xyz = cmp(r9.xyz != r9.xyz);
  r1.z = (int)r10.y | (int)r10.x;
  r1.z = (int)r10.z | (int)r1.z;
  r10.xyz = (int3)r9.xyz & int3(0x7fffffff,0x7fffffff,0x7fffffff);
  r10.xyz = cmp((int3)r10.xyz == int3(0x7f800000,0x7f800000,0x7f800000));
  r1.z = (int)r1.z | (int)r10.x;
  r1.z = (int)r10.y | (int)r1.z;
  r1.z = (int)r10.z | (int)r1.z;
  r9.xyz = r1.zzz ? float3(0,0,0) : r9.xyz;
  r9.xyz = max(float3(0,0,0), r9.xyz);
  o1.xyz = min(float3(1024,1024,1024), r9.xyz);
  o0.xyz = r8.xyz;
  o0.w = 0;
  o1.w = 1;
  o2.xyzw = r3.xyzw;
  if (r0.z != 0) return;
  
  //Return here to disable TAA.
  if (iniparams5.y==0) {
    return;
  }
  
  r8.xyz = r0.zzz ? r8.xyz : r6.xyz;
  r1.zw = r1.xy * texsize.xy + float2(-0.5,-0.5);
  r1.zw = floor(r1.zw);
  r9.xyzw = float4(0.5,0.5,-0.5,-0.5) + r1.zwzw;
  r2.zw = r1.xy * texsize.xy + -r9.xy;
  r10.xy = r2.zw * r2.zw;
  r10.zw = r10.xy * r2.zw;
  r11.xy = r10.xy * r2.zw + r2.zw;
  r11.xy = -r11.xy * float2(0.5,0.5) + r10.xy;
  r11.zw = float2(2.5,2.5) * r10.xy;
  r10.zw = r10.zw * float2(1.5,1.5) + -r11.zw;
  r10.zw = float2(1,1) + r10.zw;
  r2.zw = r10.xy * r2.zw + -r10.xy;
  r10.xy = float2(0.5,0.5) * r2.zw;
  r11.zw = float2(1,1) + -r11.xy;
  r11.zw = r11.zw + -r10.zw;
  r2.zw = -r2.zw * float2(0.5,0.5) + r11.zw;
  r10.zw = r10.zw + r2.zw;
  r12.xw = texsize.zw * r9.zw;
  r2.zw = r2.zw / r10.zw;
  r2.zw = r9.xy + r2.zw;
  r12.yz = texsize.wz * r2.wz;
  r1.zw = float2(2.5,2.5) + r1.zw;
  r9.xy = texsize.zw * r1.zw;
  r13.xyz = tex1_samp.SampleLevel(tex1_samp_state_s, r12.xw, 0).xyz;
  r13.xyz = r13.xyz * r11.xxx;
  r14.xyz = tex1_samp.SampleLevel(tex1_samp_state_s, r12.zw, 0).xyz;
  r14.xyz = r14.xyz * r10.zzz;
  r14.xyz = r14.xyz * r11.yyy;
  r13.xyz = r13.xyz * r11.yyy + r14.xyz;
  r9.zw = r12.wy;
  r14.xyz = tex1_samp.SampleLevel(tex1_samp_state_s, r9.xz, 0).xyz;
  r14.xyz = r14.xyz * r10.xxx;
  r11.yzw = r14.xyz * r11.yyy + r13.xyz;
  r13.xyz = tex1_samp.SampleLevel(tex1_samp_state_s, r12.xy, 0).xyz;
  r13.xyz = r13.xyz * r11.xxx;
  r11.yzw = r13.xyz * r10.www + r11.yzw;
  r13.xyz = tex1_samp.SampleLevel(tex1_samp_state_s, r12.zy, 0).xyz;
  r13.xyz = r13.xyz * r10.zzz;
  r11.yzw = r13.xyz * r10.www + r11.yzw;
  r13.xyz = tex1_samp.SampleLevel(tex1_samp_state_s, r9.xw, 0).xyz;
  r13.xyz = r13.xyz * r10.xxx;
  r11.yzw = r13.xyz * r10.www + r11.yzw;
  r12.y = r9.y;
  r13.xyz = tex1_samp.SampleLevel(tex1_samp_state_s, r12.xy, 0).xyz;
  r13.xyz = r13.xyz * r11.xxx;
  r11.xyz = r13.xyz * r10.yyy + r11.yzw;
  r12.xyz = tex1_samp.SampleLevel(tex1_samp_state_s, r12.zy, 0).xyz;
  r12.xyz = r12.xyz * r10.zzz;
  r11.xyz = r12.xyz * r10.yyy + r11.xyz;
  r9.xyz = tex1_samp.SampleLevel(tex1_samp_state_s, r9.xy, 0).xyz;
  r9.xyz = r9.xyz * r10.xxx;
  r9.xyz = r9.xyz * r10.yyy + r11.xyz;
  r0.z = dot(r9.xyz, float3(0.212599993,0.715200007,0.0722000003));
  r0.z = r0.z * 4 + 4;
  r9.xyz = saturate(r9.xyz / r0.zzz);
  r1.zw = -texsize.zw + r0.xy;
  r10.xyz = tex0_samp.SampleLevel(tex0_samp_state_s, r1.zw, 0).xyz;
  r0.z = dot(r10.xyz, float3(0.212599993,0.715200007,0.0722000003));
  r0.z = r0.z * 4 + 4;
  r10.xyz = saturate(r10.xyz / r0.zzz);
  r11.xyzw = texsize.zwzw * float4(0,-1,1,-1) + r0.xyxy;
  r12.xyz = tex0_samp.SampleLevel(tex0_samp_state_s, r11.xy, 0).xyz;
  r0.z = dot(r12.xyz, float3(0.212599993,0.715200007,0.0722000003));
  r0.z = r0.z * 4 + 4;
  r12.xyz = saturate(r12.xyz / r0.zzz);
  r11.xyz = tex0_samp.SampleLevel(tex0_samp_state_s, r11.zw, 0).xyz;
  r0.z = dot(r11.xyz, float3(0.212599993,0.715200007,0.0722000003));
  r0.z = r0.z * 4 + 4;
  r11.xyz = saturate(r11.xyz / r0.zzz);
  r13.xyzw = texsize.zwzw * float4(-1,0,1,0) + r0.xyxy;
  r14.xyz = tex0_samp.SampleLevel(tex0_samp_state_s, r13.xy, 0).xyz;
  r0.z = dot(r14.xyz, float3(0.212599993,0.715200007,0.0722000003));
  r0.z = r0.z * 4 + 4;
  r14.xyz = saturate(r14.xyz / r0.zzz);
  r13.xyz = tex0_samp.SampleLevel(tex0_samp_state_s, r13.zw, 0).xyz;
  r0.z = dot(r13.xyz, float3(0.212599993,0.715200007,0.0722000003));
  r0.z = r0.z * 4 + 4;
  r13.xyz = saturate(r13.xyz / r0.zzz);
  r15.xyzw = texsize.zwzw * float4(-1,1,0,1) + r0.xyxy;
  r16.xyz = tex0_samp.SampleLevel(tex0_samp_state_s, r15.xy, 0).xyz;
  r0.z = dot(r16.xyz, float3(0.212599993,0.715200007,0.0722000003));
  r0.z = r0.z * 4 + 4;
  r16.xyz = saturate(r16.xyz / r0.zzz);
  r15.xyz = tex0_samp.SampleLevel(tex0_samp_state_s, r15.zw, 0).xyz;
  r0.z = dot(r15.xyz, float3(0.212599993,0.715200007,0.0722000003));
  r0.z = r0.z * 4 + 4;
  r15.xyz = saturate(r15.xyz / r0.zzz);
  r1.zw = texsize.zw + r0.xy;
  r17.xyz = tex0_samp.SampleLevel(tex0_samp_state_s, r1.zw, 0).xyz;
  r0.z = dot(r17.xyz, float3(0.212599993,0.715200007,0.0722000003));
  r0.z = r0.z * 4 + 4;
  r17.xyz = saturate(r17.xyz / r0.zzz);
  r18.xyz = min(r12.xyz, r10.xyz);
  r18.xyz = min(r18.xyz, r11.xyz);
  r18.xyz = min(r18.xyz, r14.xyz);
  r18.xyz = min(r18.xyz, r6.xyz);
  r18.xyz = min(r18.xyz, r13.xyz);
  r18.xyz = min(r18.xyz, r16.xyz);
  r18.xyz = min(r18.xyz, r15.xyz);
  r18.xyz = min(r18.xyz, r17.xyz);
  r10.xyz = max(r12.xyz, r10.xyz);
  r10.xyz = max(r10.xyz, r11.xyz);
  r10.xyz = max(r10.xyz, r14.xyz);
  r10.xyz = max(r10.xyz, r6.xyz);
  r10.xyz = max(r10.xyz, r13.xyz);
  r10.xyz = max(r10.xyz, r16.xyz);
  r10.xyz = max(r10.xyz, r15.xyz);
  r10.xyz = max(r10.xyz, r17.xyz);
  r11.xyz = min(r14.xyz, r12.xyz);
  r11.xyz = min(r11.xyz, r6.xyz);
  r11.xyz = min(r13.xyz, r11.xyz);
  r11.xyz = min(r15.xyz, r11.xyz);
  r12.xyz = max(r14.xyz, r12.xyz);
  r6.xyz = max(r12.xyz, r6.xyz);
  r6.xyz = max(r13.xyz, r6.xyz);
  r6.xyz = max(r15.xyz, r6.xyz);
  r11.xyz = r18.xyz + r11.xyz;
  r11.xyz = float3(0.5,0.5,0.5) * r11.xyz;
  r6.xyz = r10.xyz + r6.xyz;
  r10.xyz = float3(0.5,0.5,0.5) * r6.xyz;
  r12.xyz = r6.xyz * float3(0.5,0.5,0.5) + r11.xyz;
  r6.xyz = r6.xyz * float3(0.5,0.5,0.5) + -r11.xyz;
  r6.xyz = float3(0.5,0.5,0.5) * r6.xyz;
  r13.xyz = -r12.xyz * float3(0.5,0.5,0.5) + r9.xyz;
  r6.xyz = r13.xyz / r6.xyz;
  r0.z = max(abs(r6.y), abs(r6.z));
  r0.z = max(abs(r6.x), r0.z);
  r1.z = cmp(1 < r0.z);
  r6.xyz = r13.xyz / r0.zzz;
  r6.xyz = r12.xyz * float3(0.5,0.5,0.5) + r6.xyz;
  r6.xyz = r1.zzz ? r6.xyz : r9.xyz;
  r0.z = dot(r6.xyz, float3(0.212599993,0.715200007,0.0722000003));
  r1.z = dot(r10.xyz, float3(0.212599993,0.715200007,0.0722000003));
  r1.w = dot(r11.xyz, float3(0.212599993,0.715200007,0.0722000003));
  r2.z = r1.z + -r1.w;
  r1.z = -r1.z + r0.z;
  r0.z = -r1.w + r0.z;
  r0.z = min(abs(r1.z), abs(r0.z));
  r1.z = 0.125 * r0.z;
  r0.z = r0.z * 0.125 + r2.z;
  r0.z = saturate(r1.z / r0.z);
  r0.z = 1 + -r0.z;
  r0.x = tex5_samp.SampleLevel(tex5_samp_state_s, r0.xy, 0).x;
  r0.x = 255 * r0.x;
  r0.x = (uint)r0.x;
  r0.y = tex6_samp.SampleLevel(tex6_samp_state_s, r1.xy, 0).x;
  r0.y = 255 * r0.y;
  r0.y = (uint)r0.y;
  r1.xyzw = (int4)r0.xxxx & int4(2,1,16,32);
  r0.x = (int)r0.y & 2;
  r0.x = cmp((int)r0.x != (int)r1.x);
  r0.x = r0.x ? 0 : r0.z;
  r0.y = dot(r2.xy, r2.xy);
  r0.y = sqrt(r0.y);
  r0.y = r0.w ? r0.y : 0;
  r0.z = max(texsize.z, texsize.w);
  r0.z = 0.0500000007 * r0.z;
  r0.y = cmp(r0.z < r0.y);
  r0.z = min(0.75, r0.x);
  r0.x = r0.y ? r0.z : r0.x;
  r0.y = cmp(tsaaparm.w == 0.000000);
  r1.xyz = cmp((int3)r1.yzw == int3(1,16,32));
  r0.yzw = r0.yyy ? r1.xyz : 0;
  r1.xy = min(float2(0.25,0.5), r0.xx);
  r0.x = r0.z ? r1.y : r0.x;
  r0.x = r0.y ? r1.x : r0.x;
  r1.xyz = r6.xyz + -r8.xyz;
  r0.xyz = r0.xxx * r1.xyz + r8.xyz;
  r1.xyz = float3(4,4,4) * r0.xyz;
  r0.x = dot(r0.xyz, float3(0.212599993,0.715200007,0.0722000003));
  r0.x = -r0.x * 4 + 1;
  r0.xyz = r1.xyz / r0.xxx;
  r5.xyz = r0.www ? r4.xyz : r0.xyz;
  r0.xyz = r5.xyz * r7.www + r7.xyz;
  r1.xyz = cmp(r0.xyz != r0.xyz);
  r0.w = (int)r1.y | (int)r1.x;
  r0.w = (int)r1.z | (int)r0.w;
  r1.xyz = (int3)r0.xyz & int3(0x7fffffff,0x7fffffff,0x7fffffff);
  r1.xyz = cmp((int3)r1.xyz == int3(0x7f800000,0x7f800000,0x7f800000));
  r0.w = (int)r0.w | (int)r1.x;
  r0.w = (int)r1.y | (int)r0.w;
  r0.w = (int)r1.z | (int)r0.w;
  r0.xyz = r0.www ? float3(0,0,0) : r0.xyz;
  r0.xyz = max(float3(0,0,0), r0.xyz);
  o1.xyz = min(float3(1024,1024,1024), r0.xyz);
  o0.xyzw = r5.xyzw;
  o1.w = 1;
  o2.xyzw = r3.xyzw;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.16 on Wed Oct  6 23:04:10 2021
//
//
// Buffer Definitions:
//
// cbuffer fblock
// {
//
//   float4 renderpositiontoviewtexture;// Offset:    0 Size:    16
//   float4 lightprepassinverseparams;  // Offset:   16 Size:    16
//   float4 prevviewposition;           // Offset:   32 Size:    16
//   float4 prevviewprojectionmatrixrcx;// Offset:   48 Size:    16
//   float4 prevviewprojectionmatrixrcy;// Offset:   64 Size:    16
//   float4 prevviewprojectionmatrixrcw;// Offset:   80 Size:    16
//   float4 projectionmatrixz;          // Offset:   96 Size:    16
//   float4 blurstep;                   // Offset:  112 Size:    16
//   float4 motionblurparms;            // Offset:  128 Size:    16
//   float4 texsize;                    // Offset:  144 Size:    16
//   float4 tsaaparm;                   // Offset:  160 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// viewdepthmap_samp_state           sampler      NA          NA    0        1
// tex3_samp_state                   sampler      NA          NA    1        1
// tex0_samp_state                   sampler      NA          NA    2        1
// tex7_samp_state                   sampler      NA          NA    3        1
// tex1_samp_state                   sampler      NA          NA    4        1
// tex5_samp_state                   sampler      NA          NA    5        1
// tex6_samp_state                   sampler      NA          NA    6        1
// viewdepthmap_samp                 texture  float4          2d    0        1
// tex3_samp                         texture  float4          2d    1        1
// tex0_samp                         texture  float4          2d    2        1
// tex7_samp                         texture  float4          2d    3        1
// tex1_samp                         texture  float4          2d    4        1
// tex5_samp                         texture  float4          2d    5        1
// tex6_samp                         texture  float4          2d    6        1
// fblock                            cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 1   xyzw        0     NONE   float   xyzw
// TEXCOORD                 2   xyzw        1     NONE   float   xyzw
// SV_Position              0   xyzw        2      POS   float   xy
//
//
// 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
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[11], 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 v0.xyzw
dcl_input_ps linear v1.xyzw
dcl_input_ps_siv linear noperspective v2.xy, position
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_temps 19
mad r0.xy, v2.xyxx, cb0[0].zwzz, cb0[0].xyxx
sample_l_indexable(texture2d)(float,float,float,float) r0.z, r0.xyxx, t0.yzxw, s0, l(0.000000)
add r1.xyzw, v0.xyzw, -v1.xyzw
mad r1.xyzw, r0.zzzz, r1.xyzw, v1.xyzw
div r1.xyz, r1.xyzx, r1.wwww
add r1.xyz, r1.xyzx, cb0[1].xyzx
add r1.xyz, r1.xyzx, -cb0[2].xyzx
mov r1.w, l(1.000000)
dp4 r2.x, r1.xyzw, cb0[3].xyzw
dp4 r2.y, r1.xyzw, cb0[4].xyzw
dp4 r0.w, r1.xyzw, cb0[5].xyzw
div r1.xy, r2.xyxx, r0.wwww
mad r1.xy, r1.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
sample_l_indexable(texture2d)(float,float,float,float) r2.xy, r0.xyxx, t1.xyzw, s1, l(0.000000)
lt r0.w, r2.x, l(1.000000)
add r1.z, -r1.y, l(1.000000)
add r1.xy, r0.xyxx, -r1.xzxx
movc r1.xy, r0.wwww, r2.xyxx, r1.xyxx
ne r1.zw, r1.xxxy, r1.xxxy
or r1.z, r1.w, r1.z
and r2.zw, r1.xxxy, l(0, 0, 0x7fffffff, 0x7fffffff)
ieq r2.zw, r2.zzzw, l(0, 0, 0x7f800000, 0x7f800000)
or r1.z, r1.z, r2.z
or r1.z, r2.w, r1.z
add r1.w, r0.z, cb0[6].z
div r3.w, cb0[6].w, r1.w
eq r1.w, cb0[7].y, l(0.000000)
and r1.w, r0.w, r1.w
or r1.w, r1.w, r1.z
movc r4.xy, r1.wwww, l(0,0,0,0), r1.xyxx
mul r2.zw, r4.xxxy, cb0[8].zzzz
dp2 r1.w, r2.zwzz, r2.zwzz
rsq r1.w, r1.w
mul_sat r1.w, r1.w, cb0[8].w
mul r2.zw, r1.wwww, r2.zzzw
mul r2.zw, r2.zzzw, cb0[8].xxxy
dp2 r1.w, r2.zwzz, r2.zwzz
sqrt r4.z, r1.w
mad r1.w, -cb0[0].z, l(0.010000), r4.z
ge r1.w, l(0.000000), r1.w
movc r3.xyz, r1.wwww, l(0,0,0,0), r4.xyzx
mul r2.zw, r3.zzzz, cb0[7].yyyx
movc r1.w, r0.w, r2.z, r2.w
mul r1.w, r1.w, cb0[7].z
movc r3.z, r0.w, r1.w, r2.w
sample_l_indexable(texture2d)(float,float,float,float) r4.xyz, r0.xyxx, t2.xyzw, s2, l(0.000000)
dp3 r5.w, r4.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
mad r1.w, r5.w, l(4.000000), l(4.000000)
div_sat r6.xyz, r4.xyzx, r1.wwww
movc r1.xy, r1.zzzz, l(-0.000000,-0.000000,0,0), -r1.xyxx
add r1.xy, r0.xyxx, r1.xyxx
mad r1.zw, r1.xxxy, l(0.000000, 0.000000, 2.000000, 2.000000), l(0.000000, 0.000000, -1.000000, -1.000000)
sample_l_indexable(texture2d)(float,float,float,float) r7.xyzw, r0.xyxx, t3.xyzw, s3, l(0.000000)
ge r1.zw, |r1.zzzw|, l(0.000000, 0.000000, 1.000000, 1.000000)
or r1.z, r1.w, r1.z
ge r0.z, r0.z, l(1.000000)
or r0.z, r0.z, r1.z
mul r8.xyz, r6.xyzx, l(4.000000, 4.000000, 4.000000, 0.000000)
dp3 r1.z, r6.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
mad r1.z, -r1.z, l(4.000000), l(1.000000)
div r8.xyz, r8.xyzx, r1.zzzz
mad r9.xyz, r8.xyzx, r7.wwww, r7.xyzx
ne r10.xyz, r9.xyzx, r9.xyzx
or r1.z, r10.y, r10.x
or r1.z, r10.z, r1.z
and r10.xyz, r9.xyzx, l(0x7fffffff, 0x7fffffff, 0x7fffffff, 0)
ieq r10.xyz, r10.xyzx, l(0x7f800000, 0x7f800000, 0x7f800000, 0)
or r1.z, r1.z, r10.x
or r1.z, r10.y, r1.z
or r1.z, r10.z, r1.z
movc r9.xyz, r1.zzzz, l(0,0,0,0), r9.xyzx
max r9.xyz, r9.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
min o1.xyz, r9.xyzx, l(1024.000000, 1024.000000, 1024.000000, 0.000000)
mov o0.xyz, r8.xyzx
mov o0.w, l(0)
mov o1.w, l(1.000000)
mov o2.xyzw, r3.xyzw
retc_nz r0.z
movc r8.xyz, r0.zzzz, r8.xyzx, r6.xyzx
mad r1.zw, r1.xxxy, cb0[9].xxxy, l(0.000000, 0.000000, -0.500000, -0.500000)
round_ni r1.zw, r1.zzzw
add r9.xyzw, r1.zwzw, l(0.500000, 0.500000, -0.500000, -0.500000)
mad r2.zw, r1.xxxy, cb0[9].xxxy, -r9.xxxy
mul r10.xy, r2.zwzz, r2.zwzz
mul r10.zw, r2.zzzw, r10.xxxy
mad r11.xy, r10.xyxx, r2.zwzz, r2.zwzz
mad r11.xy, -r11.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000), r10.xyxx
mul r11.zw, r10.xxxy, l(0.000000, 0.000000, 2.500000, 2.500000)
mad r10.zw, r10.zzzw, l(0.000000, 0.000000, 1.500000, 1.500000), -r11.zzzw
add r10.zw, r10.zzzw, l(0.000000, 0.000000, 1.000000, 1.000000)
mad r2.zw, r10.xxxy, r2.zzzw, -r10.xxxy
mul r10.xy, r2.zwzz, l(0.500000, 0.500000, 0.000000, 0.000000)
add r11.zw, -r11.xxxy, l(0.000000, 0.000000, 1.000000, 1.000000)
add r11.zw, -r10.zzzw, r11.zzzw
mad r2.zw, -r2.zzzw, l(0.000000, 0.000000, 0.500000, 0.500000), r11.zzzw
add r10.zw, r2.zzzw, r10.zzzw
mul r12.xw, r9.zzzw, cb0[9].zzzw
div r2.zw, r2.zzzw, r10.zzzw
add r2.zw, r2.zzzw, r9.xxxy
mul r12.yz, r2.wwzw, cb0[9].wwzw
add r1.zw, r1.zzzw, l(0.000000, 0.000000, 2.500000, 2.500000)
mul r9.xy, r1.zwzz, cb0[9].zwzz
sample_l_indexable(texture2d)(float,float,float,float) r13.xyz, r12.xwxx, t4.xyzw, s4, l(0.000000)
mul r13.xyz, r11.xxxx, r13.xyzx
sample_l_indexable(texture2d)(float,float,float,float) r14.xyz, r12.zwzz, t4.xyzw, s4, l(0.000000)
mul r14.xyz, r10.zzzz, r14.xyzx
mul r14.xyz, r11.yyyy, r14.xyzx
mad r13.xyz, r13.xyzx, r11.yyyy, r14.xyzx
mov r9.zw, r12.wwwy
sample_l_indexable(texture2d)(float,float,float,float) r14.xyz, r9.xzxx, t4.xyzw, s4, l(0.000000)
mul r14.xyz, r10.xxxx, r14.xyzx
mad r11.yzw, r14.xxyz, r11.yyyy, r13.xxyz
sample_l_indexable(texture2d)(float,float,float,float) r13.xyz, r12.xyxx, t4.xyzw, s4, l(0.000000)
mul r13.xyz, r11.xxxx, r13.xyzx
mad r11.yzw, r13.xxyz, r10.wwww, r11.yyzw
sample_l_indexable(texture2d)(float,float,float,float) r13.xyz, r12.zyzz, t4.xyzw, s4, l(0.000000)
mul r13.xyz, r10.zzzz, r13.xyzx
mad r11.yzw, r13.xxyz, r10.wwww, r11.yyzw
sample_l_indexable(texture2d)(float,float,float,float) r13.xyz, r9.xwxx, t4.xyzw, s4, l(0.000000)
mul r13.xyz, r10.xxxx, r13.xyzx
mad r11.yzw, r13.xxyz, r10.wwww, r11.yyzw
mov r12.y, r9.y
sample_l_indexable(texture2d)(float,float,float,float) r13.xyz, r12.xyxx, t4.xyzw, s4, l(0.000000)
mul r13.xyz, r11.xxxx, r13.xyzx
mad r11.xyz, r13.xyzx, r10.yyyy, r11.yzwy
sample_l_indexable(texture2d)(float,float,float,float) r12.xyz, r12.zyzz, t4.xyzw, s4, l(0.000000)
mul r12.xyz, r10.zzzz, r12.xyzx
mad r11.xyz, r12.xyzx, r10.yyyy, r11.xyzx
sample_l_indexable(texture2d)(float,float,float,float) r9.xyz, r9.xyxx, t4.xyzw, s4, l(0.000000)
mul r9.xyz, r10.xxxx, r9.xyzx
mad r9.xyz, r9.xyzx, r10.yyyy, r11.xyzx
dp3 r0.z, r9.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
mad r0.z, r0.z, l(4.000000), l(4.000000)
div_sat r9.xyz, r9.xyzx, r0.zzzz
add r1.zw, r0.xxxy, -cb0[9].zzzw
sample_l_indexable(texture2d)(float,float,float,float) r10.xyz, r1.zwzz, t2.xyzw, s2, l(0.000000)
dp3 r0.z, r10.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
mad r0.z, r0.z, l(4.000000), l(4.000000)
div_sat r10.xyz, r10.xyzx, r0.zzzz
mad r11.xyzw, cb0[9].zwzw, l(0.000000, -1.000000, 1.000000, -1.000000), r0.xyxy
sample_l_indexable(texture2d)(float,float,float,float) r12.xyz, r11.xyxx, t2.xyzw, s2, l(0.000000)
dp3 r0.z, r12.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
mad r0.z, r0.z, l(4.000000), l(4.000000)
div_sat r12.xyz, r12.xyzx, r0.zzzz
sample_l_indexable(texture2d)(float,float,float,float) r11.xyz, r11.zwzz, t2.xyzw, s2, l(0.000000)
dp3 r0.z, r11.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
mad r0.z, r0.z, l(4.000000), l(4.000000)
div_sat r11.xyz, r11.xyzx, r0.zzzz
mad r13.xyzw, cb0[9].zwzw, l(-1.000000, 0.000000, 1.000000, 0.000000), r0.xyxy
sample_l_indexable(texture2d)(float,float,float,float) r14.xyz, r13.xyxx, t2.xyzw, s2, l(0.000000)
dp3 r0.z, r14.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
mad r0.z, r0.z, l(4.000000), l(4.000000)
div_sat r14.xyz, r14.xyzx, r0.zzzz
sample_l_indexable(texture2d)(float,float,float,float) r13.xyz, r13.zwzz, t2.xyzw, s2, l(0.000000)
dp3 r0.z, r13.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
mad r0.z, r0.z, l(4.000000), l(4.000000)
div_sat r13.xyz, r13.xyzx, r0.zzzz
mad r15.xyzw, cb0[9].zwzw, l(-1.000000, 1.000000, 0.000000, 1.000000), r0.xyxy
sample_l_indexable(texture2d)(float,float,float,float) r16.xyz, r15.xyxx, t2.xyzw, s2, l(0.000000)
dp3 r0.z, r16.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
mad r0.z, r0.z, l(4.000000), l(4.000000)
div_sat r16.xyz, r16.xyzx, r0.zzzz
sample_l_indexable(texture2d)(float,float,float,float) r15.xyz, r15.zwzz, t2.xyzw, s2, l(0.000000)
dp3 r0.z, r15.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
mad r0.z, r0.z, l(4.000000), l(4.000000)
div_sat r15.xyz, r15.xyzx, r0.zzzz
add r1.zw, r0.xxxy, cb0[9].zzzw
sample_l_indexable(texture2d)(float,float,float,float) r17.xyz, r1.zwzz, t2.xyzw, s2, l(0.000000)
dp3 r0.z, r17.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
mad r0.z, r0.z, l(4.000000), l(4.000000)
div_sat r17.xyz, r17.xyzx, r0.zzzz
min r18.xyz, r10.xyzx, r12.xyzx
min r18.xyz, r11.xyzx, r18.xyzx
min r18.xyz, r14.xyzx, r18.xyzx
min r18.xyz, r6.xyzx, r18.xyzx
min r18.xyz, r13.xyzx, r18.xyzx
min r18.xyz, r16.xyzx, r18.xyzx
min r18.xyz, r15.xyzx, r18.xyzx
min r18.xyz, r17.xyzx, r18.xyzx
max r10.xyz, r10.xyzx, r12.xyzx
max r10.xyz, r11.xyzx, r10.xyzx
max r10.xyz, r14.xyzx, r10.xyzx
max r10.xyz, r6.xyzx, r10.xyzx
max r10.xyz, r13.xyzx, r10.xyzx
max r10.xyz, r16.xyzx, r10.xyzx
max r10.xyz, r15.xyzx, r10.xyzx
max r10.xyz, r17.xyzx, r10.xyzx
min r11.xyz, r12.xyzx, r14.xyzx
min r11.xyz, r6.xyzx, r11.xyzx
min r11.xyz, r11.xyzx, r13.xyzx
min r11.xyz, r11.xyzx, r15.xyzx
max r12.xyz, r12.xyzx, r14.xyzx
max r6.xyz, r6.xyzx, r12.xyzx
max r6.xyz, r6.xyzx, r13.xyzx
max r6.xyz, r6.xyzx, r15.xyzx
add r11.xyz, r11.xyzx, r18.xyzx
mul r11.xyz, r11.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000)
add r6.xyz, r6.xyzx, r10.xyzx
mul r10.xyz, r6.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000)
mad r12.xyz, r6.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000), r11.xyzx
mad r6.xyz, r6.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000), -r11.xyzx
mul r6.xyz, r6.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000)
mad r13.xyz, -r12.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000), r9.xyzx
div r6.xyz, r13.xyzx, r6.xyzx
max r0.z, |r6.z|, |r6.y|
max r0.z, r0.z, |r6.x|
lt r1.z, l(1.000000), r0.z
div r6.xyz, r13.xyzx, r0.zzzz
mad r6.xyz, r12.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000), r6.xyzx
movc r6.xyz, r1.zzzz, r6.xyzx, r9.xyzx
dp3 r0.z, r6.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
dp3 r1.z, r10.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
dp3 r1.w, r11.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
add r2.z, -r1.w, r1.z
add r1.z, r0.z, -r1.z
add r0.z, r0.z, -r1.w
min r0.z, |r0.z|, |r1.z|
mul r1.z, r0.z, l(0.125000)
mad r0.z, r0.z, l(0.125000), r2.z
div_sat r0.z, r1.z, r0.z
add r0.z, -r0.z, l(1.000000)
sample_l_indexable(texture2d)(float,float,float,float) r0.x, r0.xyxx, t5.xyzw, s5, l(0.000000)
mul r0.x, r0.x, l(255.000000)
ftou r0.x, r0.x
sample_l_indexable(texture2d)(float,float,float,float) r0.y, r1.xyxx, t6.yxzw, s6, l(0.000000)
mul r0.y, r0.y, l(255.000000)
ftou r0.y, r0.y
and r1.xyzw, r0.xxxx, l(2, 1, 16, 32)
and r0.x, r0.y, l(2)
ine r0.x, r0.x, r1.x
movc r0.x, r0.x, l(0), r0.z
dp2 r0.y, r2.xyxx, r2.xyxx
sqrt r0.y, r0.y
and r0.y, r0.y, r0.w
max r0.z, cb0[9].w, cb0[9].z
mul r0.z, r0.z, l(0.050000)
lt r0.y, r0.z, r0.y
min r0.z, r0.x, l(0.750000)
movc r0.x, r0.y, r0.z, r0.x
eq r0.y, cb0[10].w, l(0.000000)
ieq r1.xyz, r1.yzwy, l(1, 16, 32, 0)
and r0.yzw, r0.yyyy, r1.xxyz
min r1.xy, r0.xxxx, l(0.250000, 0.500000, 0.000000, 0.000000)
movc r0.x, r0.z, r1.y, r0.x
movc r0.x, r0.y, r1.x, r0.x
add r1.xyz, -r8.xyzx, r6.xyzx
mad r0.xyz, r0.xxxx, r1.xyzx, r8.xyzx
mul r1.xyz, r0.xyzx, l(4.000000, 4.000000, 4.000000, 0.000000)
dp3 r0.x, r0.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
mad r0.x, -r0.x, l(4.000000), l(1.000000)
div r0.xyz, r1.xyzx, r0.xxxx
movc r5.xyz, r0.wwww, r4.xyzx, r0.xyzx
mad r0.xyz, r5.xyzx, r7.wwww, r7.xyzx
ne r1.xyz, r0.xyzx, r0.xyzx
or r0.w, r1.y, r1.x
or r0.w, r1.z, r0.w
and r1.xyz, r0.xyzx, l(0x7fffffff, 0x7fffffff, 0x7fffffff, 0)
ieq r1.xyz, r1.xyzx, l(0x7f800000, 0x7f800000, 0x7f800000, 0)
or r0.w, r0.w, r1.x
or r0.w, r1.y, r0.w
or r0.w, r1.z, r0.w
movc r0.xyz, r0.wwww, l(0,0,0,0), r0.xyzx
max r0.xyz, r0.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
min o1.xyz, r0.xyzx, l(1024.000000, 1024.000000, 1024.000000, 0.000000)
mov o0.xyzw, r5.xyzw
mov o1.w, l(1.000000)
mov o2.xyzw, r3.xyzw
ret
// Approximately 268 instruction slots used

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