// Light Shafts (DSS)
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
//
//   using 3Dmigoto v1.3.11 on Tue Mar 05 19:41:32 2019
//
//
// Buffer Definitions:
//
// cbuffer _cbSharedPerViewData
// {
//
//   struct S_cbSharedPerViewData
//   {
//
//       row_major float4x4 mProjection;// Offset:    0
//       row_major float4x4 mProjectionPrev;// Offset:   64
//       row_major float4x4 mViewToViewport;// Offset:  128
//       row_major float4x4 mViewToWorld;// Offset:  192
//       row_major float4x4 mViewToWorldPrev;// Offset:  256
//       row_major float4x4 mFxWorldToSampleSpace;// Offset:  320
//       float4 vViewRemap;             // Offset:  384
//       float4 vViewDepthRemap;        // Offset:  400
//       float4 vEyeVectorUL;           // Offset:  416
//       float4 vEyeVectorLR;           // Offset:  432
//       float4 vEyeVectorDelta;        // Offset:  448
//       float4 vPixelToEyeVectorScaleBias;// Offset:  464
//       float4 vViewSpaceUpVector;     // Offset:  480
//       float4 vViewportSize;          // Offset:  496
//       float4 vTesselationEnabled;    // Offset:  512
//       float4 vEngineTime;            // Offset:  528
//       uint nFrameCounter;            // Offset:  544
//       float4 vShaderColor0;          // Offset:  560
//       float4 vShaderColor1;          // Offset:  576
//       float4 vShaderColor2;          // Offset:  592
//       float4 vShaderColor3;          // Offset:  608
//       float4 vShaderColor4;          // Offset:  624
//       float4 vClipPlane;             // Offset:  640
//       float4 vClipPlane0;            // Offset:  656
//       float4 vClipPlane1;            // Offset:  672
//       float4 vClipPlane2;            // Offset:  688
//       float4 vClipPlane3;            // Offset:  704
//       float4 vClipPlane4;            // Offset:  720
//       float4 vClipPlane5;            // Offset:  736
//       float4 vMippedDepthRemap;      // Offset:  752
//       float4 vSpecularOcclusionSettings;// Offset:  768
//       float4 vSaturatedAmbientOcclusionSettings;// Offset:  784
//       float4 vLightModelSettings;    // Offset:  800
//       float4 vHDRScale;              // Offset:  816
//       float4 vTweakableShaderParams; // Offset:  832
//       float4 vAtmosphericScatteringParameters;// Offset:  848
//       float4 vAtmosphericScatteringParameters2;// Offset:  864
//       float4 vAtmosphericScatteringParameters3;// Offset:  880
//       float3 vAtmosphericScatteringMieBeta;// Offset:  896
//       float3 vAtmosphericScatteringRayleighBeta;// Offset:  912
//       float3 vAtmosphericScatteringShadowedMieBeta;// Offset:  928
//       float3 vAtmosphericScatteringShadowedRayleighBeta;// Offset:  944
//       float3 vAttenuatedSunColor;    // Offset:  960
//       float3 vSunDirectionVS;        // Offset:  976
//       row_major float4x4 mViewToGlobalShadowVSPT;// Offset:  992
//       float4 vWindDirectionAndStrength;// Offset: 1056
//       float4 vWindDirectionAndStrengthPrev;// Offset: 1072
//       float4 vWindInitialDirectionAndStrength;// Offset: 1088
//       float4 vFxFadeParameters;      // Offset: 1104
//       float2 vFxSize;                // Offset: 1120
//       int nEnableGBufferSpecPowerAdjustment;// Offset: 1128
//       int nNumCSMCascades;           // Offset: 1132
//       float fCSMFadeAdd;             // Offset: 1136
//       int nEnableClothBias;          // Offset: 1140
//       int nEnableCloth;              // Offset: 1144
//       int2 viNumTiles;               // Offset: 1152
//       int nLightTileDebugFlags;      // Offset: 1160
//       int nEnableBoxReflections;     // Offset: 1164
//       int nSelectedBoxReflectionId;  // Offset: 1168
//       int nEnableAtmosphericScatteringBackdrop;// Offset: 1172
//       int nEnableSampleFromUICameraBackbuffer;// Offset: 1176
//       int nFallbackRoomMask;         // Offset: 1180
//       float4 vClearColor;            // Offset: 1184
//       float3 vGlobalLightDirectionVS;// Offset: 1200
//       float3 vGlobalLightFrontColor; // Offset: 1216
//       float3 vGlobalLightBackColor;  // Offset: 1232
//       float4 vShadowAtlasSize;       // Offset: 1248
//       float2 vShadowPoissonScale;    // Offset: 1264
//       int nShadowSpotKernel;         // Offset: 1272
//       int nShadowCSMKernel;          // Offset: 1276
//       float4 vJitter;                // Offset: 1280
//       float4 vUnjitter;              // Offset: 1296
//       int nHashedAlphaPeriod;        // Offset: 1312
//       int nIsRenderingOffscreen;     // Offset: 1316
//       int nMirrorsDisabled;          // Offset: 1320
//
//   } cbSharedPerViewData;             // Offset:    0 Size:  1324
//
// }
//
// cbuffer _cbCalculateEpipolarInscatter
// {
//
//   struct S_cbCalculateEpipolarInscatter
//   {
//
//       int nNumCSMCascades;           // Offset:    0
//       float fDitherOffset;           // Offset:    4
//       float fCSMFadeAdd;             // Offset:    8
//       float4 vSignedFullResToUnsignedHalfRes;// Offset:   16
//       float4 vRow0;                  // Offset:   32
//       float4 vRow1;                  // Offset:   48
//       float4 vRow2;                  // Offset:   64
//       float4 vBleedReduction;        // Offset:   80
//       float4 avParams[9];            // Offset:   96
//       float3 vSunColor;              // Offset:  240
//       float3 vSunDirWS;              // Offset:  256
//       float3 vSunDirVS;              // Offset:  272
//       float2 vSunUVPos;              // Offset:  288
//       float2 vUVClampingUpper;       // Offset:  296
//       row_major float4x4 mViewToWorld;// Offset:  304
//       row_major float4x4 mViewToPrevViewProj;// Offset:  368
//       int2 viHalfRes;                // Offset:  432
//       float2 vRcpHalfRes;            // Offset:  440
//       int2 viHalfResRT;              // Offset:  448
//       float2 vRcpHalfResRT;          // Offset:  456
//
//   } cbCalculateEpipolarInscatter;    // Offset:    0 Size:   464
//
// }
//
// Resource bind info for uavWorkItems
// {
//
//   uint $Element;                     // Offset:    0 Size:     4
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// samplerPointClamp                 sampler      NA          NA    0        1
// srvDepthBuffer                    texture  float4          2d    0        1
// uavEpipolarInscatterTexture           UAV  float4          2d    0        1
// uavWorkItems                          UAV  struct      append    1        1
// _cbSharedPerViewData              cbuffer      NA          NA    2        1
// _cbCalculateEpipolarInscatter     cbuffer      NA          NA    5        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 cb2[54], immediateIndexed
dcl_constantbuffer cb5[19], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_uav_typed_texture2d (float,float,float,float) u0
dcl_uav_structured u1, 4
dcl_input vThreadID.xy
//dcl_temps 5
dcl_temps 8

dcl_thread_group 8, 8, 1

dcl_resource_texture2d (float,float,float,float) t125
ld_indexable(texture2d)(float,float,float,float) r5.xyzw, l(0, 0, 0, 0), t125.xyzw

// Correct cbCalculateEpipolarInscatter.vSunUVPos.xy -DarkStarSword
mov r6.xyzw, cb5[18].xyxx
mad r6.x, r5.x, l(0.5), r6.x

and r0.x, vThreadID.x, l(15)
ieq r0.x, r0.x, l(0)
ieq r0.y, vThreadID.x, l(255)
or r0.x, r0.y, r0.x
not r0.x, r0.x
ult r0.y, l(2), vThreadID.x
and r0.x, r0.y, r0.x
if_nz r0.x
  itof r0.xyzw, vThreadID.yxyx
  mul r1.x, r0.w, l(0.00787401572)
  mad r1.yz, r0.zzzz, l(0.000000, 0.00781250000, 0.00781250000, 0.000000), l(0.000000, -1.500000, -2.500000, 0.000000)
  add_sat r1.yz, -|r1.yyzy|, l(0.000000, 1.500000, 1.500000, 0.000000)
  add r2.xy, r1.yzyy, -r6.xyxx
  lt r2.zw, r2.xxxy, l(0.000000, 0.000000, 0.000000, 0.000000)
  and r2.zw, r2.zzzw, l(0, 0, 0x3f800000, 0x3f800000)
  add r2.zw, r2.zzzw, -r6.xxxy
  div r2.zw, r2.zzzw, r2.xxxy
  max r1.w, r2.w, r2.z
  max r1.w, r1.w, l(0.000000)
  mad r2.xy, r1.wwww, r2.xyxx, r6.xyxx
  min r1.x, r1.x, l(1.000000)
  add r1.yz, r1.yyzy, -r2.xxyx
  mad r1.xy, r1.xxxx, r1.yzyy, r2.xyxx
  add r0.xyzw, r0.xyzw, l(0.000000, -1.000000, 0.000000, 1.000000)
  mul r2.xw, r0.yyyw, l(0.00787401572, 0.000000, 0.000000, 0.00787401572)
  mad r0.xyzw, r0.xxzz, l(0.00781250000, 0.00781250000, 0.00781250000, 0.00781250000), l(-1.500000, -2.500000, -1.500000, -2.500000)
  add_sat r0.xyzw, -|r0.xyzw|, l(1.500000, 1.500000, 1.500000, 1.500000)
  add r3.xyzw, r0.xyzw, -r6.xyxy
  lt r4.xyzw, r3.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
  and r4.xyzw, r4.xyzw, l(0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000)
  add r4.xyzw, r4.xyzw, -r6.xyxy
  div r4.xyzw, r4.xyzw, r3.xyzw
  max r4.xyzw, r4.yyww, r4.xxzz
  max r4.xyzw, r4.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
  mad r3.xyzw, r4.xyzw, r3.xyzw, r6.xyxy
  mov_sat r2.x, r2.x
  add r0.xyzw, r0.xyzw, -r3.xyzw
  mad r2.xy, r2.xxxx, r0.xyxx, r3.xyxx
  min r0.x, r2.w, l(1.000000)
  mad r0.xy, r0.xxxx, r0.zwzz, r3.zwzz
  add r3.xyz, -cb2[26].xyzx, cb2[27].xyzx
  mov r2.z, l(1.000000)
  mad r4.xyz, r2.xyzx, r3.xyzx, cb2[26].xyzx
  mov r0.z, l(1.000000)
  mad r3.xyz, r0.xyzx, r3.xyzx, cb2[26].xyzx
  sample_l_indexable(texture2d)(float,float,float,float) r0.z, r1.xyxx, t0.yzxw, s0, l(0.000000)
  mad r0.z, cb2[24].z, r0.z, -cb2[24].y
  div r0.z, l(1.000000, 1.000000, 1.000000, 1.000000), r0.z
  sample_l_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.yzwx, s0, l(0.000000)
  sample_l_indexable(texture2d)(float,float,float,float) r0.x, r0.xyxx, t0.xyzw, s0, l(0.000000)
  mad r0.y, cb2[24].z, r0.w, -cb2[24].y
  div r0.y, l(1.000000, 1.000000, 1.000000, 1.000000), r0.y
  mad r1.x, cb2[24].z, r0.x, -cb2[24].y
  div r1.x, l(1.000000, 1.000000, 1.000000, 1.000000), r1.x
  mul r1.y, r4.y, cb2[13].z
  mad r1.y, r4.x, cb2[12].z, r1.y
  mad r1.y, r4.z, cb2[14].z, r1.y
  mul r1.z, r3.y, cb2[13].z
  mad r1.z, r3.x, cb2[12].z, r1.z
  mad r1.z, r3.z, cb2[14].z, r1.z
  add r1.w, -cb2[15].z, cb2[53].y
  div r1.yz, r1.wwww, r1.yyzy
  ge r1.yz, l(0.000000, 0.000000, 0.000000, 0.000000), r1.yyzy
  add r1.w, -r0.y, r0.z
  max r0.y, r0.y, r0.z
  mul r0.y, r0.y, l(0.020000)
  lt r0.y, |r1.w|, r0.y
  add r1.w, r0.z, -r1.x
  max r0.z, r0.z, r1.x
  mul r0.z, r0.z, l(0.020000)
  lt r0.z, |r1.w|, r0.z
  and r0.y, r0.z, r0.y
  lt r0.xz, l(0.000000, 0.000000, 0.000000, 0.000000), r0.xxwx
  ieq r0.w, r0.x, r0.z
  and r0.y, r0.w, r0.y
  or r0.x, r0.x, r0.z
  ieq r0.z, r1.z, r1.y
  or r0.x, r0.z, r0.x
  and r0.x, r0.x, r0.y
else
  mov r0.x, l(0)
endif
if_z r0.x
  ishl r0.x, vThreadID.y, l(16)
  iadd r0.x, r0.x, vThreadID.x
  imm_atomic_alloc r1.x, u1
  store_structured u1.x, r1.x, l(0), r0.x
endif
store_uav_typed u0.xyzw, vThreadID.xyyy, l(0,0,0,0)
ret
// Approximately 90 instruction slots used
