//46b7d3e01a99ff76-ps.txt
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.17672
//
//   using 3Dmigoto v1.2.27 on Sun Feb 14 16:32:00 2016
//
//
// Buffer Definitions: 
//
// cbuffer cbTiledLighting
// {
//
//   uint g_uNumNonDirectionalLights;   // Offset:    0 Size:     4
//   uint g_uNumDirectionalLights;      // Offset:    4 Size:     4
//   uint g_uNumTilesX;                 // Offset:    8 Size:     4 [unused]
//   uint g_uNumTilesY;                 // Offset:   12 Size:     4 [unused]
//   row_major float4x4 g_mProjection;  // Offset:   16 Size:    64 [unused]
//   row_major float4x4 g_mInvProjection;// Offset:   80 Size:    64 [unused]
//
// }
//
// cbuffer WorldBuffer
// {
//
//   struct WorldStruct
//   {
//       
//       row_major float4x4 ViewProject;// Offset:    0
//       
//       struct WorldStruct_PerInstanceData
//       {
//           
//           row_major float4x4 World;  // Offset:   64
//           row_major float4x4 WorldViewProject;// Offset:  128
//
//       } PerInstance[256];            // Offset:   64
//
//   } WorldParameters;                 // Offset:    0 Size: 32832
//
// }
//
// cbuffer DrawableBuffer
// {
//
//   float4 FogColor;                   // Offset:    0 Size:    16 [unused]
//   float4 DebugColor;                 // Offset:   16 Size:    16 [unused]
//   float AlphaThreshold;              // Offset:   32 Size:     4
//   float4 __InstancedMaterialOpacity[256];// Offset:   48 Size:  4096
//
// }
//
// cbuffer SceneBuffer
// {
//
//   row_major float4x4 View;           // Offset:    0 Size:    64
//   row_major float4x4 ScreenMatrix;   // Offset:   64 Size:    64 [unused]
//   float2 DepthExportScale;           // Offset:  128 Size:     8 [unused]
//   float2 __padding0;                 // Offset:  136 Size:     8 [unused]
//   float4 FogParams;                  // Offset:  144 Size:    16 [unused]
//   float3 __CameraPosition;           // Offset:  160 Size:    12 [unused]
//   float __padding12;                 // Offset:  172 Size:     4 [unused]
//   float3 CameraDirection;            // Offset:  176 Size:    12 [unused]
//   float __padding9;                  // Offset:  188 Size:     4 [unused]
//   float3 DepthFactors;               // Offset:  192 Size:    12 [unused]
//   float __padding10;                 // Offset:  204 Size:     4 [unused]
//   float3 ShadowDepthBiasAndLightType;// Offset:  208 Size:    12 [unused]
//   float __padding11;                 // Offset:  220 Size:     4 [unused]
//   float4 SubframeViewport;           // Offset:  224 Size:    16 [unused]
//   row_major float3x4 DepthToWorld;   // Offset:  240 Size:    48 [unused]
//   float4 DepthToView;                // Offset:  288 Size:    16
//   float4 OneOverDepthToView;         // Offset:  304 Size:    16 [unused]
//   float4 DepthToW;                   // Offset:  320 Size:    16 [unused]
//   float4 ClipPlane;                  // Offset:  336 Size:    16 [unused]
//   float2 ViewportDepthScaleOffset;   // Offset:  352 Size:     8 [unused]
//   float2 __padding1;                 // Offset:  360 Size:     8 [unused]
//   float2 ColorDOFDepthScaleOffset;   // Offset:  368 Size:     8 [unused]
//   float2 __padding2;                 // Offset:  376 Size:     8 [unused]
//   float4 TimeVector;                 // Offset:  384 Size:    16 [unused]
//   float4 FogParams2;                 // Offset:  400 Size:    16 [unused]
//   float4 FogParams3;                 // Offset:  416 Size:    16 [unused]
//   float3 GlobalAmbient;              // Offset:  432 Size:    12 [unused]
//   float __padding8;                  // Offset:  444 Size:     4 [unused]
//   float4 GlobalParams[16];           // Offset:  448 Size:   256 [unused]
//   float4 ViewToFogH;                 // Offset:  704 Size:    16 [unused]
//   float4 ScreenExtents;              // Offset:  720 Size:    16
//   float2 ScreenResolution;           // Offset:  736 Size:     8 [unused]
//   float2 __padding3;                 // Offset:  744 Size:     8 [unused]
//   float4 PSSMToMap1Lin;              // Offset:  752 Size:    16 [unused]
//   float4 PSSMToMap1Const;            // Offset:  768 Size:    16 [unused]
//   float4 PSSMToMap2Lin;              // Offset:  784 Size:    16 [unused]
//   float4 PSSMToMap2Const;            // Offset:  800 Size:    16 [unused]
//   float4 PSSMToMap3Lin;              // Offset:  816 Size:    16 [unused]
//   float4 PSSMToMap3Const;            // Offset:  832 Size:    16 [unused]
//   float4 PSSMDistances;              // Offset:  848 Size:    16 [unused]
//   row_major float4x4 WorldToPSSM0;   // Offset:  864 Size:    64 [unused]
//   row_major float4x4 PrevViewProject;// Offset:  928 Size:    64 [unused]
//   row_major float4x4 PrevWorld;      // Offset:  992 Size:    64 [unused]
//   row_major float4x4 ViewT;          // Offset: 1056 Size:    64 [unused]
//   float4 PSSMExtents;                // Offset: 1120 Size:    16 [unused]
//   float4 ShadowAtlasResolution;      // Offset: 1136 Size:    16 [unused]
//   float4 UnitRimData[3];             // Offset: 1152 Size:    48 [unused]
//   float3 __CameraPositionForCorrection;// Offset: 1200 Size:    12 [unused]
//   float __padding7;                  // Offset: 1212 Size:     4 [unused]
//   row_major float4x4 CameraViewProject;// Offset: 1216 Size:    64 [unused]
//   float4 BackBufferResolution;       // Offset: 1280 Size:    16 [unused]
//   row_major float4x4 InverseProjection;// Offset: 1296 Size:    64 [unused]
//   float4 StereoOffset;               // Offset: 1360 Size:    16 [unused]
//   row_major float4x4 Projection;     // Offset: 1376 Size:    64 [unused]
//   row_major float4x4 ViewInv;        // Offset: 1440 Size:    64 [unused]
//   float4 ColorSSAO;                  // Offset: 1504 Size:    16 [unused]
//   float4 GlobalFogColor;             // Offset: 1520 Size:    16 [unused]
//   float4 VolumetricLightGlobalParams;// Offset: 1536 Size:    16 [unused]
//   float4 SnowParams01;               // Offset: 1552 Size:    16 [unused]
//   float4 SnowParams02;               // Offset: 1568 Size:    16 [unused]
//   float4 SnowParams03;               // Offset: 1584 Size:    16 [unused]
//   int SSREnabled;                    // Offset: 1600 Size:     4 [unused]
//   int __padding4;                    // Offset: 1604 Size:     4 [unused]
//   int __padding5;                    // Offset: 1608 Size:     4 [unused]
//   int __padding6;                    // Offset: 1612 Size:     4 [unused]
//
// }
//
// cbuffer MaterialBuffer
// {
//
//   float4 MaterialParams[512];        // Offset:    0 Size:  8192
//
// }
//
// Resource bind info for LightDataBuffer
// {
//
//   struct STiledLightData
//   {
//       
//       float3 vPosition;              // Offset:    0
//       float fSegmentLength;          // Offset:   12
//       float3 vDirection;             // Offset:   16
//       float fMinShadowSpec;          // Offset:   28
//       float4 vAttParams;             // Offset:   32
//       float3 vSpotParams;            // Offset:   48
//       float fIntensity;              // Offset:   60
//       float4 vDiffuseColor;          // Offset:   64
//       float4 vShadowFadeParams;      // Offset:   80
//       uint uRelCen;                  // Offset:   96
//       uint uFxSpecificIdx;           // Offset:  100
//       uint uFxType;                  // Offset:  104
//       float fRadiusSquared;          // Offset:  108
//       float3 vLambertWeights;        // Offset:  112
//       float fSpecularStrength;       // Offset:  124
//       float3 vBoxAxisX;              // Offset:  128
//       uint uLightType;               // Offset:  140
//       float3 vBoxAxisZ;              // Offset:  144
//       uint bShadowEnabled;           // Offset:  156
//       float3 vBoxInnerDistance;      // Offset:  160
//       uint bModulationMapEnabled;    // Offset:  172
//       float3 vBoxInvRange;           // Offset:  176
//       uint uModulationMapIndex;      // Offset:  188
//       row_major float4x4 mViewToShadowMap;// Offset:  192
//       row_major float4x4 mViewToModulationMap;// Offset:  256
//       float3 vRecipOuterColiProxy;   // Offset:  320
//       uint uProbeFlags;              // Offset:  332
//       float3 vColixProxyCen;         // Offset:  336
//       uint bForwardOnly;             // Offset:  348
//       uint uShadowType;              // Offset:  352
//       uint uNumSoftShadowSamples;    // Offset:  356
//       float fSoftShadowRadius;       // Offset:  360
//       float fSoftShadowDepthBias;    // Offset:  364
//       float fSoftShadowExponent;     // Offset:  368
//       float fProbePriority;          // Offset:  372
//       float fUnusedParam[2];         // Offset:  376
//
//   } $Element;                        // Offset:    0 Size:   384
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// SamplerGenericPointClamp          sampler      NA          NA   10        1
// SamplerGenericTrilinearWrap       sampler      NA          NA   11        1
// SamplerGenericBilinearClamp       sampler      NA          NA   13        1
// p_default_Material_n159_n224_661830C016465534_cp0_Param_texture    texture  float4          2d    0        1
// p_default_Setup_n34_NormalBufferTexture_texture    texture  float4          2d    1        1
// p_default_Material_n146_n246_Texture_texture    texture  float4          2d    3        1
// p_default_Material_n157_BD8AA44026454365_cp7_Param_texture    texture  float4          2d    4        1
// p_default_Material_3FC8A6602471436_cp2_DeferredBufferTexture_texture    texture  float4          2d    5        1
// p_default_Setup_n8_n77_Texture_texture    texture  float4          2d    6        1
// p_default_Setup_n8_n105_Texture_texture    texture  float4          2d    7        1
// LightAccumulation_texture         texture  float4          2d   51        1
// SpecularAccumulation_texture      texture  float4          2d   52        1
// AmbientAccumulation_texture       texture  float4          2d   53        1
// LightDataBuffer                   texture  struct         r/o   54        1
// WorldBuffer                       cbuffer      NA          NA    0        1
// DrawableBuffer                    cbuffer      NA          NA    1        1
// SceneBuffer                       cbuffer      NA          NA    2        1
// MaterialBuffer                    cbuffer      NA          NA    3        1
// cbTiledLighting                   cbuffer      NA          NA    7        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xy w
// TEXCOORD                 0   xyzw        1     NONE   float   xy  
// TEXCOORD                 2   xyz         2     NONE   float   xyz 
// PSIZE                    0   x           3     NONE    uint   x   
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
// SV_TARGET                1   x           1   TARGET   float   x   
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb7[1], immediateIndexed
dcl_constantbuffer cb0[2045], dynamicIndexed
dcl_constantbuffer cb1[259], dynamicIndexed
// dcl_constantbuffer cb2[46], immediateIndexed
dcl_constantbuffer cb2[82], immediateIndexed
dcl_constantbuffer cb3[13], immediateIndexed
dcl_sampler s10, mode_default
dcl_sampler s11, mode_default
dcl_sampler s13, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texture2d (float,float,float,float) t4
dcl_resource_texture2d (float,float,float,float) t5
dcl_resource_texture2d (float,float,float,float) t6
dcl_resource_texture2d (float,float,float,float) t7
dcl_resource_texture2d (float,float,float,float) t51
dcl_resource_texture2d (float,float,float,float) t52
dcl_resource_texture2d (float,float,float,float) t53
dcl_resource_structured t54, 384 
dcl_input_ps_siv linear noperspective v0.xyw, position
dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xyz
dcl_input_ps constant v3.x
dcl_output o0.xyzw
dcl_output o1.x
// dcl_temps 16
dcl_temps 18
dcl_resource_texture2d (float,float,float,float) t125
dp3 r0.x, v2.xyzx, v2.xyzx
rsq r0.x, r0.x
mul r0.xyz, r0.xxxx, v2.xyzx
mad r1.xy, v0.xyxx, cb2[45].zwzz, cb2[45].xyxx
mad r1.zw, r1.xxxy, cb2[18].xxxy, cb2[18].zzzw
mul r2.xy, r1.zwzz, v0.wwww
mov r2.z, v0.w

//View space correction, therefore need the InvProj._m00
ld_indexable(texture2d)(float,float,float,float) r17.xyzw, l(0, 0, 0, 0), t125.xyzw
add r17.w, v0.w, -r17.y
mul r17.w, r17.w, r17.x
mul r17.w, r17.w, cb2[81].x
add r2.x, r2.x, -r17.w


dp3 r0.w, -r2.xyzx, -r2.xyzx
rsq r0.w, r0.w
mul r2.xyz, r0.wwww, -r2.xyzx
dp3 r3.x, r2.xyzx, cb2[0].xyzx
dp3 r3.y, r2.xyzx, cb2[1].xyzx
dp3 r3.z, r2.xyzx, cb2[2].xyzx
sample_indexable(texture2d)(float,float,float,float) r2.xyz, r1.xyxx, t1.xyzw, s10
ishl r0.w, v3.x, l(3)
dp3 r0.w, cb0[r0.w + 4].xyzx, cb0[r0.w + 4].xyzx
sqrt r0.w, r0.w
mul r1.zw, v1.xxxy, cb3[7].xxxy
sample_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t7.yzxw, s11
mul r4.xy, r0.wwww, v1.xyxx
mul r4.xy, r4.xyxx, cb3[7].zwzz
sample_indexable(texture2d)(float,float,float,float) r4.xyz, r4.xyxx, t6.xyzw, s11
mov_sat r0.w, cb3[9].x
mad r5.xyz, cb3[6].xyzx, l(0.500000, 0.500000, 0.500000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
mad r5.xyz, r0.wwww, r5.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
mul r1.z, r1.z, r0.w
add r1.w, cb3[1].w, l(-1.000000)
mad r4.xyz, r4.xyzx, cb3[0].xyzx, l(-1.000000, -1.000000, -1.000000, 0.000000)
mad r4.xyz, r0.wwww, r4.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
sample_indexable(texture2d)(float,float,float,float) r6.xyz, r1.xyxx, t51.xyzw, s13
sample_indexable(texture2d)(float,float,float,float) r7.xyz, r1.xyxx, t52.xyzw, s13
ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r8.xyz, cb7[0].x, l(16), t54.xyzx
dp3 r9.x, -r8.xyzx, cb2[0].xyzx
dp3 r9.y, -r8.xyzx, cb2[1].xyzx
dp3 r9.z, -r8.xyzx, cb2[2].xyzx
movc r8.xyz, cb7[0].yyyy, r9.xyzx, l(0,0,0,0)
ftoi r9.xy, v0.xyxx
mov r9.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r2.w, r9.xyww, t0.yzwx
add r3.w, cb3[10].y, cb3[10].x
add_sat r3.w, -r3.w, l(1.000000)
mul r4.w, r2.w, r2.w
mad r2.w, cb3[10].x, r2.w, r3.w
mad_sat r2.w, r4.w, cb3[10].y, r2.w
add r10.xyz, -cb3[2].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
mad_sat r10.xyz, r2.wwww, r10.xyzx, cb3[2].xyzx
ge r2.w, l(0.000000), cb3[5].w
if_nz r2.w
  sample_indexable(texture2d)(float,float,float,float) r11.xyz, r1.xyxx, t5.xyzw, s11
else 
  sample_indexable(texture2d)(float,float,float,float) r12.xyz, r1.xyxx, t5.xyzw, s11
  add r13.xy, r1.xyxx, cb3[5].wwww
  sample_indexable(texture2d)(float,float,float,float) r13.xyz, r13.xyxx, t5.xyzw, s11
  mul r13.xyz, r13.xyzx, l(26.000000, 26.000000, 26.000000, 0.000000)
  mad r12.xyz, r12.xyzx, l(41.000000, 41.000000, 41.000000, 0.000000), r13.xyzx
  mov r13.xz, -cb3[5].wwww
  mad r14.xyzw, cb3[5].wwww, l(1.000000, -1.000000, -1.000000, 1.000000), r1.xyxy
  sample_indexable(texture2d)(float,float,float,float) r15.xyz, r14.xyxx, t5.xyzw, s11
  mad r12.xyz, r15.xyzx, l(26.000000, 26.000000, 26.000000, 0.000000), r12.xyzx
  sample_indexable(texture2d)(float,float,float,float) r14.xyz, r14.zwzz, t5.xyzw, s11
  mad r12.xyz, r14.xyzx, l(26.000000, 26.000000, 26.000000, 0.000000), r12.xyzx
  add r13.xw, r1.xxxy, r13.xxxx
  sample_indexable(texture2d)(float,float,float,float) r14.xyz, r13.xwxx, t5.xyzw, s11
  mad r12.xyz, r14.xyzx, l(26.000000, 26.000000, 26.000000, 0.000000), r12.xyzx
  mov r14.y, cb3[5].w
  mov r14.x, l(0)
  add r14.xyzw, r1.xyxy, r14.yxxy
  sample_indexable(texture2d)(float,float,float,float) r15.xyz, r14.xyxx, t5.xyzw, s11
  mad r12.xyz, r15.xyzx, l(16.000000, 16.000000, 16.000000, 0.000000), r12.xyzx
  mov r13.y, l(0)
  add r13.xyzw, r1.xyxy, r13.zyyz
  sample_indexable(texture2d)(float,float,float,float) r15.xyz, r13.xyxx, t5.xyzw, s11
  mad r12.xyz, r15.xyzx, l(16.000000, 16.000000, 16.000000, 0.000000), r12.xyzx
  sample_indexable(texture2d)(float,float,float,float) r14.xyz, r14.zwzz, t5.xyzw, s11
  mad r12.xyz, r14.xyzx, l(16.000000, 16.000000, 16.000000, 0.000000), r12.xyzx
  sample_indexable(texture2d)(float,float,float,float) r13.xyz, r13.zwzz, t5.xyzw, s11
  mad r12.xyz, r13.xyzx, l(16.000000, 16.000000, 16.000000, 0.000000), r12.xyzx
  mul r11.xyz, r12.xyzx, l(0.00478468882, 0.00478468882, 0.00478468882, 0.000000)
endif 
dp3 r1.x, -r3.xyzx, r8.xyzx
add r1.x, r1.x, cb3[11].y
add r1.y, cb3[11].y, l(1.000000)
div r1.x, r1.x, r1.y
max r1.x, r1.x, l(0.000000)
mul r12.xyz, r11.xyzx, cb3[2].wwww
add r11.xyz, r11.xyzx, -cb3[5].xyzx
mad r11.xyz, cb3[8].zzzz, r11.xyzx, cb3[5].xyzx
sample_indexable(texture2d)(float,float,float,float) r1.y, v1.xyxx, t4.yxzw, s11
add_sat r2.w, -cb3[11].w, l(1.000000)
mad_sat r1.y, cb3[11].w, r1.y, r2.w
dp3 r2.w, r3.xyzx, r2.xyzx
dp3_sat r3.w, r8.xyzx, r2.xyzx
mul r7.xyz, r7.xyzx, r10.xyzx
mov_sat r4.w, r2.w
mul r8.xy, v0.xyxx, l(0.250000, 0.250000, 0.000000, 0.000000)
sample_indexable(texture2d)(float,float,float,float) r5.w, r8.xyxx, t3.yzwx, s11
mov r6.w, v3.x
mad r5.w, r5.w, cb1[r6.w + 3].y, cb1[r6.w + 3].z
mul r6.w, r1.y, r10.x
add r7.w, -r4.w, l(1.000000)
log r7.w, r7.w
mul r7.w, r7.w, cb3[9].z
exp r7.w, r7.w
mad r4.w, -r4.w, cb3[9].y, l(1.000000)
mul r8.xyz, r7.wwww, cb3[4].xyzx
mad r1.w, r0.w, r1.w, l(3.000000)
mul r1.w, r1.w, l(0.010000)
mul r13.xyz, r1.wwww, r5.xyzx
ld_indexable(texture2d)(float,float,float,float) r9.xyz, r9.xyzw, t53.xyzw
add r14.xyz, r9.xyzx, -cb3[5].xyzx
mad r14.xyz, cb3[10].zzzz, r14.xyzx, cb3[5].xyzx
mad r12.xyz, r9.xyzx, cb3[11].zzzz, r12.xyzx
add r12.xyz, r12.xyzx, cb3[6].wwww
mul r11.xyz, r11.xyzx, r14.xyzx
mul r11.xyz, r11.xyzx, cb3[9].wwww
mad r8.xyz, r3.wwww, r8.xyzx, r4.wwww
mul r11.xyz, r1.zzzz, r11.xyzx
mad r1.xzw, r11.xxyz, r1.xxxx, r12.xxyz
add r8.xyz, r8.xyzx, l(-1.000000, -1.000000, -1.000000, 0.000000)
mad r8.xyz, r0.wwww, r8.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
mul r4.xyz, r4.xyzx, r8.xyzx
add r1.xzw, -r6.xxyz, r1.xxzw
mad r1.xzw, r0.wwww, r1.xxzw, r6.xxyz
mad r1.xzw, r0.wwww, cb3[1].xxyz, r1.xxzw
mad r1.xyz, r9.xyzx, r1.yyyy, r1.xzwx
mul r1.xyz, r1.xyzx, r10.xyzx
max r0.w, r2.w, l(1.000000012E-007)
add r0.w, -r0.w, l(1.000000)
mul r1.w, r0.w, r0.w
mul r1.w, r1.w, r1.w
mul r0.w, r0.w, r1.w
mad r0.w, r0.w, l(0.960000), l(0.040000)
mul r2.xyz, r2.xyzx, r2.wwww
mad r2.xyz, r2.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), -r3.xyzx
dp3 r1.w, r5.xyzx, l(0.299000, 0.587000, 0.114000, 0.000000)
dp3 r0.x, r2.xyzx, r0.xyzx
mad_sat r0.x, cb3[12].x, r0.x, l(1.000000)
mul r0.x, r0.x, r0.x
mul r2.xyz, r7.xyzx, r13.xyzx
mul r0.y, r0.w, r6.w
mul r0.x, r0.x, r0.y
mul r0.x, r1.w, r0.x
mad r0.yzw, r1.xxyz, r4.xxyz, r2.xxyz
max o0.xyz, r0.yzwy, l(0.000000, 0.000000, 0.000000, 0.000000)
mul_sat r0.x, r0.x, l(0.250000)
sqrt o1.x, r0.x
add r0.x, -cb1[2].x, l(1.000000)
min r0.x, r5.w, r0.x
lt r0.x, r0.x, l(0.000000)
discard_nz r0.x
mov o0.w, l(1.000000)
ret 
// Approximately 152 instruction slots used
