//Bloom PS.
// ---- Created with 3Dmigoto v1.3.15 on Fri Mar 08 23:55:48 2019

cbuffer cbSoftBloom : register(b0)
{
  float3 cbBloomColor : packoffset(c0);
  float cbThreshold : packoffset(c0.w);
  float3 cbDirtMaskTintColor : packoffset(c1);
  float cbOutputRatio : packoffset(c1.w);
  float cbDirtMaskIntensity : packoffset(c2);
  float cbDirtMaskThreshold : packoffset(c2.y);
  float2 cbSoftBloomReserve : packoffset(c2.z);
}

SamplerState BilinearClamp_s : register(s0);
Texture2D<float4> texSrc : 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,r7,r8;
  uint4 bitmask, uiDest;
  float4 fDest;

  texSrc.GetDimensions(0, fDest.x, fDest.y, fDest.z);
  r0.xy = fDest.xy;
  r0.xy = float2(0.5,0.5) / r0.xy;
  r0.zw = -r0.yx;
  r1.xyzw = v1.xyxy + r0.xzwy;
  r2.xyz = texSrc.SampleLevel(BilinearClamp_s, r1.xy, 0).xyz;
  r1.xyz = texSrc.SampleLevel(BilinearClamp_s, r1.zw, 0).xyz;
  r0.zw = v1.xy + -r0.xy;
  r3.xyz = texSrc.SampleLevel(BilinearClamp_s, r0.zw, 0).xyz;
  r2.xyz = r3.xyz + r2.xyz;
  r1.xyz = r2.xyz + r1.xyz;
  r0.zw = v1.xy + r0.xy;
  r2.xyz = texSrc.SampleLevel(BilinearClamp_s, r0.zw, 0).xyz;
  r1.xyz = r2.xyz + r1.xyz;
  r0.z = max(r1.x, r1.y);
  r0.z = max(r0.z, r1.z);
  r0.z = 1 + r0.z;
  r0.z = 1 / r0.z;
  r1.xyz = r1.xyz * r0.zzz;
  r2.w = 1;
  r3.z = 0;
  r4.xy = r0.xy + r0.xy;
  r0.xy = r0.xy * float2(2,2) + v1.xy;
  r0.xyw = texSrc.SampleLevel(BilinearClamp_s, r0.xy, 0).xyz;
  r3.xy = -r4.xy;
  r3.xyzw = v1.xyxy + r3.xzxy;
  r5.xyz = texSrc.SampleLevel(BilinearClamp_s, r3.zw, 0).xyz;
  r3.xyz = texSrc.SampleLevel(BilinearClamp_s, r3.xy, 0).xyz;
  r4.w = -r4.y;
  r4.z = 0;
  r6.xyzw = v1.xyxy + r4.zwxw;
  r7.xyzw = v1.xyxy + r4.xzzy;
  r4.xy = r4.xy * float2(-1,1) + v1.xy;
  r4.xyz = texSrc.SampleLevel(BilinearClamp_s, r4.xy, 0).xyz;
  r8.xyz = texSrc.SampleLevel(BilinearClamp_s, r6.xy, 0).xyz;
  r6.xyz = texSrc.SampleLevel(BilinearClamp_s, r6.zw, 0).xyz;
  r6.xyz = r8.xyz + r6.xyz;
  r5.xyz = r8.xyz + r5.xyz;
  r5.xyz = r5.xyz + r3.xyz;
  r8.xyz = texSrc.SampleLevel(BilinearClamp_s, v1.xy, 0).xyz;
  r2.xyz = r8.xyz + r5.xyz;
  r1.w = max(r2.x, r2.y);
  r1.w = max(r1.w, r2.z);
  r1.w = 1 + r1.w;
  r1.w = 1 / r1.w;
  r2.xyzw = r2.xyzw * r1.wwww;
  r2.xyz = float3(0.125,0.125,0.125) * r2.xyz;
  r1.xyz = r1.xyz * float3(0.5,0.5,0.5) + r2.xyz;
  r2.xyz = r8.xyz + r6.xyz;
  r5.xyz = texSrc.SampleLevel(BilinearClamp_s, r7.xy, 0).xyz;
  r6.xyz = texSrc.SampleLevel(BilinearClamp_s, r7.zw, 0).xyz;
  r2.xyz = r5.xyz + r2.xyz;
  r5.xyz = r8.xyz + r5.xyz;
  r3.xyz = r8.xyz + r3.xyz;
  r3.xyz = r3.xyz + r4.xyz;
  r3.xyz = r3.xyz + r6.xyz;
  r4.xyz = r5.xyz + r6.xyz;
  r0.xyw = r4.xyz + r0.xyw;
  r1.w = max(r2.x, r2.y);
  r1.w = max(r1.w, r2.z);
  r1.w = 1 + r1.w;
  r1.w = 1 / r1.w;
  r2.xyz = r2.xyz * r1.www;
  r1.xyz = r2.xyz * float3(0.125,0.125,0.125) + r1.xyz;
  r2.x = max(r3.x, r3.y);
  r2.x = max(r2.x, r3.z);
  r2.x = 1 + r2.x;
  r2.x = 1 / r2.x;
  r3.xyz = r3.xyz * r2.xxx;
  r1.xyz = r3.xyz * float3(0.125,0.125,0.125) + r1.xyz;
  r2.y = max(r0.x, r0.y);
  r2.y = max(r2.y, r0.w);
  r2.y = 1 + r2.y;
  r2.y = 1 / r2.y;
  r0.xyw = r2.yyy * r0.xyw;
  r0.xyw = r0.xyw * float3(0.125,0.125,0.125) + r1.xyz;
  r1.x = 1;
  r0.z = r1.x * r0.z + r2.w;
  r1.x = 1;
  r0.z = r1.x * r1.w + r0.z;
  r1.x = 1;
  r0.z = r1.x * r2.x + r0.z;
  r1.x = 1;
  r0.z = r1.x * r2.y + r0.z;
  r0.xyz = r0.xyw / r0.zzz;
  r0.xyz = min(float3(65504,65504,65504), r0.xyz);
  r0.w = max(r0.x, r0.y);
  r0.w = max(r0.w, r0.z);
  r0.w = saturate(r0.w / cbThreshold);
  r0.xyz = r0.www * r0.xyz;
  r0.xyz = max(float3(0,0,0), r0.xyz);
  o0.xyz = float3(0.100000001,0.100000001,0.100000001) * r0.xyz;
  o0.w = 1;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//   using 3Dmigoto v1.3.15 on Fri Mar 08 23:55:48 2019
//
//
// Buffer Definitions:
//
// cbuffer cbSoftBloom
// {
//
//   float3 cbBloomColor;               // Offset:    0 Size:    12 [unused]
//   float cbThreshold;                 // Offset:   12 Size:     4
//   float3 cbDirtMaskTintColor;        // Offset:   16 Size:    12 [unused]
//   float cbOutputRatio;               // Offset:   28 Size:     4 [unused]
//   float cbDirtMaskIntensity;         // Offset:   32 Size:     4 [unused]
//   float cbDirtMaskThreshold;         // Offset:   36 Size:     4 [unused]
//   float2 cbSoftBloomReserve;         // Offset:   40 Size:     8 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// BilinearClamp                     sampler      NA          NA    0        1
// texSrc                            texture  float4          2d    0        1
// cbSoftBloom                       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[1], 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 9
resinfo_indexable(texture2d)(float,float,float,float) r0.xy, l(0), t0.xyzw
div r0.xy, l(0.500000, 0.500000, 0.000000, 0.000000), r0.xyxx
mov r0.zw, -r0.yyyx
add r1.xyzw, r0.xzwy, v1.xyxy
sample_l_indexable(texture2d)(float,float,float,float) r2.xyz, r1.xyxx, t0.xyzw, s0, l(0.000000)
sample_l_indexable(texture2d)(float,float,float,float) r1.xyz, r1.zwzz, t0.xyzw, s0, l(0.000000)
add r0.zw, -r0.xxxy, v1.xxxy
sample_l_indexable(texture2d)(float,float,float,float) r3.xyz, r0.zwzz, t0.xyzw, s0, l(0.000000)
add r2.xyz, r2.xyzx, r3.xyzx
add r1.xyz, r1.xyzx, r2.xyzx
add r0.zw, r0.xxxy, v1.xxxy
sample_l_indexable(texture2d)(float,float,float,float) r2.xyz, r0.zwzz, t0.xyzw, s0, l(0.000000)
add r1.xyz, r1.xyzx, r2.xyzx
max r0.z, r1.y, r1.x
max r0.z, r1.z, r0.z
add r0.z, r0.z, l(1.000000)
div r0.z, l(1.000000, 1.000000, 1.000000, 1.000000), r0.z
mul r1.xyz, r0.zzzz, r1.xyzx
mov r2.w, l(1.000000)
mov r3.z, l(0)
add r4.xy, r0.xyxx, r0.xyxx
mad r0.xy, r0.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), v1.xyxx
sample_l_indexable(texture2d)(float,float,float,float) r0.xyw, r0.xyxx, t0.xywz, s0, l(0.000000)
mov r3.xy, -r4.xyxx
add r3.xyzw, r3.xzxy, v1.xyxy
sample_l_indexable(texture2d)(float,float,float,float) r5.xyz, r3.zwzz, t0.xyzw, s0, l(0.000000)
sample_l_indexable(texture2d)(float,float,float,float) r3.xyz, r3.xyxx, t0.xyzw, s0, l(0.000000)
mov r4.w, -r4.y
mov r4.z, l(0)
add r6.xyzw, r4.zwxw, v1.xyxy
add r7.xyzw, r4.xzzy, v1.xyxy
mad r4.xy, r4.xyxx, l(-1.000000, 1.000000, 0.000000, 0.000000), v1.xyxx
sample_l_indexable(texture2d)(float,float,float,float) r4.xyz, r4.xyxx, t0.xyzw, s0, l(0.000000)
sample_l_indexable(texture2d)(float,float,float,float) r8.xyz, r6.xyxx, t0.xyzw, s0, l(0.000000)
sample_l_indexable(texture2d)(float,float,float,float) r6.xyz, r6.zwzz, t0.xyzw, s0, l(0.000000)
add r6.xyz, r6.xyzx, r8.xyzx
add r5.xyz, r5.xyzx, r8.xyzx
add r5.xyz, r3.xyzx, r5.xyzx
sample_l_indexable(texture2d)(float,float,float,float) r8.xyz, v1.xyxx, t0.xyzw, s0, l(0.000000)
add r2.xyz, r5.xyzx, r8.xyzx
max r1.w, r2.y, r2.x
max r1.w, r2.z, r1.w
add r1.w, r1.w, l(1.000000)
div r1.w, l(1.000000, 1.000000, 1.000000, 1.000000), r1.w
mul r2.xyzw, r1.wwww, r2.xyzw
mul r2.xyz, r2.xyzx, l(0.125000, 0.125000, 0.125000, 0.000000)
mad r1.xyz, r1.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000), r2.xyzx
add r2.xyz, r6.xyzx, r8.xyzx
sample_l_indexable(texture2d)(float,float,float,float) r5.xyz, r7.xyxx, t0.xyzw, s0, l(0.000000)
sample_l_indexable(texture2d)(float,float,float,float) r6.xyz, r7.zwzz, t0.xyzw, s0, l(0.000000)
add r2.xyz, r2.xyzx, r5.xyzx
add r5.xyz, r5.xyzx, r8.xyzx
add r3.xyz, r3.xyzx, r8.xyzx
add r3.xyz, r4.xyzx, r3.xyzx
add r3.xyz, r6.xyzx, r3.xyzx
add r4.xyz, r6.xyzx, r5.xyzx
add r0.xyw, r0.xyxw, r4.xyxz
max r1.w, r2.y, r2.x
max r1.w, r2.z, r1.w
add r1.w, r1.w, l(1.000000)
div r1.w, l(1.000000, 1.000000, 1.000000, 1.000000), r1.w
mul r2.xyz, r1.wwww, r2.xyzx
mad r1.xyz, r2.xyzx, l(0.125000, 0.125000, 0.125000, 0.000000), r1.xyzx
max r2.x, r3.y, r3.x
max r2.x, r3.z, r2.x
add r2.x, r2.x, l(1.000000)
div r2.x, l(1.000000, 1.000000, 1.000000, 1.000000), r2.x
mul r3.xyz, r2.xxxx, r3.xyzx
mad r1.xyz, r3.xyzx, l(0.125000, 0.125000, 0.125000, 0.000000), r1.xyzx
max r2.y, r0.y, r0.x
max r2.y, r0.w, r2.y
add r2.y, r2.y, l(1.000000)
div r2.y, l(1.000000, 1.000000, 1.000000, 1.000000), r2.y
mul r0.xyw, r0.xyxw, r2.yyyy
mad r0.xyw, r0.xyxw, l(0.125000, 0.125000, 0.000000, 0.125000), r1.xyxz
mov r1.x, l(1.000000)
mad r0.z, r1.x, r0.z, r2.w
mov r1.x, l(1.000000)
mad r0.z, r1.x, r1.w, r0.z
mov r1.x, l(1.000000)
mad r0.z, r1.x, r2.x, r0.z
mov r1.x, l(1.000000)
mad r0.z, r1.x, r2.y, r0.z
div r0.xyz, r0.xywx, r0.zzzz
min r0.xyz, r0.xyzx, l(65504.000000, 65504.000000, 65504.000000, 0.000000)
max r0.w, r0.y, r0.x
max r0.w, r0.z, r0.w
div_sat r0.w, r0.w, cb0[0].w
mul r0.xyz, r0.xyzx, r0.wwww
max r0.xyz, r0.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
mul o0.xyz, r0.xyzx, l(0.100000, 0.100000, 0.100000, 0.000000)
mov o0.w, l(1.000000)
ret
// Approximately 93 instruction slots used

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