//334e79a19fc47256-ps.txt
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.2.27 on Fri Jan 29 08:58:49 2016
//
//
// Buffer Definitions: 
//
// cbuffer SceneBuffer
// {
//
//   row_major float4x4 View;           // Offset:    0 Size:    64 [unused]
//   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
//   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
//   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
//   float4 FogParams3;                 // Offset:  416 Size:    16
//   float3 GlobalAmbient;              // Offset:  432 Size:    12 [unused]
//   float __padding8;                  // Offset:  444 Size:     4 [unused]
//   float4 GlobalParams[16];           // Offset:  448 Size:   256
//   float4 ViewToFogH;                 // Offset:  704 Size:    16
//   float4 ScreenExtents;              // Offset:  720 Size:    16 [unused]
//   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
//   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
//   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]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// SamplerGenericBilinearClamp       sampler      NA          NA   13        1
// depthBuffer_texture               texture  float4          2d    0        1
// fogColorTex                       texture  float4        cube    2        1
// AttenuationSampler_texture        texture  float4          2d   44        1
// SceneBuffer                       cbuffer      NA          NA    2        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xy  
// TEXCOORD                 0   xy          1     NONE   float   xy  
// SV_SampleIndex           0   x           2   SAMPLE    uint       
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb2[96], immediateIndexed
dcl_sampler s13, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texturecube (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t44
dcl_input_ps_siv linear noperspective v0.xy, position
dcl_input_ps linear v1.xy
dcl_output o0.xyzw
// dcl_temps 3
dcl_temps 5
dcl_resource_texture2d (float,float,float,float) t125
ftoi r0.xy, v0.xyxx
mov r0.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r0.x, r0.xyzw, t0.xyzw
mad r0.x, r0.x, cb2[20].x, cb2[20].y
div r0.z, l(1.000000, 1.000000, 1.000000, 1.000000), r0.x
mad r1.xy, v1.xyxx, cb2[18].xyxx, cb2[18].zwzz
mul r0.xy, r0.zzzz, r1.xyxx

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


dp3 r1.x, r0.xyzx, r0.xyzx
sqrt r1.y, r1.x
mov r0.w, l(1.000000)
dp4 r0.w, r0.xyzw, cb2[44].xyzw
mad r2.yz, r0.wwww, cb2[9].yyzy, cb2[25].yyzy
mad r2.x, r1.y, cb2[9].x, cb2[25].x
sample_l_indexable(texture2d)(float,float,float,float) r0.w, r2.xzxx, t44.yzwx, s13, l(0.000000)
sample_l_indexable(texture2d)(float,float,float,float) r1.y, r2.yzyy, t44.xyzw, s13, l(0.000000)
lt r1.z, l(0.000000), cb2[26].w
if_nz r1.z
  rsq r1.x, r1.x
  mul r0.xyz, r0.xyzx, r1.xxxx
  mul r1.xzw, r0.yyyy, cb2[67].xxyz
  mad r1.xzw, r0.xxxx, cb2[66].xxyz, r1.xxzw
  mad r0.xyz, r0.zzzz, cb2[68].xyzx, r1.xzwx
  mul r1.xz, r0.xxyx, cb2[9].wwww
  mad r2.x, cb2[25].w, r0.y, r1.x
  mad r2.y, -cb2[25].w, r0.x, r1.z
  mov r2.z, r0.z
  sample_l_indexable(texturecube)(float,float,float,float) r0.xyz, r2.xyzx, t2.xyzw, s13, l(0.000000)
else 
  mov r0.xyz, cb2[95].xyzx
endif 
add r0.xyz, r0.xyzx, -cb2[95].xyzx
mad r0.xyz, cb2[26].wwww, r0.xyzx, cb2[95].xyzx
max r0.xyz, r0.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
log r0.xyz, r0.xyzx
mul r0.xyz, r0.xyzx, cb2[26].yyyy
exp r0.xyz, r0.xyzx
mul r0.xyz, r0.xyzx, cb2[26].xxxx
max r1.xzw, cb2[35].xxyz, l(0.000000, 0.000000, 0.000000, 0.000000)
log r1.xzw, r1.xxzw
mul r1.xzw, r1.xxzw, cb2[26].yyyy
exp r1.xzw, r1.xxzw
mul r0.xyz, r0.xyzx, r0.wwww
mad r1.xzw, cb2[26].xxxx, r1.xxzw, -r0.xxyz
mad o0.xyz, r1.yyyy, r1.xzwx, r0.xyzx
add r0.x, r0.w, r1.y
mad_sat o0.w, -r0.w, r1.y, r0.x
ret 
// Approximately 47 instruction slots used
