//Water caustics PS 1. August 2025 update.
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//   using 3Dmigoto v0.6.181 on Sat Aug 23 15:07:01 2025
//
//
// Buffer Definitions:
//
// cbuffer perDraw
// {
//
//   float3 eyePosWorld;                // Index:    0.xyz            Components:     3
//   float4 waterFogPlane;              // Index:    1.xyzw           Components:     4
//   float accumTime;                   // Index:    2.x              Components:     1
//   float4 sunColor;                   // Index:    3.xyzw           Components:     4
//   float4 rtParams0;                  // Index:    4.xyzw           Components:     4 [unused]
//   float4 rtParams1;                  // Index:    5.xyzw           Components:     4 [unused]
//   float4 rtParams2;                  // Index:    6.xyzw           Components:     4 [unused]
//   float4 rtParams3;                  // Index:    7.xyzw           Components:     4 [unused]
//   float4 projParams;                 // Index:    8.xyzw           Components:     4
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// prepassTex_sampler_               sampler      NA          NA    0        1
// prepassDepthTex_sampler_          sampler      NA          NA    1        1
// causticsTex0_sampler_             sampler      NA          NA    2        1
// causticsTex1_sampler_             sampler      NA          NA    3        1
// prepassTexTex                     texture  float4          2d    0        1
// prepassDepthTexTex                texture  float4          2d    1        1
// causticsTex0Tex                   texture  float4          2d    2        1
// causticsTex1Tex                   texture  float4          2d    3        1
// perDraw                           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
// TEXCOORD                 1     zw        1     NONE   float
// TEXCOORD                 2   xy          2     NONE   float
// TEXCOORD                 3     zw        2     NONE   float
// TEXCOORD                 4   xyz         3     NONE   float   xyz
//
//
// 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[9], immediateIndexed
dcl_constantbuffer CB13[39], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, 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_input_ps linear v1.xy
dcl_input_ps linear v3.xyz
dcl_output o0.xyzw
dcl_temps 31
dcl_resource_texture2d (float,float,float,float) t125
ld_indexable(texture2d)(float,float,float,float) r25.xyzw, l(0, 0, 0, 0), t125.xyzw
sample_l_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r0.x, v1.xyxx, t1.xyzw, s1, l(0.000000)
add r0.x, r0.x, -cb0[8].z
div r0.x, cb0[8].w, r0.x

mov r10.x, r0.x

div r0.x, r0.x, cb0[8].y
lt r0.y, l(0.999900), r0.x
if_nz r0.y
  mov o0.xyzw, l(0,0,0,0)
  ret
endif

mov r23.xyz, v3.xyzx
div r24.x, r25.y, r10.x
//-1.0 if not stereoized in VS. 0.0 is stereoized in VS.
add r24.x, r24.x, l(-1.0)
mul r26.x, r24.x, cb13[31].x
mul r26.y, r24.x, cb13[32].x
mul r26.z, r24.x, cb13[33].x
mul r26.w, cb13[31].x, cb13[31].x
mad r26.w, cb13[32].x, cb13[32].x, r26.w
mad r26.w, cb13[33].x, cb13[33].x, r26.w
div r26.xyz, r26.xyzx, r26.wwww
mul r26.xyz, r26.xyzx, cb0[8].y
mad r23.xyz, r25.xxxx, r26.xyzx, r23.xyzx

mad r0.yzw, r23.xxyz, r0.xxxx, cb0[0].xxyz
dp3 r0.w, cb0[1].xyzx, r0.yzwy
add r0.w, r0.w, cb0[1].w
lt r1.x, -r0.w, l(0.000000)
if_nz r1.x
  mov o0.xyzw, l(0,0,0,0)
  ret
endif
sample_l_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r1.xy, v1.xyxx, t0.xyzw, s0, l(0.000000)
mad r1.xy, r1.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
add r2.xyz, -|r1.xyxx|, l(1.000000, 1.000000, 1.000000, 0.000000)
add r3.z, -|r1.y|, r2.x
ge r1.z, r3.z, l(0.000000)
ge r2.xw, r1.xxxy, l(0.000000, 0.000000, 0.000000, 0.000000)
movc r2.xw, r2.xxxw, l(1.000000,0,0,1.000000), l(-1.000000,0,0,-1.000000)
mul r2.xy, r2.xwxx, r2.yzyy
movc r3.xy, r1.zzzz, r1.xyxx, r2.xyxx
dp3 r1.x, r3.xyzx, r3.xyzx
rsq r1.x, r1.x
mul_sat r1.x, r1.x, r3.z
mul_sat r0.w, r0.w, l(-0.100000)
add r0.w, -r0.w, l(1.000000)
mul r2.xyzw, r0.yzyz, l(0.250000, 0.250000, 0.200000, 0.200000)
ge r3.xyzw, |r2.xyzw|, -|r2.xyzw|
movc r3.xyzw, r3.xyzw, l(1.000000,1.000000,1.000000,1.000000), l(-1.000000,-1.000000,-1.000000,-1.000000)
mul r2.xyzw, |r2.xyzw|, r3.xyzw
frc r2.xyzw, r2.xyzw
sincos r0.y, null, cb0[2].x
mul r4.xy, r0.yyyy, l(0.200000, 0.150000, 0.000000, 0.000000)
mul r4.zw, cb0[2].xxxx, l(0.000000, 0.000000, 0.100000, 0.150000)
mad r0.yz, r3.xxyx, r2.xxyx, r4.zzxz
mad r1.yz, r3.zzwz, r2.zzwz, -r4.wwyw
sample_indexable(texture2d)(float,float,float,float) r2.xyzw, r0.yzyy, t2.xyzw, s2
sample_indexable(texture2d)(float,float,float,float) r3.xyzw, r1.yzyy, t3.xyzw, s3
mul r3.xyzw, r3.xyzw, cb0[3].xyzw
mul r2.xyzw, r2.xyzw, r3.xyzw
add r0.x, -r0.x, l(1.000000)
log r0.x, r0.x
mul r0.x, r0.x, l(64.000000)
exp r0.x, r0.x
mul r0.x, r0.x, r1.x
mul r0.x, r0.w, r0.x
mul o0.xyzw, r0.xxxx, r2.xyzw
ret
// Approximately 53 instruction slots used
