//water caustics
// ---- Created with 3Dmigoto v0.6.164 on Sat Dec 20 09:03:48 2025
cbuffer cb3 : register(b3)
{
  float4 cb3[21];
}

cbuffer cb2 : register(b2)
{
  float4 cb2[4];
}

cbuffer cb1 : register(b1)
{
  float4 cb1[6];
}

cbuffer cb0 : register(b0)
{
  float4 cb0[19];
}




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


void main(
  float4 v0 : POSITION0,
  float2 v1 : TEXCOORD0,
  float3 v2 : NORMAL0,
  float4 v3 : TANGENT0,
  out float4 o0 : SV_POSITION0,
  out float4 o1 : TEXCOORD0,
  out float4 o2 : TEXCOORD1,
  out float4 o3 : TEXCOORD2,
  out float4 o4 : TEXCOORD3,
  out float4 o5 : TEXCOORD4,
  out float4 o6 : TEXCOORD5,
  out float3 o7 : TEXCOORD6)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;
  
  // Carga parámetros estéreo
  float4 s = StereoParams.Load(0);
  float4 ini = IniParams.Load(int2(90,0));  

  r0.x = cb1[0].x * cb0[11].y;
  r1.xyzw = cb2[1].xyzw * v0.yyyy;
  r1.xyzw = cb2[0].xyzw * v0.xxxx + r1.xyzw;
  r1.xyzw = cb2[2].xyzw * v0.zzzz + r1.xyzw;
  r1.xyzw = cb2[3].xyzw * v0.wwww + r1.xyzw;
  r0.y = r1.x + r1.z;
  r0.x = r0.y * 25 + r0.x;
  r0.x = sin(r0.x);
  r0.x = cb0[11].x * r0.x;
  r0.x = r0.x * 0.00999999978 + r1.y;
  r2.xyzw = cb3[18].xyzw * r0.xxxx;
  r2.xyzw = cb3[17].xyzw * r1.xxxx + r2.xyzw;
  r2.xyzw = cb3[19].xyzw * r1.zzzz + r2.xyzw;
  r2.xyzw = cb3[20].xyzw * r1.wwww + r2.xyzw;
  o0.xyzw = r2.xyzw;
  
r2.x += s.x * (r2.w - s.y);  
  
  o1.xy = v1.xy;
  o2.zw = r2.zw;
  r3.xz = float2(0.5,0.5);
  r3.y = cb1[5].x;
  r2.xyz = r3.zyz * r2.xyw;
  r2.w = 0.5 * r2.y;
  o2.xy = r2.xw + r2.zz;
  r2.xyzw = cb0[16].xyzw * r0.xxxx;
  o4.y = r0.x;
  r0.xyzw = cb0[15].xyzw * r1.xxxx + r2.xyzw;
  r0.xyzw = cb0[17].xyzw * r1.zzzz + r0.xyzw;
  r0.xyzw = cb0[18].xyzw * r1.wwww + r0.xyzw;
  o4.xzw = r1.xzw;
  r1.xyz = r0.xyw * r3.xyz;
  o3.zw = r0.zw;
  r1.w = 0.5 * r1.y;
  o3.xy = r1.xw + r1.zz;
  r0.x = dot(v2.xyz, v2.xyz);
  r0.x = rsqrt(r0.x);
  r0.xyz = v2.yzx * r0.xxx;
  r1.xyz = cb2[1].xyz * r0.xxx;
  r1.xyz = cb2[0].xyz * r0.zzz + r1.xyz;
  r1.xyz = cb2[2].xyz * r0.yyy + r1.xyz;
  r0.w = dot(r1.xyz, r1.xyz);
  r0.w = rsqrt(r0.w);
  o5.xyz = r1.xyz * r0.www;
  r0.w = dot(v3.xyz, v3.xyz);
  r0.w = rsqrt(r0.w);
  r1.xyz = v3.zxy * r0.www;
  r2.xyz = cb2[1].xyz * r1.zzz;
  r2.xyz = cb2[0].xyz * r1.yyy + r2.xyz;
  r2.xyz = cb2[2].xyz * r1.xxx + r2.xyz;
  r0.w = dot(r2.xyz, r2.xyz);
  r0.w = rsqrt(r0.w);
  o6.xyz = r2.xyz * r0.www;
  r2.xyz = r1.xyz * r0.xyz;
  r0.xyz = r1.zxy * r0.yzx + -r2.xyz;
  r0.w = dot(r0.xyz, r0.xyz);
  r0.w = rsqrt(r0.w);
  r0.xyz = r0.xyz * r0.www;
  r1.xyz = cb2[1].xyz * r0.yyy;
  r0.xyw = cb2[0].xyz * r0.xxx + r1.xyz;
  r0.xyz = cb2[2].xyz * r0.zzz + r0.xyw;
  r0.w = dot(r0.xyz, r0.xyz);
  r0.w = rsqrt(r0.w);
  o7.xyz = r0.xyz * r0.www;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v0.6.164 on Sat Dec 20 09:03:48 2025
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 0   xy          1     NONE   float   xy
// NORMAL                   0   xyz         2     NONE   float   xyz
// TANGENT                  0   xyzw        3     NONE   float   xyz
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xy          1     NONE   float   xy
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyzw        3     NONE   float   xyzw
// TEXCOORD                 3   xyzw        4     NONE   float   xyzw
// TEXCOORD                 4   xyz         5     NONE   float   xyz
// TEXCOORD                 5   xyz         6     NONE   float   xyz
// TEXCOORD                 6   xyz         7     NONE   float   xyz
//
vs_4_0
dcl_constantbuffer CB0[19], immediateIndexed
dcl_constantbuffer CB1[6], immediateIndexed
dcl_constantbuffer CB2[4], immediateIndexed
dcl_constantbuffer CB3[21], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xy
dcl_input v2.xyz
dcl_input v3.xyz
dcl_output_siv o0.xyzw, position
dcl_output o1.xy
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyz
dcl_output o6.xyz
dcl_output o7.xyz
dcl_temps 4
mul r0.x, cb0[11].y, cb1[0].x
mul r1.xyzw, v0.yyyy, cb2[1].xyzw
mad r1.xyzw, cb2[0].xyzw, v0.xxxx, r1.xyzw
mad r1.xyzw, cb2[2].xyzw, v0.zzzz, r1.xyzw
mad r1.xyzw, cb2[3].xyzw, v0.wwww, r1.xyzw
add r0.y, r1.z, r1.x
mad r0.x, r0.y, l(25.000000), r0.x
sincos r0.x, null, r0.x
mul r0.x, r0.x, cb0[11].x
mad r0.x, r0.x, l(0.010000), r1.y
mul r2.xyzw, r0.xxxx, cb3[18].xyzw
mad r2.xyzw, cb3[17].xyzw, r1.xxxx, r2.xyzw
mad r2.xyzw, cb3[19].xyzw, r1.zzzz, r2.xyzw
mad r2.xyzw, cb3[20].xyzw, r1.wwww, r2.xyzw
mov o0.xyzw, r2.xyzw
mov o1.xy, v1.xyxx
mov o2.zw, r2.zzzw
mov r3.xz, l(0.500000,0,0.500000,0)
mov r3.y, cb1[5].x
mul r2.xyz, r2.xywx, r3.zyzz
mul r2.w, r2.y, l(0.500000)
add o2.xy, r2.zzzz, r2.xwxx
mul r2.xyzw, r0.xxxx, cb0[16].xyzw
mov o4.y, r0.x
mad r0.xyzw, cb0[15].xyzw, r1.xxxx, r2.xyzw
mad r0.xyzw, cb0[17].xyzw, r1.zzzz, r0.xyzw
mad r0.xyzw, cb0[18].xyzw, r1.wwww, r0.xyzw
mov o4.xzw, r1.xxzw
mul r1.xyz, r3.xyzx, r0.xywx
mov o3.zw, r0.zzzw
mul r1.w, r1.y, l(0.500000)
add o3.xy, r1.zzzz, r1.xwxx
dp3 r0.x, v2.xyzx, v2.xyzx
rsq r0.x, r0.x
mul r0.xyz, r0.xxxx, v2.yzxy
mul r1.xyz, r0.xxxx, cb2[1].xyzx
mad r1.xyz, cb2[0].xyzx, r0.zzzz, r1.xyzx
mad r1.xyz, cb2[2].xyzx, r0.yyyy, r1.xyzx
dp3 r0.w, r1.xyzx, r1.xyzx
rsq r0.w, r0.w
mul o5.xyz, r0.wwww, r1.xyzx
dp3 r0.w, v3.xyzx, v3.xyzx
rsq r0.w, r0.w
mul r1.xyz, r0.wwww, v3.zxyz
mul r2.xyz, r1.zzzz, cb2[1].xyzx
mad r2.xyz, cb2[0].xyzx, r1.yyyy, r2.xyzx
mad r2.xyz, cb2[2].xyzx, r1.xxxx, r2.xyzx
dp3 r0.w, r2.xyzx, r2.xyzx
rsq r0.w, r0.w
mul o6.xyz, r0.wwww, r2.xyzx
mul r2.xyz, r0.xyzx, r1.xyzx
mad r0.xyz, r1.zxyz, r0.yzxy, -r2.xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
mul r1.xyz, r0.yyyy, cb2[1].xyzx
mad r0.xyw, cb2[0].xyxz, r0.xxxx, r1.xyxz
mad r0.xyz, cb2[2].xyzx, r0.zzzz, r0.xywx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul o7.xyz, r0.wwww, r0.xyzx
ret
// Approximately 0 instruction slots used

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