//P5S water PS 2.
// ---- Created with 3Dmigoto v1.3.16 on Wed Mar 16 23:43:47 2022
//
//cbuffer _Globals : register(b0)
//{
//  float4 vEye : packoffset(c0);
//  float4 mWV[3] : packoffset(c1);
//  float fAmbMapsDORate : packoffset(c4) = {0};
//  float4 vAmbDifScl : packoffset(c5) = {1,1,1,1};
//  float3 vNormalNoiseParam : packoffset(c6);
//  float4 mRrW2T[3] : packoffset(c7);
//  float fRrRefractiveIndex : packoffset(c10);
//  float fRrTransparency : packoffset(c10.y);
//  float fDiffuseTransparency : packoffset(c10.z);
//  float4 vRrParam : packoffset(c11);
//  float2 vD2Z : packoffset(c12);
//  float4 vRrCameraPos : packoffset(c13);
//  float4 vRrCameraDir : packoffset(c14);
//  float4 vAlbedoColor : packoffset(c15);
//  float4 vReflectance : packoffset(c16);
//}
//
//SamplerState __smpsOceanNormalMap_s : register(s0);
//SamplerState __smpsOceanDepthMap_s : register(s2);
//SamplerState __smpsOceanNormalNoiseMap_s : register(s3);
//Texture3D<float4> sOceanNormalMap : register(t0);
//Texture2D<float4> sOceanDepthMap : register(t2);
//Texture2D<float4> sOceanNormalNoiseMap : register(t3);
//
//
//// 3Dmigoto declarations
//#define cmp -
//Texture1D<float4> IniParams : register(t120);
//Texture2D<float4> StereoParams : register(t125);
//
//
//void main(
//  float4 v0 : SV_ClipDistance1,
//  float4 v1 : SV_ClipDistance0,
//  float4 v2 : SV_Position0,
//  float4 v3 : TEXCOORD0,
//  float4 v4 : TEXCOORD1,
//  float3 v5 : TEXCOORD2,
//  out float4 o0 : SV_Target0,
//  out float4 o1 : SV_Target1,
//  out float4 o2 : SV_Target2,
//  out float4 o3 : SV_Target3,
//  out float4 o4 : SV_Target4,
//  out float4 o5 : SV_Target5)
//{
//  float4 r0,r1,r2,r3,r4;
//  uint4 bitmask, uiDest;
//  float4 fDest;
//
//  r0.x = 255 * fDiffuseTransparency;
//  r0.x = (uint)r0.x;
//  r0.x = (uint)r0.x << 8;
//  r0.x = (uint)r0.x;
//  o1.z = 1.52590219e-005 * r0.x;
//  r0.x = sOceanNormalNoiseMap.Sample(__smpsOceanNormalNoiseMap_s, v4.xy).x;
//  r0.z = vNormalNoiseParam.z + r0.x;
//  r0.xy = v4.zw;
//  r0.xy = sOceanNormalMap.Sample(__smpsOceanNormalMap_s, r0.xyz).xy;
//  r0.xy = r0.xy * float2(2,2) + v5.xz;
//  r0.xz = float2(-1,-1) + r0.xy;
//  r0.y = v5.y;
//  r0.w = dot(r0.xyz, r0.xyz);
//  r0.w = rsqrt(r0.w);
//  r1.xyz = r0.xyz * r0.www;
//  r0.xyz = -r0.xyz * r0.www + float3(0,1,0);
//  r2.y = dot(mWV[0].xyz, r1.xyz);
//  r2.z = dot(mWV[1].xyz, r1.xyz);
//  r0.w = abs(r2.y) + abs(r2.z);
//  r2.x = dot(mWV[2].xyz, r1.xyz);
//  r0.w = abs(r2.x) + r0.w;
//  r2.xyz = r2.xyz / r0.www;
//  r3.xy = float2(1,1) + -abs(r2.zy);
//  r4.xyz = cmp(r2.xyz >= float3(0,0,0));
//  r2.xw = r4.yz ? float2(1,1) : float2(-1,-1);
//  r2.xw = r3.xy * r2.xw;
//  r2.xy = r4.xx ? r2.yz : r2.xw;
//  o1.xy = r2.xy * float2(0.5,0.5) + float2(0.5,0.5);
//  o1.w = 0;
//  o2.xyzw = float4(1,1,1,0.5) * vReflectance.xyzw;
//  o3.xyzw = float4(0,0,0,0);
//  r1.xw = float2(0,1) * r1.zx;
//  r1.xy = r1.yz * float2(1,0) + -r1.xw;
//  r0.w = dot(r1.xy, r1.xy);
//  r0.w = rsqrt(r0.w);
//  r1.xy = r1.xy * r0.ww;
//  r0.w = abs(r1.x) + abs(r1.y);
//  r1.xy = r1.xy / r0.ww;
//  o4.zw = r1.xy * float2(0.5,0.5) + float2(0.5,0.5);
//  r0.w = abs(v5.x) + abs(v5.y);
//  r0.w = abs(v5.z) + r0.w;
//  r1.xyz = v5.zxy / r0.www;
//  r2.xy = float2(1,1) + -abs(r1.zy);
//  r3.xyz = cmp(r1.xyz >= float3(0,0,0));
//  r1.xw = r3.yz ? float2(1,1) : float2(-1,-1);
//  r1.xw = r2.xy * r1.xw;
//  r1.xy = r3.xx ? r1.yz : r1.xw;
//  o4.xy = r1.xy * float2(0.5,0.5) + float2(0.5,0.5);
//  r1.xyz = vEye.xyz + -v3.xyz;
//  r0.w = dot(r1.xyz, r1.xyz);
//  r0.w = rsqrt(r0.w);
//  r1.xyz = r1.xyz * r0.www;
//  r0.xyz = r0.xyz * vRrParam.yyy + -r1.xyz;
//  r0.w = dot(r0.xyz, r0.xyz);
//  r0.w = rsqrt(r0.w);
//  r0.xyz = r0.xyz * r0.www;
//  r1.x = dot(v3.xyzw, mRrW2T[0].xyzw);
//  r1.y = dot(v3.xyzw, mRrW2T[1].xyzw);
//  r0.w = dot(v3.xyzw, mRrW2T[2].xyzw);
//  r1.xy = r1.xy / r0.ww;
//  r0.w = sOceanDepthMap.Sample(__smpsOceanDepthMap_s, r1.xy).x;
//  r0.w = saturate(vD2Z.y * r0.w + vD2Z.x);
//  r0.w = 1 / r0.w;
//  r1.xyz = -vRrCameraPos.xyz + v3.xyz;
//  r1.x = dot(r1.xyz, vRrCameraDir.xyz);
//  r1.y = -r1.x + r0.w;
//  r1.y = min(vRrParam.z, r1.y);
//  r2.xyz = r0.xyz * r1.yyy + v3.xyz;
//  r2.w = 1;
//  r0.x = dot(r2.xyzw, mRrW2T[0].xyzw);
//  r0.y = dot(r2.xyzw, mRrW2T[1].xyzw);
//  r0.z = dot(r2.xyzw, mRrW2T[2].xyzw);
//  r0.xy = r0.xy / r0.zz;
//  r0.x = sOceanDepthMap.Sample(__smpsOceanDepthMap_s, r0.xy).x;
//  r0.x = saturate(vD2Z.y * r0.x + vD2Z.x);
//  r0.x = 1 / r0.x;
//  r0.y = cmp(r0.x < r1.x);
//  r0.x = r0.y ? r0.w : r0.x;
//  o5.z = r0.x + -r1.x;
//  o5.xy = fRrRefractiveIndex;
//  o5.w = 0;
//  o0.xyz = vAlbedoColor.xyz;
//  o0.w = 1;
//  return;
//}
//
///*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.16 on Wed Mar 16 23:43:47 2022
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
//   float4 vEye;                       // Offset:    0 Size:    16
//   float4 mWV[3];                     // Offset:   16 Size:    48
//   float fAmbMapsDORate;              // Offset:   64 Size:     4 [unused]
//      = 0x00000000
//   float4 vAmbDifScl;                 // Offset:   80 Size:    16 [unused]
//      = 0x3f800000 0x3f800000 0x3f800000 0x3f800000
//   float3 vNormalNoiseParam;          // Offset:   96 Size:    12
//   float4 mRrW2T[3];                  // Offset:  112 Size:    48
//   float fRrRefractiveIndex;          // Offset:  160 Size:     4
//   float fRrTransparency;             // Offset:  164 Size:     4
//   float fDiffuseTransparency;        // Offset:  168 Size:     4
//   float4 vRrParam;                   // Offset:  176 Size:    16
//   float2 vD2Z;                       // Offset:  192 Size:     8
//   float4 vRrCameraPos;               // Offset:  208 Size:    16
//   float4 vRrCameraDir;               // Offset:  224 Size:    16
//   float4 vAlbedoColor;               // Offset:  240 Size:    16
//   float4 vReflectance;               // Offset:  256 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// __smpsOceanNormalMap              sampler      NA          NA    0        1
// __smpsOceanDepthMap               sampler      NA          NA    2        1
// __smpsOceanNormalNoiseMap         sampler      NA          NA    3        1
// sOceanNormalMap                   texture  float4          3d    0        1
// sOceanDepthMap                    texture  float4          2d    2        1
// sOceanNormalNoiseMap              texture  float4          2d    3        1
// $Globals                          cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_ClipDistance          1   xyzw        0  CLIPDST   float
// SV_ClipDistance          0   xyzw        1  CLIPDST   float
// SV_Position              0   xyzw        2      POS   float
// TEXCOORD                 0   xyzw        3     NONE   float   xyzw
// TEXCOORD                 1   xyzw        4     NONE   float   xyzw
// TEXCOORD                 2   xyz         5     NONE   float   xyz
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
// SV_Target                1   xyzw        1   TARGET   float   xyzw
// SV_Target                2   xyzw        2   TARGET   float   xyzw
// SV_Target                3   xyzw        3   TARGET   float   xyzw
// SV_Target                4   xyzw        4   TARGET   float   xyzw
// SV_Target                5   xyzw        5   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[17], immediateIndexed
dcl_constantbuffer cb13[10], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, mode_default
dcl_resource_texture3d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_input_ps linear v3.xyzw
dcl_input_ps linear v4.xyzw
dcl_input_ps linear v5.xyz
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_temps 30
dcl_resource_texture2d (float,float,float,float) t125
ld_indexable(texture2d)(float,float,float,float) r25.xyzw, l(0, 0, 0, 0), t125.xyzw
mul r0.x, cb0[10].z, l(255.000000)
ftou r0.x, r0.x
ishl r0.x, r0.x, l(8)
utof r0.x, r0.x
mul o1.z, r0.x, l(0.0000152590219)
sample_indexable(texture2d)(float,float,float,float) r0.x, v4.xyxx, t3.xyzw, s3
add r0.z, r0.x, cb0[6].z
mov r0.xy, v4.zwzz
sample_indexable(texture3d)(float,float,float,float) r0.xy, r0.xyzx, t0.xyzw, s0
mad r0.xy, r0.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), v5.xzxx
add r0.xz, r0.xxyx, l(-1.000000, 0.000000, -1.000000, 0.000000)
mov r0.y, v5.y
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r1.xyz, r0.wwww, r0.xyzx
mad r0.xyz, -r0.xyzx, r0.wwww, l(0.000000, 1.000000, 0.000000, 0.000000)
dp3 r2.y, cb0[1].xyzx, r1.xyzx
dp3 r2.z, cb0[2].xyzx, r1.xyzx
add r0.w, |r2.z|, |r2.y|
dp3 r2.x, cb0[3].xyzx, r1.xyzx
add r0.w, r0.w, |r2.x|
div r2.xyz, r2.xyzx, r0.wwww
add r3.xy, -|r2.zyzz|, l(1.000000, 1.000000, 0.000000, 0.000000)
ge r4.xyz, r2.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
movc r2.xw, r4.yyyz, l(1.000000,0,0,1.000000), l(-1.000000,0,0,-1.000000)
mul r2.xw, r2.xxxw, r3.xxxy
movc r2.xy, r4.xxxx, r2.yzyy, r2.xwxx
mad o1.xy, r2.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
mov o1.w, l(0)
mul o2.xyzw, cb0[16].xyzw, l(1.000000, 1.000000, 1.000000, 0.500000)
mov o3.xyzw, l(0,0,0,0)
mul r1.xw, r1.zzzx, l(0.000000, 0.000000, 0.000000, 1.000000)
mad r1.xy, r1.yzyy, l(1.000000, 0.000000, 0.000000, 0.000000), -r1.xwxx
dp2 r0.w, r1.xyxx, r1.xyxx
rsq r0.w, r0.w
mul r1.xy, r0.wwww, r1.xyxx
add r0.w, |r1.y|, |r1.x|
div r1.xy, r1.xyxx, r0.wwww
mad o4.zw, r1.xxxy, l(0.000000, 0.000000, 0.500000, 0.500000), l(0.000000, 0.000000, 0.500000, 0.500000)
add r0.w, |v5.y|, |v5.x|
add r0.w, r0.w, |v5.z|
div r1.xyz, v5.zxyz, r0.wwww
add r2.xy, -|r1.zyzz|, l(1.000000, 1.000000, 0.000000, 0.000000)
ge r3.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
movc r1.xw, r3.yyyz, l(1.000000,0,0,1.000000), l(-1.000000,0,0,-1.000000)
mul r1.xw, r1.xxxw, r2.xxxy
movc r1.xy, r3.xxxx, r1.yzyy, r1.xwxx
mad o4.xy, r1.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
add r1.xyz, -v3.xyzx, cb0[0].xyzx

mul r26.x, cb13[1].x, r25.y
mul r26.y, cb13[2].x, r25.y
mul r26.z, cb13[3].x, r25.y
mul r26.w, cb13[1].x, cb13[1].x
mad r26.w, cb13[2].x, cb13[2].x, r26.w
mad r26.w, cb13[3].x, cb13[3].x, r26.w
div r26.xyz, r26.xyzx, r26.wwww

mad r1.xyz, r25.xxxx, r26.xyzx, r1.xyzx

dp3 r0.w, r1.xyzx, r1.xyzx
rsq r0.w, r0.w
mul r1.xyz, r0.wwww, r1.xyzx
mad r0.xyz, r0.xyzx, cb0[11].yyyy, -r1.xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
dp4 r1.x, v3.xyzw, cb0[7].xyzw
dp4 r1.y, v3.xyzw, cb0[8].xyzw
dp4 r0.w, v3.xyzw, cb0[9].xyzw

add r25.w, r0.w, -r25.y
mul r25.w, r25.w, l(0.5)
mad r1.x, r25.x, r25.w, r1.x

div r1.xy, r1.xyxx, r0.wwww
sample_indexable(texture2d)(float,float,float,float) r0.w, r1.xyxx, t2.yzwx, s2
mad_sat r0.w, cb0[12].y, r0.w, cb0[12].x
div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
add r1.xyz, v3.xyzx, -cb0[13].xyzx
dp3 r1.x, r1.xyzx, cb0[14].xyzx
add r1.y, r0.w, -r1.x
min r1.y, r1.y, cb0[11].z
mad r2.xyz, r0.xyzx, r1.yyyy, v3.xyzx
mov r2.w, l(1.000000)
dp4 r0.x, r2.xyzw, cb0[7].xyzw
dp4 r0.y, r2.xyzw, cb0[8].xyzw
dp4 r0.z, r2.xyzw, cb0[9].xyzw

add r25.w, r0.z, -r25.y
mul r25.w, r25.w, l(0.5)
mad r0.x, r25.x, r25.w, r0.x

div r0.xy, r0.xyxx, r0.zzzz
sample_indexable(texture2d)(float,float,float,float) r0.x, r0.xyxx, t2.xyzw, s2
mad_sat r0.x, cb0[12].y, r0.x, cb0[12].x
div r0.x, l(1.000000, 1.000000, 1.000000, 1.000000), r0.x
lt r0.y, r0.x, r1.x
movc r0.x, r0.y, r0.w, r0.x
add o5.z, -r1.x, r0.x
mov o5.xy, cb0[10].xyxx
mov o5.w, l(0)
mov o0.xyz, cb0[15].xyzx
mov o0.w, l(1.000000)
ret
// Approximately 84 instruction slots used
