//Volumetric lighting CS from cache.
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
//
//   using 3Dmigoto v1.3.16 on Fri Jan 14 20:06:33 2022
//
//
// Note: shader requires additional functionality:
//       64 UAV slots
//
//
// Buffer Definitions:
//
// cbuffer ConstBuf__volumetricFogData
// {
//
//   struct VolumetricFogData
//   {
//
//       float4 cPoissonSamples[64];    // Index:    0
//       float4x4 cInvViewProjMatrixNoZReproj;// Index:   64
//       float4x4 cReprojToPreviousFrame;// Index:   68
//       float4 cWorldEyePos;           // Index:   72
//       float4x4 cGIVolumeTransform;   // Index:   73
//       float4 cGIVolumeStart;         // Index:   77
//       float4 cGIVolumeTexelScale;    // Index:   78
//
//       struct AtmosphericConstants
//       {
//
//           float3 cFogColor;          // Index:   79
//           float cHeightFalloff;      // Index:   79.w
//           float3 cEyePosition;       // Index:   80
//           float cHeightDensity;      // Index:   80.w
//           float cStartDistance;      // Index:   81
//           float cGlobalDensity;      // Index:   81.y
//           float cDepthReprojectScale;// Index:   81.z
//           float cDepthReprojectBias; // Index:   81.w
//           float4x4 cInvProjNoZReproj;// Index:   82
//           float3 cDirectionalFogDirection;// Index:   86
//           float cDirectionalityPower;// Index:   86.w
//           float3 cDirectionalFogColor;// Index:   87
//           float cDensityMapSparseBias;// Index:   87.w
//           float3 cDensityMapInvExtents;// Index:   88
//           float cDensityMapSparseSegmentScale;// Index:   88.w
//           float3 cDensityMapBias;    // Index:   89
//           float cDensityMapSparseCutoff;// Index:   89.w
//           float cVolFogExponentMultiply;// Index:   90
//           float cVolFogDistanceMultiply;// Index:   90.y
//           float cVolFogExponentNormalize;// Index:   90.z
//           float cVolFogDistanceNormalize;// Index:   90.w
//           float cVolFogResolutionScale;// Index:   91
//           int cVolFogWidth;          // Index:   91.y
//           int cVolFogHeight;         // Index:   91.z
//           int cVolFogDepth;          // Index:   91.w
//
//       } atmosphericConstants;        // Index:   79
//       float3 cFogAlbedo;             // Index:   92
//       float cLightingTemporal;       // Index:   92.w
//       float cDensityTemporal;        // Index:   93
//       float cPrevFogResolutionScale; // Index:   93.y
//       float CascadeShadowSize;       // Index:   93.z
//       float OneOverCascadeShadowSize;// Index:   93.w
//       float ShadowTextureW;          // Index:   94
//       float ShadowTextureH;          // Index:   94.y
//       float OneOverShadowTextureW;   // Index:   94.z
//       float OneOverShadowTextureH;   // Index:   94.w
//
//   } resourceTables__volumetricFogData;// Index:    0-94             Components:   380
                                        // Textures:  t0-t1
//
// }
//
// cbuffer ConstBuf__volumetricFogDensityData
// {
//
//   struct VolumetricFogDensityData
//   {
//
//       struct AtmosphericConstants
//       {
//
//           float3 cFogColor;          // Index:    0
//           float cHeightFalloff;      // Index:    0.w
//           float3 cEyePosition;       // Index:    1
//           float cHeightDensity;      // Index:    1.w
//           float cStartDistance;      // Index:    2
//           float cGlobalDensity;      // Index:    2.y
//           float cDepthReprojectScale;// Index:    2.z
//           float cDepthReprojectBias; // Index:    2.w
//           float4x4 cInvProjNoZReproj;// Index:    3
//           float3 cDirectionalFogDirection;// Index:    7
//           float cDirectionalityPower;// Index:    7.w
//           float3 cDirectionalFogColor;// Index:    8
//           float cDensityMapSparseBias;// Index:    8.w
//           float3 cDensityMapInvExtents;// Index:    9
//           float cDensityMapSparseSegmentScale;// Index:    9.w
//           float3 cDensityMapBias;    // Index:   10
//           float cDensityMapSparseCutoff;// Index:   10.w
//           float cVolFogExponentMultiply;// Index:   11
//           float cVolFogDistanceMultiply;// Index:   11.y
//           float cVolFogExponentNormalize;// Index:   11.z
//           float cVolFogDistanceNormalize;// Index:   11.w
//           float cVolFogResolutionScale;// Index:   12
//           int cVolFogWidth;          // Index:   12.y
//           int cVolFogHeight;         // Index:   12.z
//           int cVolFogDepth;          // Index:   12.w
//
//       } atmosphericConstants;        // Index:    0
//
//       struct FogDensityMapConstants
//       {
//
//           float4x4 cMatrix;          // Index:   13
//           float cStartDistance;      // Index:   17
//           float cStartDistanceRcp;   // Index:   17.y
//           float cFogVerticalAttenuation;// Index:   17.z
//           float cDensityHeightStart; // Index:   17.w
//           float cDensityHeightScale; // Index:   18
//           float cGlobalDensityScale; // Index:   18.y
//           float cVolumetricFogScattering;// Index:   18.z
//           float cFlowMap0Scale;      // Index:   18.w
//           float cFlowMap1Scale;      // Index:   19
//           float cFlowMap0Weight;     // Index:   19.y
//           float cFlowMap1Weight;     // Index:   19.z
//           int cFlowMapEnabled;       // Index:   19.w
//           float cLocalWeight;        // Index:   20
//
//       } fogDensityMapConstants;      // Index:   13
//       float cStartDistance;          // Index:   20.y
//       float cStartDistanceRcp;       // Index:   20.z
//       float cVolumetricFogScattering;// Index:   20.w
//       float cVolumetricFogAbsorption;// Index:   21
//       float cFogVerticalAttenuation; // Index:   21.y
//       float3 cWorldEyePos;           // Index:   22
//       float cVerticalFalloffRelativePosTimesAttenuation;// Index:   22.w
//       float cVerticalFalloffRelativePos;// Index:   23
//       float cVolumetricFogTransmittanceFade;// Index:   23.y
//
//   } resourceTables__volumetricFogDensityData;// Index:    0-23.y           Components:    94
                                        // Textures:  t8-t13
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// resourceTables__volumetricFogData__smpLinear    sampler      NA          NA    1        1
// resourceTables__volumetricFogDensityData__smpLinearClamp    sampler      NA          NA    6        1
// resourceTables__volumetricFogDensityData__smpLinearBorder    sampler      NA          NA    7        1
// resourceTables__volumetricFogData.OpticalDensityTextureAccum    texture  float2          3d    1        1
// resourceTables__volumetricFogDensityData.PC_ParticleDensityTexture    texture   float          3d   10        1
// resourceTables__volumetricFogDensityData.PC_ParticleScatterTexture    texture   float          3d   11        1
// resourceTables__volumetricFogDensityData.DensityMap    texture  float3          2d   12        1
// resourceTables__volumetricFogDensityData.FlowMap    texture  float3          2d   13        1
// resourceTables__volumetricFogData.OutOpticalDensityTexture        UAV  float2          3d    9        1
// ConstBuf__volumetricFogData       cbuffer      NA          NA    0        1
// ConstBuf__volumetricFogDensityData    cbuffer      NA          NA    1        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// no Input
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// no Output
cs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[94], dynamicIndexed
dcl_constantbuffer cb1[23], immediateIndexed
dcl_constantbuffer cb12[3], immediateIndexed
dcl_sampler s1, mode_default
dcl_sampler s6, mode_default
dcl_sampler s7, mode_default
dcl_resource_texture3d (float,float,float,float) t1
dcl_resource_texture3d (float,float,float,float) t10
dcl_resource_texture3d (float,float,float,float) t11
dcl_resource_texture2d (float,float,float,float) t12
dcl_resource_texture2d (float,float,float,float) t13
dcl_uav_typed_texture3d (float,float,float,float) u9
dcl_input vThreadIDInGroupFlattened
dcl_input vThreadGroupID.xyz
dcl_temps 50
dcl_thread_group 4, 4, 4
dcl_resource_texture2d (float,float,float,float) t125
ld_indexable(texture2d)(float,float,float,float) r40.xyzw, l(0, 0, 0, 0), t125.xyzw
ld_indexable(texture2d)(float,float,float,float) r41.xyzw, l(2, 0, 0, 0), t125.xyzw
ishl r0.x, vThreadIDInGroupFlattened.x, l(1)
ushr r0.xy, l(0xebfa5014, 0xfa4141af, 0, 0), r0.xxxx
and r0.xy, r0.xyxx, l(3, 3, 0, 0)
ushr r0.zw, vThreadIDInGroupFlattened.xxxx, l(0, 0, 4, 4)
imad r0.xyzw, vThreadGroupID.xyzz, l(4, 4, 4, 4), r0.xyzw
utof r1.xyz, r0.xywx
add r2.xyz, r1.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000)
itof r3.xyz, cb0[91].yzwy
mul r4.xyz, r3.xyzx, cb0[91].xxxx
mul r2.xyz, r2.xyzx, l(2.000000, -2.000000, 1.000000, 0.000000)
div r2.xyz, r2.xyzx, r4.xyzx
add r2.xyz, r2.xyzx, l(-1.000000, 1.000000, 0.000000, 0.000000)
mul r1.w, r2.z, cb0[90].x
exp r1.w, r1.w
add r1.w, r1.w, l(-1.000000)
mul r5.z, r1.w, cb0[90].y
mul r5.xy, r2.xyxx, r5.zzzz
mov r5.w, l(1.000000)

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

dp4 r2.x, r5.xyzw, cb0[68].xyzw
dp4 r2.y, r5.xyzw, cb0[69].xyzw
dp4 r1.w, r5.xyzw, cb0[70].xyzw

ge r42.x, r41.x, l(5.0)
if_z r42.x
add r40.w, r1.w, -cb12[2].y
mad r2.x, cb12[2].x, r40.w, r2.x
else
add r40.w, r1.w, -r40.y
mad r2.x, r40.x, r40.w, r2.x
endif

div r2.xy, r2.xyxx, r1.wwww
mad r5.xy, r2.xyxx, l(0.500000, -0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
mad r2.z, r1.w, cb0[90].w, l(1.000000)
log r2.z, r2.z
mul r5.z, r2.z, cb0[90].z
mul r5.xyz, r5.xyzx, cb0[93].yyyy
lt r2.xy, |r2.xyxx|, l(1.000000, 1.000000, 0.000000, 0.000000)
and r2.x, r2.y, r2.x
and r2.x, r2.x, l(0x3f800000)
mul r2.x, r2.x, cb0[93].x
mul_sat r1.w, r1.w, l(1000.000000)
mul r1.w, r1.w, r2.x
div r2.xyz, l(0.500000, 0.500000, 0.500000, 0.000000), r3.xyzx
add r3.xyz, -r2.xyzx, cb0[93].yyyy
max r2.xyz, r2.xyzx, r5.xyzx
min r2.xyz, r3.xyzx, r2.xyzx
sample_l_indexable(texture3d)(float,float,float,float) r2.xy, r2.xyzx, t1.xyzw, s1, l(0.000000)
mov r2.z, vThreadIDInGroupFlattened.x
add r1.xyz, r1.xyzx, cb0[r2.z + 0].xyzx
mul r1.xyz, r1.xyzx, l(2.000000, -2.000000, 1.000000, 0.000000)
div r1.xyz, r1.xyzx, r4.xyzx
add r1.xyz, r1.xyzx, l(-1.000000, 1.000000, 0.000000, 0.000000)
mul r1.z, r1.z, cb0[90].x
exp r1.z, r1.z
add r1.z, r1.z, l(-1.000000)
mul r3.z, r1.z, cb0[90].y
mul r3.xy, r1.xyxx, r3.zzzz
mov r3.w, l(1.000000)

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

dp4 r4.x, r3.xyzw, cb0[64].xyzw
dp4 r4.y, r3.xyzw, cb0[65].xyzw
dp4 r4.z, r3.xyzw, cb0[66].xyzw
add r1.xyz, r4.xyzx, -cb0[72].xyzx
dp3 r1.x, r1.xyzx, r1.xyzx
max r1.x, r1.x, l(0.000001)
rsq r1.y, r1.x
mul r1.x, r1.y, r1.x
mov r4.w, l(1.000000)
dp4 r3.x, r4.xyzw, cb1[13].xyzw
dp4 r3.y, r4.xyzw, cb1[15].xyzw
mov_sat r1.yz, r3.xxyx
eq r1.yz, r1.yyzy, r3.xxyx
and r1.y, r1.z, r1.y
if_nz r1.y
  if_nz cb1[19].w
    sample_l_indexable(texture2d)(float,float,float,float) r1.yz, r3.xyxx, t13.zxyw, s6, l(0.000000)
    mad r1.yz, r1.yyzy, l(0.000000, 2.000000, 2.000000, 0.000000), l(0.000000, -1.000000, -1.000000, 0.000000)
    mad r2.zw, r1.yyyz, cb1[18].wwww, r3.xxxy
    sample_l_indexable(texture2d)(float,float,float,float) r5.xyz, r2.zwzz, t12.xyzw, s6, l(0.000000)
    mad r1.yz, r1.yyzy, cb1[19].xxxx, r3.xxyx
    sample_l_indexable(texture2d)(float,float,float,float) r6.xyz, r1.yzyy, t12.xyzw, s6, l(0.000000)
    mul r6.xyz, r6.xyzx, cb1[19].zzzz
    mad r5.xyz, cb1[19].yyyy, r5.xyzx, r6.xyzx
  else
    sample_l_indexable(texture2d)(float,float,float,float) r5.xyz, r3.xyxx, t12.xyzw, s6, l(0.000000)
  endif
  mul r1.y, r5.y, cb1[18].y
  mad r1.z, cb1[18].x, r5.x, cb1[17].w
  mul r2.z, r5.z, cb1[17].z
  mad_sat r2.w, r1.x, cb1[17].y, l(-1.000000)
  add r1.z, -r1.z, r4.y
  mul r1.z, r2.z, -r1.z
  exp r1.z, r1.z
  min r1.z, r1.z, l(1.000000)
  mul r1.y, r1.y, r2.w
  mul r1.y, r1.z, r1.y
  mul r1.y, r1.y, cb1[18].z
  mad r1.z, cb1[18].y, r5.y, l(-1.000000)
  mad r1.z, cb1[20].x, r1.z, l(1.000000)
  mul r1.y, r1.y, cb1[20].x
else
  mov r1.yz, l(0,0,1.000000,0)
endif
mad_sat r1.x, r1.x, cb1[20].z, l(-1.000000)
mad r2.z, -r4.y, cb1[21].y, cb1[22].w
exp r2.z, r2.z
min r2.z, r2.z, l(1.000000)
mul r1.x, r1.z, r1.x
mul r1.x, r2.z, r1.x
mad r3.xzw, r1.xxxx, cb1[20].wwww, r1.yyyy
mul r3.y, r1.x, cb1[21].x
mad r1.xyz, r4.xyzx, cb1[9].xyzx, cb1[10].xyzx
lt r4.xyz, l(0.000000, 0.000000, 0.000000, 0.000000), r1.xyzx
lt r5.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
iadd r4.xyz, -r4.xyzx, r5.xyzx
itof r4.xyz, r4.xyzx
mul r4.xyz, r4.xyzx, cb1[8].wwww
mad r4.xyz, cb1[9].wwww, r1.xyzx, r4.xyzx
lt r5.xyz, |r1.xyzx|, cb1[10].wwww
movc r1.xyz, r5.xyzx, r1.xyzx, r4.xyzx
mad r1.xyz, r1.xyzx, l(0.496093750, 0.496093750, 0.496093750, 0.000000), l(0.500000, 0.500000, 0.500000, 0.000000)
sample_l_indexable(texture3d)(float,float,float,float) r2.z, r1.xyzx, t11.yzxw, s7, l(0.000000)
sample_l_indexable(texture3d)(float,float,float,float) r4.y, r1.xyzx, t10.yxzw, s7, l(0.000000)
mov r4.xzw, r2.zzzz
add_sat r4.xyzw, r4.xyzw, l(-1.000000, -1.000000, -1.000000, -1.000000)
mad r3.xyzw, r4.xyzw, l(2048.000000, 2048.000000, 2048.000000, 2048.000000), r3.xyzw
add r2.xyzw, r2.xyxx, -r3.wyww
mad r1.xyzw, r1.wwww, r2.xyzw, r3.xyzw
store_uav_typed u9.xyzw, r0.xyzw, r1.xyzw
ret
// Approximately 120 instruction slots used
