//Radial blur (distortion). Standalone. Nope. Chromatic aberration? Noise?
// ---- Created with 3Dmigoto v1.3.16 on Sat Oct  2 10:05:43 2021

cbuffer fblock : register(b0)
{
  float4 positiontoviewtexture : packoffset(c0);
  float4 noiseparm : packoffset(c1);
  float4 viewrandom : packoffset(c2);
  float4 noisecolor : packoffset(c3);
  float4 noiseparm2 : packoffset(c4);
}

SamplerState viewcolormap_samp_state_s : register(s0);
SamplerState noisemappbr_samp_state_s : register(s1);
Texture2D<float4> viewcolormap_samp : register(t0);
Texture2D<float4> noisemappbr_samp : register(t1);


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


void main(
  float4 v0 : SV_Position0,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r10;
  uint4 bitmask, uiDest;
  float4 fDest;
  
  float4 stereo = StereoParams.Load(0);
  float4 iniparams5 = IniParams.Load(int2(5,0));
  
  r0.xy = v0.xy * positiontoviewtexture.zw + positiontoviewtexture.xy;
  
  r10.xy = r0.xy;
  r10.x+=stereo.x*0.5;
  
  r1.xyz = viewcolormap_samp.SampleLevel(viewcolormap_samp_state_s, r0.xy, 0).xyz;
  
  if (iniparams5.x==0) {
    o0.xyz = r1.xyz * noisecolor.xyz;
    o0.w = 1;
    return;
  }
  
  r1.xyz = max(float3(0,0,0), r1.xyz);
  r1.xyz = log2(r1.xyz);
  r1.xyz = float3(2.20000005,2.20000005,2.20000005) * r1.xyz;
  r1.xyz = exp2(r1.xyz);
  r0.z = dot(r1.xyz, float3(0.212599993,0.715200007,0.0722000003));
  r0.xy = r0.xy * noiseparm.xy + viewrandom.xy;
  r0.xyw = noisemappbr_samp.SampleLevel(noisemappbr_samp_state_s, r0.xy, 0).xyz;
  r0.xyw = noisecolor.xyz * r0.xyw;
  r0.z = 1 + -r0.z;
  r0.z = max(0, r0.z);
  r0.z = log2(r0.z);
  r0.z = noiseparm2.y * r0.z;
  r0.z = exp2(r0.z);
  r0.z = noiseparm.z * r0.z + -noiseparm.z;
  r0.z = noiseparm2.x * r0.z + noiseparm.z;
  r1.w = cmp(noiseparm2.z == 1.000000);
  if (r1.w != 0) {
    r2.xyz = r0.xyw * r0.zzz;
    r2.xyz = r2.xyz * noisecolor.xyz + r1.xyz;
  } else {
    r1.w = 1 + -r0.z;
    r0.xyw = r0.xyw * r1.xyz;
    r0.xyz = r0.xyw * r0.zzz;
    r2.xyz = r1.xyz * r1.www + r0.xyz;
  }
  r0.xyz = max(float3(0,0,0), r2.xyz);
  r0.xyz = log2(r0.xyz);
  r0.xyz = float3(0.454545468,0.454545468,0.454545468) * r0.xyz;
  o0.xyz = exp2(r0.xyz);
  o0.w = 1;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.16 on Sat Oct  2 10:05:43 2021
//
//
// Buffer Definitions:
//
// cbuffer fblock
// {
//
//   float4 positiontoviewtexture;      // Offset:    0 Size:    16
//   float4 noiseparm;                  // Offset:   16 Size:    16
//   float4 viewrandom;                 // Offset:   32 Size:    16
//   float4 noisecolor;                 // Offset:   48 Size:    16
//   float4 noiseparm2;                 // Offset:   64 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// viewcolormap_samp_state           sampler      NA          NA    0        1
// noisemappbr_samp_state            sampler      NA          NA    1        1
// viewcolormap_samp                 texture  float4          2d    0        1
// noisemappbr_samp                  texture  float4          2d    1        1
// fblock                            cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   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[5], immediateIndexed
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_siv linear noperspective v0.xy, position
dcl_output o0.xyzw
dcl_temps 3
mad r0.xy, v0.xyxx, cb0[0].zwzz, cb0[0].xyxx
sample_l_indexable(texture2d)(float,float,float,float) r1.xyz, r0.xyxx, t0.xyzw, s0, l(0.000000)
max r1.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
log r1.xyz, r1.xyzx
mul r1.xyz, r1.xyzx, l(2.200000, 2.200000, 2.200000, 0.000000)
exp r1.xyz, r1.xyzx
dp3 r0.z, r1.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
mad r0.xy, r0.xyxx, cb0[1].xyxx, cb0[2].xyxx
sample_l_indexable(texture2d)(float,float,float,float) r0.xyw, r0.xyxx, t1.xywz, s1, l(0.000000)
mul r0.xyw, r0.xyxw, cb0[3].xyxz
add r0.z, -r0.z, l(1.000000)
max r0.z, r0.z, l(0.000000)
log r0.z, r0.z
mul r0.z, r0.z, cb0[4].y
exp r0.z, r0.z
mad r0.z, cb0[1].z, r0.z, -cb0[1].z
mad r0.z, cb0[4].x, r0.z, cb0[1].z
eq r1.w, cb0[4].z, l(1.000000)
if_nz r1.w
  mul r2.xyz, r0.zzzz, r0.xywx
  mad r2.xyz, r2.xyzx, cb0[3].xyzx, r1.xyzx
else
  add r1.w, -r0.z, l(1.000000)
  mul r0.xyw, r1.xyxz, r0.xyxw
  mul r0.xyz, r0.zzzz, r0.xywx
  mad r2.xyz, r1.xyzx, r1.wwww, r0.xyzx
endif
max r0.xyz, r2.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
log r0.xyz, r0.xyzx
mul r0.xyz, r0.xyzx, l(0.454545468, 0.454545468, 0.454545468, 0.000000)
exp o0.xyz, r0.xyzx
mov o0.w, l(1.000000)
ret
// Approximately 33 instruction slots used

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