//Shadows PS manual.
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
//
//   using 3Dmigoto v1.3.16 on Sat Jan 29 12:03:20 2022
//
//
// Buffer Definitions:
//
// cbuffer ConstBuf__modelData
// {
//
//   struct ModelData
//   {
//
//       uint lightGroupID;             // Index:    0
//       uint modelFlags;               // Index:    0.y
//       float lodFade;                 // Index:    0.z
//       float displacementBlend;       // Index:    0.w
//       int turbulenceDataIdx;         // Index:    1
//       int instanceOffset;            // Index:    1.y
//       int characterFxIdx;            // Index:    1.z
//       uint debugRenderChannel;       // Index:    1.w
//       uint decayWriteOffset;         // Index:    2
//       uint decayWriteMaxCount;       // Index:    2.y
//       uint decayAtomicCounterIndex;  // Index:    2.z
//       float modelAlpha;              // Index:    2.w
//       float emissiveScale;           // Index:    3
//       float desaturationScale;       // Index:    3.y
//       float decayCoverageEstimation; // Index:    3.z
//       float3 quantScale;             // Index:    4
//       float3 quantBias;              // Index:    5
//
//   } resourceTables__modelData;       // Index:    0-5.z            Components:    23
//
// }
//
// cbuffer ConstBuf__viewData
// {
//
//   struct ViewData
//   {
//
//       float4x4 view;                 // Index:    0
//       float4x4 invView;              // Index:    4
//       float4x4 proj;                 // Index:    8
//       float4x4 invViewProjNoZReproj; // Index:   12
//       float4x4 viewProj;             // Index:   16
//       float4x4 invViewProj;          // Index:   20
//       float4x4 previousViewProj;     // Index:   24
//       float4 prevLodEyePos;          // Index:   28
//       float4 lodEyePos;              // Index:   29
//       float4 viewDirDepthBias;       // Index:   30
//       float3 eyePos;                 // Index:   31
//       float2 viewportSize;           // Index:   32
//       float2 invViewportSize;        // Index:   32.z
//       float4 mirrorPlaneWS;          // Index:   33
//       float2 mirrorViewportSize;     // Index:   34
//       float2 opaqueRefractionViewportSize;// Index:   34.z
//       float windTime;                // Index:   35
//       float deltaTime;               // Index:   35.y
//       float depthReprojectScale;     // Index:   35.z
//       float depthReprojectBias;      // Index:   35.w
//       uint shadowViewType;           // Index:   36
//       float normalDepthBias;         // Index:   36.y
//       float noNormalAA;              // Index:   36.z
//       float noNormalFromAlpha;       // Index:   36.w
//       float noOpaqueTransparency;    // Index:   37
//       float translucentAmount;       // Index:   37.y
//       uint framePhase;               // Index:   37.z
//       float cameraAmbientExposure;   // Index:   37.w
//       float fxExposure;              // Index:   38
//       float fxAmbientExposure;       // Index:   38.y
//       uint checkerboardPhase;        // Index:   38.z
//       float sparkleIntensityScale;   // Index:   38.w
//
//   } resourceTables__viewData;        // Index:    0-38             Components:   156
                                        // Texture:   t6
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// resourceTables__viewData__smpLinear    sampler      NA          NA    1        1
// resourceTables__viewData.blueNoiseTexture    texture   float     2darray    6        1
// resourceTables__materialData.material_dudv1    texture  float4          2d    9        1
// resourceTables__materialData.LayerX_opacity    texture  float4          2d   15        1
// ConstBuf__modelData               cbuffer      NA          NA    1        1
// ConstBuf__viewData                cbuffer      NA          NA    2        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyz
// VERT_ID                  0   x           1     NONE    uint   x
// TEXCOORD                 0   xy          2     NONE   float   xy
// NORMAL                   0   xyz         3     NONE   float   xyz
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// no Output
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb1[3], immediateIndexed
dcl_constantbuffer cb2[38], immediateIndexed
dcl_sampler s1, mode_default
dcl_resource_texture2darray (float,float,float,float) t6
dcl_resource_texture2d (float,float,float,float) t9
dcl_resource_texture2d (float,float,float,float) t15
dcl_input_ps_siv linear noperspective v0.xyz, position
dcl_input_ps constant v1.x
dcl_input_ps linear v2.xy
dcl_input_ps linear v3.xyz
dcl_temps 50
dcl_resource_texture2d (float,float,float,float) t125
ld_indexable(texture2d)(float,float,float,float) r40.xyzw, l(0, 0, 0, 0), t125.xyzw
ne r0.x, l(1.000000), cb1[2].w
if_nz r0.x
  if_z cb2[36].x
    ne r0.x, l(0.000000, 0.000000, 0.000000, 0.000000), cb2[37].x
    if_z r0.x
      and r0.x, v1.x, l(0x00ffffff)
      ftoi r0.yz, v0.xxyx
      iadd r0.x, r0.x, l(1)
      and r0.x, r0.x, l(7)
      imad r0.xy, r0.xxxx, l(7, 7, 0, 0), r0.yzyy
      and r0.xy, r0.xyxx, l(63, 63, 0, 0)
      and r0.z, l(7), cb2[37].z
      mov r0.w, l(0)
      ld_indexable(texture2darray)(float,float,float,float) r0.x, r0.xyzw, t6.xyzw
    else
      mov r0.x, l(0)
    endif
  else
    mov r0.x, l(0)
  endif
  ge r0.x, r0.x, cb1[2].w
  discard_nz r0.x
endif
mul r0.xy, v0.xyxx, cb2[32].zwzz
mad r0.xy, r0.xyxx, l(2.000000, -2.000000, 0.000000, 0.000000), l(-1.000000, 1.000000, 0.000000, 0.000000)
mad r0.z, v0.z, cb2[35].z, cb2[35].w
rcp r0.z, r0.z
mov r1.z, -r0.z
mul r1.xy, r0.xyxx, r1.zzzz
mov r1.w, l(1.000000)

add r40.w, r1.z, -r40.y
mad r1.x, -r40.x, r40.w, r1.x

dp4 r0.x, r1.xyzw, cb2[12].xyzw
dp4 r0.y, r1.xyzw, cb2[13].xyzw
dp4 r0.z, r1.xyzw, cb2[14].xyzw
add r0.xyz, -r0.xyzx, cb2[29].xyzx

//Tessellation specular PS..
mul r41.xyz, r40.yyyy, cb2[16].xyzx
mul r41.w, cb2[16].x, cb2[16].x
mad r41.w, cb2[16].y, cb2[16].y, r41.w
mad r41.w, cb2[16].z, cb2[16].z, r41.w
div r41.xyz, r41.xyzx, r41.wwww
mad r0.x, r40.x, r41.x, r0.x
mad r0.y, r40.x, r41.y, r0.y
mad r0.z, r40.x, r41.z, r0.z

dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
mov r1.xw, -v3.xxxx
ge r0.w, v3.z, l(0.000000)
movc r2.xy, r0.wwww, l(1.000000,-1.000000,0,0), l(-1.000000,1.000000,0,0)
add r0.w, |v3.z|, l(1.000000)
div r0.w, v3.y, r0.w
mul r2.z, r0.w, v3.y
mul r3.x, r0.w, r1.x
mad r1.y, r2.x, r2.z, v3.z
mul r1.z, r2.x, r3.x
mad r3.y, -v3.y, r0.w, l(1.000000)
mul r3.z, r2.y, v3.y
dp3 r1.x, r0.xyzx, r1.yzwy
dp3 r1.y, r0.xyzx, r3.xyzx
dp3 r1.z, r0.xyzx, v3.xyzx
add r0.xy, v2.xyxx, v2.xyxx
sample_indexable(texture2d)(float,float,float,float) r0.xy, r0.xyxx, t9.xyzw, s1
mad r0.xy, r0.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-0.996078432, -0.996078432, 0.000000, 0.000000)
dp3 r0.z, -r1.xyzx, -r1.xyzx
rsq r0.z, r0.z
mul r1.xyz, r0.zzzz, -r1.xyzx
lod r0.z, v2.xyxx, t15.x, s1
mad r2.xy, -r1.xyxx, l(-0.0756836012, 0.0756836012, 0.000000, 0.000000), v2.xyxx
mad r0.w, r0.z, l(2.000000), l(10.000000)
mov r1.w, -r1.y
dp2 r1.y, r1.xwxx, r1.xwxx
sqrt r1.y, r1.y
max r1.y, r1.y, l(0.000001)
div r1.xyz, r1.xwzx, r1.yyyy
mul r1.w, r0.w, r1.z
mul r3.xyz, r1.xywx, l(0.000976562500, 0.000976562500, 0.000774815911, 0.000000)
min r0.w, r3.z, l(-0.00520833349)
mov r1.zw, r2.xxxy
mov r2.z, l(0.612464)
loop
  mad r4.xyzw, r1.xyxy, l(0.000976562500, 0.000976562500, 0.00195312500, 0.00195312500), r1.zwzw
  mad r5.xyzw, r1.xyxy, l(0.00390625000, 0.00390625000, 0.00292968750, 0.00292968750), r1.zwzw
  sample_l_indexable(texture2d)(float,float,float,float) r6.x, r4.xyxx, t15.xyzw, s1, r0.z
  sample_l_indexable(texture2d)(float,float,float,float) r6.y, r4.zwzz, t15.yxzw, s1, r0.z
  sample_l_indexable(texture2d)(float,float,float,float) r6.z, r5.zwzz, t15.yzxw, s1, r0.z
  sample_l_indexable(texture2d)(float,float,float,float) r6.w, r5.xyxx, t15.yzwx, s1, r0.z
  mad r7.xyzw, r0.wwww, l(2.000000, 3.000000, 1.000000, 4.000000), r2.zzzz
  ge r6.xyzw, r6.xyzw, r7.zxyw
  mov r8.xy, r5.zwzz
  mov r8.z, r7.y
  mov r5.z, r7.w
  movc r5.xyz, r6.zzzz, r8.xyzx, r5.xyzx
  mov r8.xy, r4.zwzz
  mov r8.z, r7.x
  movc r5.xyz, r6.yyyy, r8.xyzx, r5.xyzx
  mov r7.xy, r4.xyxx
  movc r4.xyz, r6.xxxx, r7.xyzx, r5.xyzx
  or r3.zw, r6.zzzw, r6.xxxy
  or r2.w, r3.w, r3.z
  if_nz r2.w
    mov r1.zw, r4.xxxy
    mov r2.z, r4.z
    break
  endif
  mov r1.zw, r4.xxxy
  mov r2.z, r4.z
endloop
sample_l_indexable(texture2d)(float,float,float,float) r2.x, r1.zwzz, t15.xyzw, s1, r0.z
mad r1.xy, -r1.xyxx, l(0.000976562500, 0.000976562500, 0.000000, 0.000000), r1.zwzz
sample_l_indexable(texture2d)(float,float,float,float) r0.z, r1.xyxx, t15.yzxw, s1, r0.z
add r0.w, -r0.w, r2.z
add r1.x, -r2.x, r2.z
add r0.z, -r0.z, r0.w
mul r2.xy, |r1.xxxx|, r3.xyxx
add r0.z, |r0.z|, |r1.x|
max r0.z, r0.z, l(0.000010)
div r0.zw, r2.xxxy, r0.zzzz
add r0.zw, -r0.zzzw, r1.zzzw
add r0.zw, r0.zzzw, -v2.xxxy
mad r0.xy, r0.xyxx, l(-0.010376, 0.010376, 0.000000, 0.000000), r0.zwzz
add r0.xy, r0.xyxx, v2.xyxx
sample_indexable(texture2d)(float,float,float,float) r0.x, r0.xyxx, t15.xyzw, s1
mov_sat r0.x, r0.x
ge r0.x, l(0.000000), r0.x
discard_nz r0.x
ret
// Approximately 117 instruction slots used
