//
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
//
//   using 3Dmigoto v1.3.16 on Sun Jan 16 23:46:03 2022
//
//
// Note: shader requires additional functionality:
//       64 UAV slots
//
//
// Buffer Definitions:
//
// cbuffer ConstBuf__tileData
// {
//
//   struct SSSSTileData
//   {
//
//       uint tilesHorz;                // Index:    0
//       uint tilePermutation;          // Index:    0.y
//       uint firstGroupOffset;         // Index:    0.z
//
//   } resourceTables__tileData;        // Index:    0.xyz            Components:     3
//
// }
//
// cbuffer ConstBuf__passData
// {
//
//   struct SSSSPassBuffer
//   {
//
//       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 SSSSConstants
//       {
//
//           float4x4 g_View;           // Index:   13
//           float4 g_avfProfilesAsGaussians[8];// Index:   17
//           float4 g_screenRes;        // Index:   25
//           float g_maxPixelStep;      // Index:   26
//           float g_DepthWeighting;    // Index:   26.y
//           float g_FarPlane;          // Index:   26.z
//           float g_overrideSkyDepth;  // Index:   26.w
//           float g_luminanceVariance; // Index:   27
//           float g_exposure;          // Index:   27.y
//           float g_exposureDepthWeighting;// Index:   27.z
//           float g_exposureDepthWeightingExponent;// Index:   27.w
//           float g_exposureCharacterWeighting;// Index:   28
//           uint g_visualizeExposureWeight;// Index:   28.y
//           uint g_whiteDiffuse;       // Index:   28.z
//           float2 g_opaqueRefractionViewportScale;// Index:   29
//           uint g_MaxSSSKernelWidth;  // Index:   29.z
//           float2 g_opaqueRefractionMaxUV;// Index:   30
//           int2 g_opaqueRefractionSize;// Index:   30.z
//
//       } constants;                   // Index:   13
//
//       struct SSSSDitherConstants
//       {
//
//           float4 g_PixelDithering[16];// Index:   31
//
//       } dither;                      // Index:   31
//
//   } resourceTables__passData;        // Index:    0-46             Components:   188
                                        // Textures:  t2-t3
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// resourceTables__passData__smpLinearClamp    sampler      NA          NA    0        1
// resourceTables__passData.texSSSSDiffuseIrradiance    texture  float4          2d    2        1
// resourceTables__passData.emissive    texture  float4          2d    3        1
// resourceTables__tileData.outTexture        UAV  float4          2d    8        1
// ConstBuf__tileData                cbuffer      NA          NA    0        1
// ConstBuf__passData                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[1], immediateIndexed
dcl_constantbuffer cb1[47], dynamicIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_uav_typed_texture2d (float,float,float,float) u8
dcl_input vThreadIDInGroupFlattened
dcl_input vThreadGroupID.x
dcl_temps 50
dcl_thread_group 64, 1, 1
dcl_resource_texture2d (float,float,float,float) t125
ld_indexable(texture2d)(float,float,float,float) r40.xyzw, l(0, 0, 0, 0), t125.xyzw
iadd r0.x, vThreadGroupID.x, cb0[0].z
udiv r0.x, r1.x, r0.x, cb0[0].x
ushr r0.yz, vThreadIDInGroupFlattened.xxxx, l(0, 2, 3, 0)
and r0.yz, r0.yyzy, l(0, 4, 4, 0)
xor r0.z, r0.y, r0.z
ishl r0.w, vThreadIDInGroupFlattened.x, l(1)
ushr r1.zw, l(0, 0, 0xebfa5014, 0xfa4141af), r0.wwww
bfi r2.xy, l(2, 2, 0, 0), l(0, 0, 0, 0), r1.zwzz, r0.zyzz
mov r1.y, r0.x
bfi r0.xy, l(29, 29, 0, 0), l(3, 3, 0, 0), r1.xyxx, r2.xyxx
mov r0.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r1.xyzw, r0.xyww, t2.xyzw
ld_indexable(texture2d)(float,float,float,float) r0.z, r0.xyzw, t3.xywz
min r0.w, |r1.w|, cb1[26].z
max r0.w, r0.w, l(0.000000)
add r2.x, l(-1.000000), cb1[26].z
lt r2.x, r0.w, r2.x
mul r2.y, r0.z, r0.z
mul r0.z, r0.z, r2.y
lt r2.y, l(0.000000), r0.z
and r2.x, r2.y, r2.x
if_nz r2.x
  utof r2.xy, r0.xyxx
  
  
  
  add r2.xy, r2.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000)
  mul r2.xy, r2.xyxx, cb1[25].zwzz
  bfi r2.z, l(2), l(2), r0.y, l(0)
  bfi r2.z, l(2), l(0), r0.x, r2.z
  max r0.w, r0.w, l(0.000010)
  rcp r0.w, r0.w
  min r2.w, r0.w, l(2.000000)
  mul r2.zw, r2.wwww, cb1[r2.z + 31].xxxy
  mul r2.zw, r0.zzzz, r2.zzzw
  lt r3.xy, l(0.000000, 0.000000, 0.000000, 0.000000), r2.zwzz
  lt r3.zw, r2.zzzw, l(0.000000, 0.000000, 0.000000, 0.000000)
  iadd r3.xy, -r3.xyxx, r3.zwzz
  itof r3.xy, r3.xyxx
  
  
  
  min r2.zw, |r2.zzzw|, cb1[26].xxxx
  mul r2.zw, r2.zzzw, r3.xxxy
  mad r3.xy, cb1[18].wwww, r2.zwzz, r2.xyxx
  sample_l_indexable(texture2d)(float,float,float,float) r3.xyzw, r3.xyxx, t2.xyzw, s0, l(0.000000)
  mad r0.z, r0.w, r3.w, l(-1.000000)
  mul_sat r0.z, |r0.z|, cb1[26].y
  add r4.xyz, r1.xyzx, -r3.xyzx
  mad r3.xyz, r0.zzzz, r4.xyzx, r3.xyzx
  mul r3.xyz, r3.xyzx, cb1[18].xyzx
  mad r3.xyz, r1.xyzx, cb1[17].xyzx, r3.xyzx
  mad r4.xy, cb1[19].wwww, r2.zwzz, r2.xyxx
  sample_l_indexable(texture2d)(float,float,float,float) r4.xyzw, r4.xyxx, t2.xyzw, s0, l(0.000000)
  mad r0.z, r0.w, r4.w, l(-1.000000)
  mul_sat r0.z, |r0.z|, cb1[26].y
  add r5.xyz, r1.xyzx, -r4.xyzx
  mad r4.xyz, r0.zzzz, r5.xyzx, r4.xyzx
  mad r3.xyz, cb1[19].xyzx, r4.xyzx, r3.xyzx
  mad r4.xy, cb1[20].wwww, r2.zwzz, r2.xyxx
  sample_l_indexable(texture2d)(float,float,float,float) r4.xyzw, r4.xyxx, t2.xyzw, s0, l(0.000000)
  mad r0.z, r0.w, r4.w, l(-1.000000)
  mul_sat r0.z, |r0.z|, cb1[26].y
  add r5.xyz, r1.xyzx, -r4.xyzx
  mad r4.xyz, r0.zzzz, r5.xyzx, r4.xyzx
  mad r3.xyz, cb1[20].xyzx, r4.xyzx, r3.xyzx
  mad r4.xy, cb1[21].wwww, r2.zwzz, r2.xyxx
  sample_l_indexable(texture2d)(float,float,float,float) r4.xyzw, r4.xyxx, t2.xyzw, s0, l(0.000000)
  mad r0.z, r0.w, r4.w, l(-1.000000)
  mul_sat r0.z, |r0.z|, cb1[26].y
  add r5.xyz, r1.xyzx, -r4.xyzx
  mad r4.xyz, r0.zzzz, r5.xyzx, r4.xyzx
  mad r3.xyz, cb1[21].xyzx, r4.xyzx, r3.xyzx
  mad r4.xy, cb1[22].wwww, r2.zwzz, r2.xyxx
  sample_l_indexable(texture2d)(float,float,float,float) r4.xyzw, r4.xyxx, t2.xyzw, s0, l(0.000000)
  mad r0.z, r0.w, r4.w, l(-1.000000)
  mul_sat r0.z, |r0.z|, cb1[26].y
  add r5.xyz, r1.xyzx, -r4.xyzx
  mad r4.xyz, r0.zzzz, r5.xyzx, r4.xyzx
  mad r3.xyz, cb1[22].xyzx, r4.xyzx, r3.xyzx
  mad r4.xy, cb1[23].wwww, r2.zwzz, r2.xyxx
  sample_l_indexable(texture2d)(float,float,float,float) r4.xyzw, r4.xyxx, t2.xyzw, s0, l(0.000000)
  mad r0.z, r0.w, r4.w, l(-1.000000)
  mul_sat r0.z, |r0.z|, cb1[26].y
  add r5.xyz, r1.xyzx, -r4.xyzx
  mad r4.xyz, r0.zzzz, r5.xyzx, r4.xyzx
  mad r3.xyz, cb1[23].xyzx, r4.xyzx, r3.xyzx
  mad r2.xy, cb1[24].wwww, r2.zwzz, r2.xyxx
  sample_l_indexable(texture2d)(float,float,float,float) r2.xyzw, r2.xyxx, t2.xyzw, s0, l(0.000000)
  mad r0.z, r0.w, r2.w, l(-1.000000)
  mul_sat r0.z, |r0.z|, cb1[26].y
  add r4.xyz, r1.xyzx, -r2.xyzx
  mad r2.xyz, r0.zzzz, r4.xyzx, r2.xyzx
  mad r1.xyz, cb1[24].xyzx, r2.xyzx, r3.xyzx
endif
store_uav_typed u8.xyzw, r0.xyyy, r1.xyzw
ret
// Approximately 91 instruction slots used

///////////////////////////////// HLSL Code /////////////////////////////////
// // ---- Created with 3Dmigoto v1.3.16 on Sun Jan 16 23:46:03 2022
//
// cbuffer ConstBuf__tileData : register(b0)
// {
//
//   struct
//   {
//     uint tilesHorz;
//     uint tilePermutation;
//     uint firstGroupOffset;
//   } resourceTables__tileData : packoffset(c0);
//
// }
//
// cbuffer ConstBuf__passData : register(b1)
// {
//
//   struct
//   {
//
//     struct
//     {
//       float3 cFogColor;
//       float cHeightFalloff;
//       float3 cEyePosition;
//       float cHeightDensity;
//       float cStartDistance;
//       float cGlobalDensity;
//       float cDepthReprojectScale;
//       float cDepthReprojectBias;
//       float4x4 cInvProjNoZReproj;
//       float3 cDirectionalFogDirection;
//       float cDirectionalityPower;
//       float3 cDirectionalFogColor;
//       float cDensityMapSparseBias;
//       float3 cDensityMapInvExtents;
//       float cDensityMapSparseSegmentScale;
//       float3 cDensityMapBias;
//       float cDensityMapSparseCutoff;
//       float cVolFogExponentMultiply;
//       float cVolFogDistanceMultiply;
//       float cVolFogExponentNormalize;
//       float cVolFogDistanceNormalize;
//       float cVolFogResolutionScale;
//       int cVolFogWidth;
//       int cVolFogHeight;
//       int cVolFogDepth;
//     } atmosphericConstants;
//
//
//     struct
//     {
//       float4x4 g_View;
//       float4 g_avfProfilesAsGaussians[8];
//       float4 g_screenRes;
//       float g_maxPixelStep;
//       float g_DepthWeighting;
//       float g_FarPlane;
//       float g_overrideSkyDepth;
//       float g_luminanceVariance;
//       float g_exposure;
//       float g_exposureDepthWeighting;
//       float g_exposureDepthWeightingExponent;
//       float g_exposureCharacterWeighting;
//       uint g_visualizeExposureWeight;
//       uint g_whiteDiffuse;
//       float2 g_opaqueRefractionViewportScale;
//       uint g_MaxSSSKernelWidth;
//       float2 g_opaqueRefractionMaxUV;
//       int2 g_opaqueRefractionSize;
//     } constants;
//
//
//     struct
//     {
//       float4 g_PixelDithering[16];
//     } dither;
//
//   } resourceTables__passData : packoffset(c0);
//
//
// SamplerState resourceTables__passData__smpLinearClamp_s : register(s0);
// Texture2D<float4> resourceTables__passData.texSSSSDiffuseIrradiance : register(t2);
// Texture2D<float4> resourceTables__passData.emissive : register(t3);
// RWTexture2D<float4> resourceTables__tileData.outTexture : register(u8);
//
//
// // 3Dmigoto declarations
// #define cmp -
// Texture1D<float4> IniParams : register(t120);
// Texture2D<float4> StereoParams : register(t125);
//
//
// void main)
// {
//   Textures: = t2-t3 + ;
// // Needs manual fix for instruction:
// // unknown dcl_: dcl_uav_typed_texture2d (float,float,float,float) u8
//   float4 r0,r1,r2,r3,r4,r5;
//   uint4 bitmask, uiDest;
//   float4 fDest;
//
// // Needs manual fix for instruction:
// // unknown dcl_: dcl_thread_group 64, 1, 1
//   uiDest.x = (uint16)resourceTables__tileData.firstGroupOffset / ;
//   vThreadGroupID.x = (uint16)resourceTables__tileData.firstGroupOffset % ;
//   r0.x = uiDest.x;
//   r0.x = (uint)r1.x >> (uint)r0.x;
//   r0.yz = (int2)vThreadIDInGroupFlattened.xx & int2(2,3);
//   r0.yz = (int2)r0.yz ^ int2(4,4);
//   r0.z = (uint)r0.y << (int)r0.z;
//   r0.w = (uint)vThreadIDInGroupFlattened.x >> 1;
//   bitmask.z = ((~(-1 << 0)) << r0.w) & 0xffffffff;  r1.z = (((uint) << r0.w) & bitmask.z) | ((uint) & ~bitmask.z);
//   bitmask.w = ((~(-1 << 0)) << r0.w) & 0xffffffff;  r1.w = (((uint) << r0.w) & bitmask.w) | ((uint) & ~bitmask.w);
//   r2.xy = float2(2,2);
//   bitmask.y = ((~(-1 << r0.x)) << ) & 0xffffffff;  r1.y = (((uint) << ) & bitmask.y) | ((uint) & ~bitmask.y);
//   r0.xy = float2(29,29);
//   r0.zw = .Load(float4(0,0,0,0))(null);
//   r1.xyzw = resourceTables__passData.texSSSSDiffuseIrradiance.Load(r0.xyw).xyzw;
//   r0.z = min(t3.w, r0.z);
//   r0.w = max(0, abs(r1.w));
// }
//////////////////////////////// HLSL Errors ////////////////////////////////
// error X3506: unrecognized compiler target '                                        // Textures:  t2-t3'
/////////////////////////////////////////////////////////////////////////////
