//Light shafts PS 1.
// ---- Created with 3Dmigoto v0.6.163 on Thu Aug 21 18:21:56 2025

cbuffer cb_godray : register(b2)
{
  float2 blurCenter_g : packoffset(c0);
  float2 blurScale_g : packoffset(c0.z);
  float zThreshold_g : packoffset(c1);
  float isFlip_g : packoffset(c1.y);
  float brightnessThreshold_g : packoffset(c1.z);
  float centricSharpness_g : packoffset(c1.w);
  float3 godrayColor_g : packoffset(c2);
  float4 uvClamp_g : packoffset(c3);
}

SamplerState samLinear_s : register(s0);
Texture2D<float4> colorTexture : register(t0);


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


void main(
  float4 v0 : SV_Position0,
  float4 v1 : TEXCOORD0,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2;
  uint4 bitmask, uiDest;
  float4 fDest;
  
  float4 stereo = StereoParams.Load(0);
  
  v1.z-=stereo.x*0.5;
  
  r0.xyzw = blurCenter_g.xyxy + -v1.zwzw;
  r0.xyzw = isFlip_g * r0.xyzw;
  r1.x = dot(r0.zw, r0.zw);
  r1.y = rsqrt(r1.x);
  r1.x = sqrt(r1.x);
  r1.x = min(1, r1.x);
  r0.xyzw = r1.yyyy * r0.xyzw;
  r0.xyzw = blurScale_g.xyxy * r0.xyzw;
  r1.yz = r0.zw * r1.xx + v1.xy;
  r0.xyzw = r0.xyzw * r1.xxxx;
  r1.xyz = colorTexture.SampleLevel(samLinear_s, r1.yz, 0).xyz;
  r1.xyz = float3(0.280000001,0.280000001,0.280000001) * r1.xyz;
  r2.xyz = colorTexture.SampleLevel(samLinear_s, v1.xy, 0).xyz;
  r1.xyz = r2.xyz * float3(0.360000014,0.360000014,0.360000014) + r1.xyz;
  r2.xy = r0.zw * float2(2,2) + v1.xy;
  r0.xyzw = r0.xyzw * float4(4,4,8,8) + v1.xyxy;
  r2.xyz = colorTexture.SampleLevel(samLinear_s, r2.xy, 0).xyz;
  r1.xyz = r2.xyz * float3(0.200000003,0.200000003,0.200000003) + r1.xyz;
  r2.xyz = colorTexture.SampleLevel(samLinear_s, r0.xy, 0).xyz;
  r0.xyz = colorTexture.SampleLevel(samLinear_s, r0.zw, 0).xyz;
  r1.xyz = r2.xyz * float3(0.119999997,0.119999997,0.119999997) + r1.xyz;
  o0.xyz = r0.xyz * float3(0.0399999991,0.0399999991,0.0399999991) + r1.xyz;
  o0.w = 1;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//   using 3Dmigoto v0.6.163 on Thu Aug 21 18:21:56 2025
//
//
// Buffer Definitions:
//
// cbuffer cb_godray
// {
//
//   float2 blurCenter_g;               // Offset:    0 Size:     8
//   float2 blurScale_g;                // Offset:    8 Size:     8
//   float zThreshold_g;                // Offset:   16 Size:     4 [unused]
//   float isFlip_g;                    // Offset:   20 Size:     4
//   float brightnessThreshold_g;       // Offset:   24 Size:     4 [unused]
//   float centricSharpness_g;          // Offset:   28 Size:     4 [unused]
//   float3 godrayColor_g;              // Offset:   32 Size:    12 [unused]
//   float4 uvClamp_g;                  // Offset:   48 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// samLinear                         sampler      NA          NA    0        1
// colorTexture                      texture  float4          2d    0        1
// cb_godray                         cbuffer      NA          NA    2        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
//
//
// 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 CB2[2], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input_ps linear v1.xyzw
dcl_output o0.xyzw
dcl_temps 3
add r0.xyzw, -v1.zwzw, cb2[0].xyxy
mul r0.xyzw, r0.xyzw, cb2[1].yyyy
dp2 r1.x, r0.zwzz, r0.zwzz
rsq r1.y, r1.x
sqrt r1.x, r1.x
min r1.x, r1.x, l(1.000000)
mul r0.xyzw, r0.xyzw, r1.yyyy
mul r0.xyzw, r0.xyzw, cb2[0].zwzw
mad r1.yz, r0.zzwz, r1.xxxx, v1.xxyx
mul r0.xyzw, r1.xxxx, r0.xyzw
sample_l_indexable(texture2d)(float,float,float,float) r1.xyz, r1.yzyy, t0.xyzw, s0, l(0.000000)
mul r1.xyz, r1.xyzx, l(0.280000, 0.280000, 0.280000, 0.000000)
sample_l_indexable(texture2d)(float,float,float,float) r2.xyz, v1.xyxx, t0.xyzw, s0, l(0.000000)
mad r1.xyz, r2.xyzx, l(0.360000, 0.360000, 0.360000, 0.000000), r1.xyzx
mad r2.xy, r0.zwzz, l(2.000000, 2.000000, 0.000000, 0.000000), v1.xyxx
mad r0.xyzw, r0.xyzw, l(4.000000, 4.000000, 8.000000, 8.000000), v1.xyxy
sample_l_indexable(texture2d)(float,float,float,float) r2.xyz, r2.xyxx, t0.xyzw, s0, l(0.000000)
mad r1.xyz, r2.xyzx, l(0.200000, 0.200000, 0.200000, 0.000000), r1.xyzx
sample_l_indexable(texture2d)(float,float,float,float) r2.xyz, r0.xyxx, t0.xyzw, s0, l(0.000000)
sample_l_indexable(texture2d)(float,float,float,float) r0.xyz, r0.zwzz, t0.xyzw, s0, l(0.000000)
mad r1.xyz, r2.xyzx, l(0.120000, 0.120000, 0.120000, 0.000000), r1.xyzx
mad o0.xyz, r0.xyzx, l(0.040000, 0.040000, 0.040000, 0.000000), r1.xyzx
mov o0.w, l(1.000000)
ret
// Approximately 24 instruction slots used

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