// This is CS for Shadows weirdness
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.57 on Sat May 06 19:54:45 2017
//
//
// Buffer Definitions: 
//
// cbuffer SceneBuffer
// {
//
//   float4x4 g_View;                   // Offset:    0 Size:    64 [unused]
//   float4x4 g_Proj;                   // Offset:   64 Size:    64
//   float4x4 g_ViewProjection;         // Offset:  128 Size:    64 [unused]
//   float4x4 g_ViewInverseMatrix;      // Offset:  192 Size:    64 [unused]
//
// }
//
// cbuffer CamParam_HPixel_Buffer
// {
//
//   float4 g_CameraParam;              // Offset:    0 Size:    16
//   float4 g_CameraVec;                // Offset:   16 Size:    16 [unused]
//
// }
//
// cbuffer SceneBuffer
// {
//
//   uint4 g_TexSizeParam;              // Offset:    0 Size:    16
//
// }
//
// Resource bind info for g_CubeInput
// {
//
//   struct sCubeParamInput
//   {
//       
//       float4 worldPos;               // Offset:    0
//       float4x4 worldToVolume;        // Offset:   16
//       float4 halfExtents;            // Offset:   80
//
//   } $Element;                        // Offset:    0 Size:    96
//
// }
//
// Resource bind info for g_CubeOutput
// {
//
//   struct sCubeParamOutput
//   {
//       
//       float4 useNo;                  // Offset:    0
//       float4 blendRate;              // Offset:   16
//
//   } $Element;                        // Offset:    0 Size:    32
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// g_ZTexture                        texture  float4          2d    0        1
// g_CubeInput                       texture  struct         r/o    1        1
// g_CubeOutput                          UAV  struct         r/w    0        1
// SceneBuffer                       cbuffer      NA          NA    0        1
// SceneBuffer                       cbuffer      NA          NA    2        1
// CamParam_HPixel_Buffer            cbuffer      NA          NA   13        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[6], immediateIndexed
dcl_constantbuffer cb13[1], immediateIndexed
dcl_constantbuffer cb2[1], immediateIndexed
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_structured t1, 96 
dcl_uav_structured u0, 32
dcl_input vThreadID.xy

dcl_resource_texture2d (float,float,float,float) t125
dcl_temps 6

dcl_indexableTemp x0[2], 4
dcl_indexableTemp x1[2], 4
dcl_thread_group 32, 18, 1
imad r0.x, vThreadID.y, cb2[0].x, vThreadID.x
uge r0.y, r0.x, cb2[0].z
if_nz r0.y
  ret 
endif 
mov r1.xy, vThreadID.xyxx
mov r1.zw, l(0,0,0,0)
ld_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r0.y, r1.xyzw, t0.yxzw
mad r0.y, r0.y, cb13[0].y, cb13[0].x
mov x0[0].x, l(10000.000000)
mov x0[1].x, l(10000.000000)
mov x1[0].x, l(-1)
mov x1[1].x, l(-1)
lt r0.z, r0.y, l(2000.000000)
if_nz r0.z
  bufinfo_indexable(structured_buffer, stride=96)(mixed,mixed,mixed,mixed) r0.z, t1.yzxw
  utof r1.xy, vThreadID.xyxx
  mad r1.xy, r1.xyxx, l(0.001250, -0.00222221995, 0.000000, 0.000000), l(-1.000000, 1.000000, 0.000000, 0.000000)
  div r2.x, l(1.000000, 1.000000, 1.000000, 1.000000), cb0[4].x
  div r2.y, l(1.000000, 1.000000, 1.000000, 1.000000), cb0[5].y
  
  //mul r1.xy, r0.yyyy, r1.xyxx
  mul r1.xy, r2.xyxx, r1.xyxx
  mov r1.z, -r0.y
  mov r1.w, l(1.000000)
  
ld_indexable(texture2d)(float,float,float,float) r5.xyzw, l(0, 0, 0, 0), t125.xyzw
add r5.y, r1.z, -r5.y
mul r5.x, r5.x, r5.y
rcp r5.w, cb0[4].x
mul r5.x, r5.x, r5.w
//add r1.x, r1.x, -r5.x
  
  
  mov r0.y, l(0)
  loop 
    uge r0.w, r0.y, r0.z
    breakc_nz r0.w
    ld_structured_indexable(structured_buffer, stride=96)(mixed,mixed,mixed,mixed) r0.w, r0.y, l(12), t1.xxxx
    eq r0.w, r0.w, l(0.000000)
    if_nz r0.w
      iadd r0.y, r0.y, l(1)
      continue 
    endif 
    ld_structured_indexable(structured_buffer, stride=96)(mixed,mixed,mixed,mixed) r2.xyzw, r0.y, l(16), t1.xyzw
    ld_structured_indexable(structured_buffer, stride=96)(mixed,mixed,mixed,mixed) r3.xyzw, r0.y, l(32), t1.xyzw
    ld_structured_indexable(structured_buffer, stride=96)(mixed,mixed,mixed,mixed) r4.xyzw, r0.y, l(48), t1.xyzw
    dp4 r2.x, r1.xyzw, r2.xyzw
    dp4 r2.y, r1.xyzw, r3.xyzw
    dp4 r2.z, r1.xyzw, r4.xyzw
    ld_structured_indexable(structured_buffer, stride=96)(mixed,mixed,mixed,mixed) r3.xyz, r0.y, l(80), t1.xyzx
    max r4.xyz, r2.xyzx, -r3.xyzx
    min r3.xyz, r3.xyzx, r4.xyzx
    add r2.xyz, -r2.xyzx, r3.xyzx
    dp3 r0.w, r2.xyzx, r2.xyzx
    add r0.w, r0.w, l(1.000000)
    mov r2.x, x0[1].x
    lt r2.x, r0.w, r2.x
    if_nz r2.x
      mov r2.x, x0[0].x
      lt r2.y, r0.w, r2.x
      if_nz r2.y
        mov x0[1].x, r2.x
        mov r2.y, x1[0].x
        mov x1[1].x, r2.y
        mov x0[0].x, r0.w
        mov x1[0].x, r0.y
      endif 
      ge r2.x, r0.w, r2.x
      mov r2.y, x0[1].x
      lt r2.z, r0.w, r2.y
      if_nz r2.z
        movc r0.w, r2.x, r0.w, r2.y
        mov x0[1].x, r0.w
        mov r0.w, x1[1].x
        movc r0.w, r2.x, r0.y, r0.w
        mov x1[1].x, r0.w
      endif 
    endif 
    iadd r0.y, r0.y, l(1)
  endloop 
endif 
mov r0.y, x1[0].x
ige r0.z, r0.y, l(0)
if_nz r0.z
  mov r0.w, x0[0].x
else 
  mov r0.w, l(0)
endif 
mov r1.x, x1[1].x
ige r1.y, r1.x, l(0)
if_nz r1.y
  mov r1.z, x0[1].x
  add r0.w, r0.w, r1.z
endif 
store_structured u0.xyzw, r0.x, l(0), l(0,0,0,0)
store_structured u0.xyzw, r0.x, l(16), l(1.000000,0,0,0)
if_nz r0.z
  itof r0.y, r0.y
  store_structured u0.x, r0.x, l(0), r0.y
endif 
if_nz r1.y
  max r0.y, r0.w, l(0.010000)
  mov r0.z, x0[0].x
  div r0.z, r0.z, r0.y
  add r0.z, -r0.z, l(1.000000)
  store_structured u0.x, r0.x, l(16), r0.z
  itof r0.z, r1.x
  store_structured u0.x, r0.x, l(4), r0.z
  mov r0.z, x0[1].x
  div r0.y, r0.z, r0.y
  add r0.y, -r0.y, l(1.000000)
  store_structured u0.x, r0.x, l(20), r0.y
endif 
ret 
// Approximately 105 instruction slots used
