//Iggy 2D sand PS.
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.16 on Fri Sep 02 23:19:01 2022
//
//
// Buffer Definitions:
//
// cbuffer perMaterialBuffer
// {
//
//   float4 g_commonParam;              // Index:    0.xyzw           Components:     4
//   float4 g_fogColor;                 // Index:    1.xyzw           Components:     4
//   float4 g_fogParam;                 // Index:    2.xyzw           Components:     4 [unused]
//   float4 g_ambientColor;             // Index:    3.xyzw           Components:     4 [unused]
//   row_major float4x4 g_matWorldViewProj;// Index:    4 5 6 7          Components:    16 [unused]
//   float4 g_uvOffset0;                // Index:    8.xyzw           Components:     4 [unused]
//   float4 g_uvOffset1;                // Index:    9.xyzw           Components:     4 [unused]
//   float4 g_blendRate;                // Index:   10.xyzw           Components:     4 [unused]
//   float4 g_blendType;                // Index:   11.xyzw           Components:     4 [unused]
//   float4 g_multColor;                // Index:   12.xyzw           Components:     4 [unused]
//   row_major float4x4 g_matShadowProj0;// Index:   13 14 15 16       Components:    16 [unused]
//   row_major float4x4 g_matShadowProj1;// Index:   17 18 19 20       Components:    16 [unused]
//   row_major float4x4 g_matShadowProj2;// Index:   21 22 23 24       Components:    16 [unused]
//   row_major float4x4 g_matShadowProj3;// Index:   25 26 27 28       Components:    16 [unused]
//   float4 g_shadowParam;              // Index:   29.xyzw           Components:     4
//   float4 g_shadowColor;              // Index:   30.xyzw           Components:     4
//   float4 g_ScreenToUV;               // Index:   31.xyzw           Components:     4
//   float4 g_uvOffset3;                // Index:   32.xyzw           Components:     4
//   float4 g_uvOffsetScreen;           // Index:   33.xyzw           Components:     4
//   float4 g_uvScaleScreen;            // Index:   34.xyzw           Components:     4
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// g_sampler0                        sampler      NA          NA    0        1
// g_samplerScreen0                  sampler      NA          NA    1        1
// g_samplerScreen1                  sampler      NA          NA    2        1
// g_samplerShadow                 sampler_c      NA          NA    3        1
// g_texture0                        texture  float4          2d    0        1
// g_texture2                        texture  float4          2d    1        1
// g_texture3                        texture  float4          2d    2        1
// g_textureShadow                   texture  float4          2d    3        1
// perMaterialBuffer                 cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xy
// COLOR                    0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 0   xy          2     NONE   float   xy
// TEXCOORD                 1     z         2     NONE   float     z
// TEXCOORD                 2   xyzw        3     NONE   float   xyzw
// TEXCOORD                 3   xyzw        4     NONE   float   xyzw
// TEXCOORD                 4   xyzw        5     NONE   float   xyzw
// TEXCOORD                 9   xyzw        6     NONE   float   xyzw
// COLOR                    1   xyzw        7     NONE   float      w
//
//
// 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
//
ps_4_0
dcl_constantbuffer cb0[35], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, mode_comparison
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_siv linear noperspective v0.xy, position
dcl_input_ps linear v1.xyzw
dcl_input_ps linear v2.xy
dcl_input_ps linear v2.z
dcl_input_ps linear v3.xyzw
dcl_input_ps linear v4.xyzw
dcl_input_ps linear v5.xyzw
dcl_input_ps linear v6.xyzw
dcl_input_ps linear v7.w
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_temps 35
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 r0.xyzw, v2.xyxx, t0.xyzw, s0
mul r0.xyzw, r0.xyzw, v1.xyzw
lt r1.xyz, cb0[29].zyxz, v7.wwww
movc r2.xyzw, r1.zzzz, v4.xyzw, v3.xyzw
movc r2.xyzw, r1.yyyy, v5.xyzw, r2.xyzw
movc r1.xyzw, r1.xxxx, v6.xyzw, r2.xyzw
div r1.xyz, r1.xyzx, r1.wwww
add r1.z, r1.z, l(-0.000600)
mov r1.w, l(0)
mov r2.x, l(-2)
loop
  itof r2.y, r2.x
  ge r2.z, r2.y, l(2.000000)
  breakc_nz r2.z
  add r2.y, r2.y, l(0.500000)
  mad r3.x, r2.y, l(0.000488281250), r1.x
  mov r2.y, r1.w
  mov r2.z, l(-2)
  loop
    itof r2.w, r2.z
    ge r3.z, r2.w, l(2.000000)
    breakc_nz r3.z
    add r2.w, r2.w, l(0.500000)
    mad r3.y, r2.w, l(0.000195312503), r1.y
    sample_c_lz r2.w, r3.xyxx, t3.xxxx, s3, r1.z
    add r2.y, r2.w, r2.y
    iadd r2.z, r2.z, l(1)
  endloop
  mov r1.w, r2.y
  iadd r2.x, r2.x, l(1)
endloop
ge r1.x, cb0[0].x, r0.w
discard_nz r1.x
mul_sat r1.x, r1.w, l(0.062500)
add r1.y, -v7.w, cb0[29].w
mul_sat r1.y, r1.y, l(0.002000)
add r1.x, r1.x, l(-1.000000)
mad r1.x, r1.y, r1.x, l(1.000000)
add r1.yzw, -cb0[30].xxyz, l(0.000000, 1.000000, 1.000000, 1.000000)
mad r1.xyz, r1.xxxx, r1.yzwy, cb0[30].xyzx
mul r2.xyz, r0.xyzx, r1.xyzx
mov r3.x, l(1.000000)
mov r3.yz, cb0[31].yyxy
mul r4.xyzw, r3.xyxy, cb0[34].xyzw
mov r3.w, v0.y
mul r3.xyzw, r3.zwzw, r4.xyzw
mul r4.xyzw, cb0[33].xyzw, cb0[34].xyzw
mov r5.x, v0.x
mov r5.y, l(-1.000000)
mad r6.xy, r3.xyxx, r5.xyxx, r4.xyxx
add r6.z, -r6.y, l(1.000000)

div r26.x, r25.y, v0.w
add r26.x, l(1.0), -r26.x
mul r26.x, r26.x, l(8.0)
mad r6.x, -r25.x, r26.x, r6.x

sample r6.xyzw, r6.xzxx, t1.xyzw, s1
mul r1.w, r6.w, cb0[32].x
mad r0.xyz, -r0.xyzx, r1.xyzx, r6.xyzx
mad r0.xyz, r1.wwww, r0.xyzx, r2.xyzx
mad r1.xy, r3.zwzz, r5.xyxx, r4.zwzz
add r1.z, -r1.y, l(1.000000)

div r26.x, r25.y, v0.w
add r26.x, l(1.0), -r26.x
mul r26.x, r26.x, l(12.0)
mad r1.x, -r25.x, r26.x, r1.x

sample r1.xyzw, r1.xzxx, t2.xyzw, s2
mul r1.w, r1.w, cb0[32].y
add r1.xyz, -r0.xyzx, r1.xyzx
mad r0.xyz, r1.wwww, r1.xyzx, r0.xyzx
mul r0.w, r0.w, cb0[0].y
add r0.xyz, r0.xyzx, -cb0[1].xyzx
mad o0.xyz, v2.zzzz, r0.xyzx, cb0[1].xyzx
mov o0.w, r0.w
mov o1.xy, cb0[0].wzww
mov o1.z, l(0.990000)
mov o1.w, r0.w
ret
// Approximately 69 instruction slots used

///////////////////////////////// HLSL Code /////////////////////////////////
// // ---- Created with 3Dmigoto v1.3.16 on Fri Sep 02 23:19:01 2022
//
// cbuffer perMaterialBuffer : register(b0)
// {
//   float4 g_commonParam : packoffset(c0);
//   float4 g_fogColor : packoffset(c1);
//   float4 g_fogParam : packoffset(c2);
//   float4 g_ambientColor : packoffset(c3);
//   row_major float4x4 g_matWorldViewProj : packoffset(c4);
//   float4 g_uvOffset0 : packoffset(c8);
//   float4 g_uvOffset1 : packoffset(c9);
//   float4 g_blendRate : packoffset(c10);
//   float4 g_blendType : packoffset(c11);
//   float4 g_multColor : packoffset(c12);
//   row_major float4x4 g_matShadowProj0 : packoffset(c13);
//   row_major float4x4 g_matShadowProj1 : packoffset(c17);
//   row_major float4x4 g_matShadowProj2 : packoffset(c21);
//   row_major float4x4 g_matShadowProj3 : packoffset(c25);
//   float4 g_shadowParam : packoffset(c29);
//   float4 g_shadowColor : packoffset(c30);
//   float4 g_ScreenToUV : packoffset(c31);
//   float4 g_uvOffset3 : packoffset(c32);
//   float4 g_uvOffsetScreen : packoffset(c33);
//   float4 g_uvScaleScreen : packoffset(c34);
// }
//
// SamplerState g_sampler0_s : register(s0);
// SamplerState g_samplerScreen0_s : register(s1);
// SamplerState g_samplerScreen1_s : register(s2);
// SamplerComparisonState g_samplerShadow_s : register(s3);
// Texture2D<float4> g_texture0 : register(t0);
// Texture2D<float4> g_texture2 : register(t1);
// Texture2D<float4> g_texture3 : register(t2);
// Texture2D<float4> g_textureShadow : register(t3);
//
//
// // 3Dmigoto declarations
// #define cmp -
// Texture1D<float4> IniParams : register(t120);
// Texture2D<float4> StereoParams : register(t125);
//
//
// void main(
//   float4 v0 : SV_Position0,
//   float4 v1 : COLOR0,
//   float2 v2 : TEXCOORD0,
//   float w2 : TEXCOORD1,
//   float4 v3 : TEXCOORD2,
//   float4 v4 : TEXCOORD3,
//   float4 v5 : TEXCOORD4,
//   float4 v6 : TEXCOORD9,
//   float4 v7 : COLOR1,
//   out float4 o0 : SV_Target0,
//   out float4 o1 : SV_Target1)
// {
//   float4 r0,r1,r2,r3,r4,r5,r6;
//   uint4 bitmask, uiDest;
//   float4 fDest;
//
//   r0.xyzw = g_texture0.Sample(g_sampler0_s, v2.xy).xyzw;
//   r0.xyzw = v1.xyzw * r0.xyzw;
//   r1.xyz = cmp(g_shadowParam.zyx < v7.www);
//   r2.xyzw = r1.zzzz ? v4.xyzw : v3.xyzw;
//   r2.xyzw = r1.yyyy ? v5.xyzw : r2.xyzw;
//   r1.xyzw = r1.xxxx ? v6.xyzw : r2.xyzw;
//   r1.xyz = r1.xyz / r1.www;
//   r1.z = -0.000600000028 + r1.z;
//   r1.w = 0;
//   r2.x = -2;
//   while (true) {
//     r2.y = (int)r2.x;
//     r2.z = cmp(r2.y >= 2);
//     if (r2.z != 0) break;
//     r2.y = 0.5 + r2.y;
//     r3.x = r2.y * 0.00048828125 + r1.x;
//     r2.y = r1.w;
//     r2.z = -2;
//     while (true) {
//       r2.w = (int)r2.z;
//       r3.z = cmp(r2.w >= 2);
//       if (r3.z != 0) break;
//       r2.w = 0.5 + r2.w;
//       r3.y = r2.w * 0.000195312503 + r1.y;
//       r2.w = g_textureShadow.SampleCmpLevelZero(g_samplerShadow_s, r3.xy, r1.z).x;
//       r2.y = r2.y + r2.w;
//       r2.z = (int)r2.z + 1;
//     }
//     r1.w = r2.y;
//     r2.x = (int)r2.x + 1;
//   }
//   r1.x = cmp(g_commonParam.x >= r0.w);
//   if (r1.x != 0) discard;
//   r1.x = saturate(0.0625 * r1.w);
//   r1.y = g_shadowParam.w + -v7.w;
//   r1.y = saturate(0.00200000009 * r1.y);
//   r1.x = -1 + r1.x;
//   r1.x = r1.y * r1.x + 1;
//   r1.yzw = float3(1,1,1) + -g_shadowColor.xyz;
//   r1.xyz = r1.xxx * r1.yzw + g_shadowColor.xyz;
//   r2.xyz = r1.xyz * r0.xyz;
//   r3.x = 1;
//   r3.yz = g_ScreenToUV.yx;
//   r4.xyzw = g_uvScaleScreen.xyzw * r3.xyxy;
//   r3.w = v0.y;
//   r3.xyzw = r4.xyzw * r3.zwzw;
//   r4.xyzw = g_uvScaleScreen.xyzw * g_uvOffsetScreen.xyzw;
//   r5.x = v0.x;
//   r5.y = -1;
//   r6.xy = r3.xy * r5.xy + r4.xy;
//   r6.z = 1 + -r6.y;
//   r6.xyzw = g_texture2.Sample(g_samplerScreen0_s, r6.xz).xyzw;
//   r1.w = g_uvOffset3.x * r6.w;
//   r0.xyz = -r0.xyz * r1.xyz + r6.xyz;
//   r0.xyz = r1.www * r0.xyz + r2.xyz;
//   r1.xy = r3.zw * r5.xy + r4.zw;
//   r1.z = 1 + -r1.y;
//   r1.xyzw = g_texture3.Sample(g_samplerScreen1_s, r1.xz).xyzw;
//   r1.w = g_uvOffset3.y * r1.w;
//   r1.xyz = r1.xyz + -r0.xyz;
//   r0.xyz = r1.www * r1.xyz + r0.xyz;
//   r0.w = g_commonParam.y * r0.w;
//   r0.xyz = -g_fogColor.xyz + r0.xyz;
//   o0.xyz = w2.xzz * r0.xyz + g_fogColor.xyz;
//   o0.w = r0.w;
//   o1.xy = g_commonParam.wz;
//   o1.z = 0.99000001;
//   o1.w = r0.w;
//   return;
// }
//////////////////////////////// HLSL Errors ////////////////////////////////
// F:\SteamLibrary\steamapps\common\JoJo's Bizarre Adventure All-Star Battle R\ShaderFixes\90850d36d170be4f-ps_replace.txt(123,12-17): error X3018: invalid subscript 'xzz'
/////////////////////////////////////////////////////////////////////////////
