// CS Volumetric Lights
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//   using 3Dmigoto v1.3.11 on Sun Sep 09 20:26:46 2018
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
//   float SpecularMipFactor;           // Offset:    0 Size:     4 [unused]
//   bool bUseBlurSkinning;             // Offset:    4 Size:     4 [unused]
//   bool bDistanceFogEnabled;          // Offset:    8 Size:     4
//
//   struct FFogBand
//   {
//
//       float4 Color;                  // Offset:   16
//       float4 DistanceDensity;        // Offset:   32
//
//   } FogBandData[8];                  // Offset:   16 Size:   256
//   float4 IndirectShadowIntensityControl;// Offset:  272 Size:    16 [unused]
//   float4 ObjectWorldPositionAndRadius;// Offset:  288 Size:    16 [unused]
//   float3 ObjectOrientation;          // Offset:  304 Size:    12 [unused]
//   float3 ObjectInvScale;             // Offset:  320 Size:    12 [unused]
//   float3 ObjectPostProjectionPosition;// Offset:  336 Size:    12 [unused]
//   float3 ObjectNDCPosition;          // Offset:  352 Size:    12 [unused]
//   float4 ObjectMacroUVScales;        // Offset:  368 Size:    16 [unused]
//   float4 UserWorldSpaceClipPlanes[2];// Offset:  384 Size:    32 [unused]
//   float2 DecalWorldSpaceLowerLeftExtent;// Offset:  416 Size:     8 [unused]
//   float4 DecalShaderUVs;             // Offset:  432 Size:    16 [unused]
//   float4 TessellationFactors;        // Offset:  448 Size:    16 [unused]
//   float4 ScreenPositionScaleBias;    // Offset:  464 Size:    16 [unused]
//   uint2 iNumLightingTiles;           // Offset:  480 Size:     8 [unused]
//   uint PrimitiveLightUsageMask;      // Offset:  488 Size:     4 [unused]
//   uint4 PointListIndices;            // Offset:  496 Size:    16 [unused]
//   uint4 SpotListIndices;             // Offset:  512 Size:    16 [unused]
//   uint4 SpotShadowListIndices;       // Offset:  528 Size:    16 [unused]
//   uint4 TubeListIndices;             // Offset:  544 Size:    16 [unused]
//   uint4 PerPixelListCountA;          // Offset:  560 Size:    16 [unused]
//   uint4 PerPixelListCountB;          // Offset:  576 Size:    16 [unused]
//   uint4 TotalLightCounts;            // Offset:  592 Size:    16 [unused]
//   uint4 UniqueTotalLightCounts;      // Offset:  608 Size:    16 [unused]
//   uint4 UniqueTotalLightOffsets;     // Offset:  624 Size:    16 [unused]
//   float3 AmbientColor;               // Offset:  640 Size:    12 [unused]
//   float4 MaterialMultiplier;         // Offset:  656 Size:    16 [unused]
//   float2 DirectAndIndirectLightingScale;// Offset:  672 Size:     8 [unused]
//   float LightIntensityClampValue;    // Offset:  680 Size:     4 [unused]
//   float SpecularLightIntensityClampValue;// Offset:  684 Size:     4 [unused]
//   float VertIndirectLightingScale;   // Offset:  688 Size:     4 [unused]
//   float4 PerObjectFog;               // Offset:  704 Size:    16 [unused]
//   float VolumetricFogRange;          // Offset:  720 Size:     4
//   bool VolumetricFogEnabled;         // Offset:  724 Size:     4
//   float4x4 ScreenToWorld;            // Offset:  736 Size:    64 [unused]
//   int TotalEnvironmentMapVolumeCount;// Offset:  800 Size:     4 [unused]
//   uint4 EnvironmentMapIndex;         // Offset:  816 Size:    16 [unused]
//   float EnvironmentIBLContributionIntensity;// Offset:  832 Size:     4
//   float DiffuseIndirectMipLevel;     // Offset:  836 Size:     4 [unused]
//   float2 FloorDistortionOffsetScale; // Offset:  840 Size:     8 [unused]
//   float3 FloorReflectionFadeParameters;// Offset:  848 Size:    12 [unused]
//   bool SSREnabled;                   // Offset:  860 Size:     4 [unused]
//   uint SSRGlobalQualityLevel;        // Offset:  864 Size:     4 [unused]
//   float SSRNumMips;                  // Offset:  868 Size:     4 [unused]
//   float TuneCurvature;               // Offset:  872 Size:     4 [unused]
//      = 0x3f800000
//   float3 NormalBlurFactor;           // Offset:  880 Size:    12 [unused]
//      = 0x3f19999a 0x3f000000 0x3f000000
//   float2 LevelDesatAndFadeControls;  // Offset:  896 Size:     8
//   float3 AOScaleAndBias;             // Offset:  912 Size:    12 [unused]
//   float4x4 InvProjectionMatrix;      // Offset:  928 Size:    64 [unused]
//   float4x4 ViewToWorldMatrix;        // Offset:  992 Size:    64 [unused]
//   float4x4 ScreenToWorldMatrix;      // Offset: 1056 Size:    64 [unused]
//   float4x4 ViewProjectionMatrix;     // Offset: 1120 Size:    64 [unused]
//   float4 ViewOrigin;                 // Offset: 1184 Size:    16 [unused]
//   float4x4 ReflectionViewProjectionMatrix;// Offset: 1200 Size:    64 [unused]
//   float4x4 InvViewProjectionMatrix;  // Offset: 1264 Size:    64 [unused]
//   float4 MinZ_MaxZRatio;             // Offset: 1328 Size:    16 [unused]
//   float4 FramebufferDimensions;      // Offset: 1344 Size:    16
//   float4 WindowDimensions;           // Offset: 1360 Size:    16
//   float2 DynamicResolutionScaleRatio;// Offset: 1376 Size:     8
//   float4 InvFocalLength;             // Offset: 1392 Size:    16
//   float4 DebugDirectIndirectEmissiveOverrides;// Offset: 1408 Size:    16 [unused]
//   float4 DebugDiffuseSpecularOverrides;// Offset: 1424 Size:    16 [unused]
//   float4 LightBoostCategoryScales[8];// Offset: 1440 Size:   128 [unused]
//   uint bUseHigherQualityGBufferEncoding;// Offset: 1568 Size:     4 [unused]
//   float CoreRadius;                  // Offset: 1572 Size:     4 [unused]
//   float4 RefiningSampleOffsets[2];   // Offset: 1584 Size:    32 [unused]
//   float4 EdgeSampleOffsets;          // Offset: 1616 Size:    16 [unused]
//   float4 UniformSampleOffsets[2];    // Offset: 1632 Size:    32 [unused]
//   float4 InvRandomAngleTextureSize;  // Offset: 1664 Size:    16 [unused]
//   float4 ShadowBufferResolution;     // Offset: 1680 Size:    16 [unused]
//   float2 Poisson25[25];              // Offset: 1696 Size:   392 [unused]
//      = 0xbf7a8bf4 0xbdb51167 0x00000000 0x00000000
//        0xbf5753b5 0x3f056b12 0x00000000 0x00000000
//        0xbf37ab75 0xbf00d307 0x00000000 0x00000000
//        0xbf33f36b 0x3f6733ca 0x00000000 0x00000000
//        0xbf29c758 0x3e1e8922 0x00000000 0x00000000
//        0xbefd7e02 0xbe6e79ee 0x00000000 0x00000000
//        0xbeba7d67 0xbf7637ef 0x00000000 0x00000000
//        0xbeb11559 0xbf107b24 0x00000000 0x00000000
//        0xbea6bd4d 0x3f23ef4a 0x00000000 0x00000000
//        0xbe3b1961 0x3ea4853c 0x00000000 0x00000000
//        0xbe120924 0xbcba417a 0x00000000 0x00000000
//        0xbd6721c8 0xbebc0d6f 0x00000000 0x00000000
//        0xbc98413f 0x3f6b3bda 0x00000000 0x00000000
//        0x3d1c6145 0xbf3a9f7b 0x00000000 0x00000000
//        0x3e29f948 0x3dbeb181 0x00000000 0x00000000
//        0x3e81dcf9 0x3f383372 0x00000000 0x00000000
//        0x3ebd3587 0xbf27af53 0x00000000 0x00000000
//        0x3ed8e5a3 0x3edc25af 0x00000000 0x00000000
//        0x3f07df09 0xbebadd7b 0x00000000 0x00000000
//        0x3f10e725 0xbf70c3e3 0x00000000 0x00000000
//        0x3f23ab43 0x3ce8c1c0 0x00000000 0x00000000
//        0x3f26ef4e 0x3f2b6f5d 0x00000000 0x00000000
//        0x3f46178f 0x3eb0a56a 0x00000000 0x00000000
//        0x3f7807ee 0x3f5727aa 0x00000000 0x00000000
//        0x3f7debfb 0xbf28474e
//   uint4 vNumLightingTiles;           // Offset: 2096 Size:    16 [unused]
//   uint4 BrickResolution;             // Offset: 2112 Size:    16 [unused]
//   float4 fNumLightingTiles;          // Offset: 2128 Size:    16 [unused]
//   float2 fVolumeSizeZ;               // Offset: 2144 Size:     8 [unused]
//   float4 vInvFocalLength;            // Offset: 2160 Size:    16 [unused]
//   float4x4 vViewToWorldMatrix;       // Offset: 2176 Size:    64 [unused]
//   float4x4 vPrevWorldToViewMatrix;   // Offset: 2240 Size:    64 [unused]
//   float4 JitterOffset;               // Offset: 2304 Size:    16 [unused]
//   float4 vFocalLength;               // Offset: 2320 Size:    16 [unused]
//   float4 EnvVolumetricFogAnisoSettings;// Offset: 2336 Size:    16 [unused]
//   float4 EnvVolumetricLightingSettings;// Offset: 2352 Size:    16 [unused]
//   float4 ShadowIntensity;            // Offset: 2368 Size:    16 [unused]
//   float4 DebugIncludeLighting;       // Offset: 2384 Size:    16 [unused]
//
// }
//
// Resource bind info for MaterialDataBuffer
// {
//
//   uint $Element;                     // Offset:    0 Size:     4
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// Bilinear3DClampedSamplerState     sampler      NA          NA    0        1
// VolumetricFogInScatteringTexture    texture  float3          3d    0        1
// VolumetricFogTransmissionTexture    texture   float          3d    1        1
// GBuffer2Texture                   texture    uint          2d    2        1
// MaterialDataBuffer                texture  struct         r/o    3        1
// LinearDepthTexture                texture   float          2d    4        1
// StencilBuffer                     texture   uint2          2d    5        1
// CopiedDirectLitColor              texture  float3          2d    6        1
// IndirectIntensityRatioBuffer      texture   float          2d    7        1
// IndirectLightingBuffer            texture  float3          2d    8        1
// DirectSpecularityLightingBuffer    texture  float3          2d    9        1
// IndirectSpecularityLightingBuffer    texture  float3          2d   10        1
// AmbientOcclusionTexture           texture   float          2d   25        1
// SceneColorOutput                      UAV  float3          2d    0        1
// $Globals                          cbuffer      NA          NA    0        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[88], dynamicIndexed
dcl_sampler s0, mode_default
dcl_resource_texture3d (float,float,float,float) t0
dcl_resource_texture3d (float,float,float,float) t1
dcl_resource_texture2d (uint,uint,uint,uint) t2
dcl_resource_structured t3, 4
dcl_resource_texture2d (float,float,float,float) t4
dcl_resource_texture2d (uint,uint,uint,uint) t5
dcl_resource_texture2d (float,float,float,float) t6
dcl_resource_texture2d (float,float,float,float) t7
dcl_resource_texture2d (float,float,float,float) t8
dcl_resource_texture2d (float,float,float,float) t9
dcl_resource_texture2d (float,float,float,float) t10
dcl_resource_texture2d (float,float,float,float) t25
dcl_uav_typed_texture2d (float,float,float,float) u0
dcl_input vThreadID.xy
//dcl_temps 6

dcl_temps 39


dcl_thread_group 8, 8, 1


// 3DMigoto StereoParams:
dcl_resource_texture2d (float,float,float,float) t125
ld_indexable(texture2d)(float,float,float,float) r38.xyzw, l(0, 0, 0, 0), t125.xyzw

add r0.xy, cb0[84].xyxx, l(-1.000000, -1.000000, 0.000000, 0.000000)
ftou r0.xy, r0.xyxx
umin r0.xy, r0.xyxx, vThreadID.xyxx
mov r0.zw, l(0,0,0,0)
ld_indexable(texture2d)(uint,uint,uint,uint) r1.x, r0.xyww, t5.yxzw
and r1.y, r1.x, l(32)
ine r1.y, r1.y, l(0)
mul r1.zw, cb0[84].xxxy, cb0[86].xxxx
ftou r1.zw, r1.zzzw
uge r1.zw, r1.zzzw, r0.xxxy
and r1.z, r1.w, r1.z
and r1.y, r1.z, r1.y
if_nz r1.y
  ld_indexable(texture2d)(uint,uint,uint,uint) r1.y, r0.xyww, t2.yxzw
  and r1.z, r1.y, l(0x00008000)
  if_z r1.z
    ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r1.y, r1.y, l(0), t3.xxxx
  endif
  ubfe r1.yzw, l(0, 1, 1, 1), l(0, 3, 7, 13), r1.yyyy
  ine r1.w, r1.w, l(0)
  ld_indexable(texture2d)(float,float,float,float) r2.xyz, r0.xyww, t6.xyzw
  and r1.x, r1.x, l(64)
  if_nz r1.x
    ld_indexable(texture2d)(float,float,float,float) r1.x, r0.xyww, t7.xyzw
    ld_indexable(texture2d)(float,float,float,float) r3.xyz, r0.xyww, t9.xyzw
    add r2.xyz, r2.xyzx, r3.xyzx
  else
    mov r1.x, l(1.000000)
  endif
  ld_indexable(texture2d)(float,float,float,float) r2.w, r0.xyww, t25.yzwx
  mul r3.xyz, r2.wwww, r2.xyzx
  movc r2.xyz, r1.zzzz, r3.xyzx, r2.xyzx
  ld_indexable(texture2d)(float,float,float,float) r3.xyz, r0.xyww, t8.xyzw
  ld_indexable(texture2d)(float,float,float,float) r4.xyz, r0.xyww, t10.xyzw
  add r3.xyz, r3.xyzx, r4.xyzx
  mul r1.z, r2.w, cb0[52].x
  mul r1.x, r1.x, r1.z
  mad r2.xyz, r3.xyzx, r1.xxxx, r2.xyzx
    
  utof r1.xz, r0.xxyx
  
  // Fix
  add r38.w, r1.x, -r38.y
  mad r1.x, -r38.w, r38.x, r1.x
 
  
  add r1.xz, r1.xxzx, l(0.500000, 0.000000, 0.500000, 0.000000)
  mul r1.xz, r1.xxzx, cb0[85].zzwz
  div r2.w, l(1.000000, 1.000000, 1.000000, 1.000000), cb0[86].x
  mul r3.xy, r1.xzxx, r2.wwww
    
  ld_indexable(texture2d)(float,float,float,float) r4.z, r0.xyzw, t4.yzxw
  if_nz cb0[0].z
    mad r3.z, -r1.z, r2.w, l(1.000000)
    mad r0.zw, r3.xxxz, l(0.000000, 0.000000, 2.000000, 2.000000), l(0.000000, 0.000000, -1.000000, -1.000000)
    mad r0.zw, r0.zzzw, cb0[87].xxxy, cb0[87].zzzw
    mul r4.xy, r4.zzzz, r0.zwzz
    dp3 r0.z, r4.xyzx, r4.xyzx
    sqrt r0.z, r0.z
    max r0.z, r0.z, cb0[2].x
    min r0.z, r0.z, cb0[16].x
    lt r0.w, cb0[4].x, r0.z
    movc r0.w, r0.w, l(2), l(1)
    lt r1.x, cb0[6].x, r0.z
    and r1.x, r1.x, l(1)
    iadd r0.w, r0.w, r1.x
    lt r1.x, cb0[8].x, r0.z
    and r1.x, r1.x, l(1)
    iadd r0.w, r0.w, r1.x
    lt r1.x, cb0[10].x, r0.z
    and r1.x, r1.x, l(1)
    iadd r0.w, r0.w, r1.x
    lt r1.x, cb0[12].x, r0.z
    and r1.x, r1.x, l(1)
    iadd r0.w, r0.w, r1.x
    lt r1.x, cb0[14].x, r0.z
    and r1.x, r1.x, l(1)
    iadd r0.w, r0.w, r1.x
    lt r1.x, cb0[16].x, r0.z
    and r1.x, r1.x, l(1)
    iadd r0.w, r0.w, r1.x
    ishl r0.w, r0.w, l(1)
    iadd r1.x, r0.w, l(-2)
    add r4.xy, -cb0[r1.x + 2].xyxx, cb0[r0.w + 2].xyxx
    add r0.z, r0.z, -cb0[r1.x + 2].x
    div r1.z, l(1.000000, 1.000000, 1.000000, 1.000000), r4.x
    mul_sat r0.z, r0.z, r1.z
    mad r1.z, r0.z, l(-2.000000), l(3.000000)
    mul r0.z, r0.z, r0.z
    mul r0.z, r0.z, r1.z
    add r5.xyz, -cb0[r1.x + 1].xyzx, cb0[r0.w + 1].xyzx
    mad r5.xyz, r0.zzzz, r5.xyzx, cb0[r1.x + 1].xyzx
    mad r0.z, r0.z, r4.y, cb0[r1.x + 2].y
    add r0.z, -r0.z, l(1.000000)
  else
    mov r5.xyz, l(0,0,0,0)
    mov r0.z, l(1.000000)
  endif
  add r2.xyz, r2.xyzx, -r5.xyzx
  mad r2.xyz, r0.zzzz, r2.xyzx, r5.xyzx
  ine r0.z, cb0[45].y, l(0)
  and r0.z, r1.w, r0.z
  if_nz r0.z
    div r0.z, r4.z, cb0[45].x
    sqrt r3.w, r0.z
    sample_l_indexable(texture3d)(float,float,float,float) r1.xzw, r3.xywx, t0.xwyz, s0, l(0.000000)
    sample_l_indexable(texture3d)(float,float,float,float) r0.z, r3.xywx, t1.yzxw, s0, l(0.000000)
    mad r2.xyz, r2.xyzx, r0.zzzz, r1.xzwx
  endif
  movc r0.z, r1.y, l(1.000000), l(0)
  mul r0.w, r0.z, cb0[56].x
  add r1.x, cb0[56].y, l(-1.000000)
  mad r0.z, r0.z, r1.x, l(1.000000)
  mul r1.xyzw, r0.zzzz, r2.xyzx
  dp3 r2.w, r1.wyzw, l(0.299000, 0.587000, 0.114000, 0.000000)
  mad r2.xyzw, -r2.xyzx, r0.zzzz, r2.wwww
  mad r1.xyzw, r0.wwww, r2.xyzw, r1.xyzw
  store_uav_typed u0.xyzw, r0.xyyy, r1.xyzw
endif
ret
// Approximately 112 instruction slots used

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