//21fca388481458b9-ps.txt
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.17672
//
//   using 3Dmigoto v1.2.27 on Sun Feb 07 02:04:12 2016
//
//
// Buffer Definitions: 
//
// 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 [unused]
//
// }
//
// 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
//   float __padding12;                 // Offset:  172 Size:     4 [unused]
//   float3 CameraDirection;            // Offset:  176 Size:    12
//   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
//   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
//   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 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_Setup_5F691EA08298950_cp2_Param_texture    texture  float4          2d    0        1
// p_default_Setup_n11_n52_Texture_texture    texture  float4          2d    1        1
// p_default_Setup_n11_n62_Texture_texture    texture  float4          2d    2        1
// p_default_Setup_n11_D3C0D0305579947_cp1_Param_texture    texture  float4          2d    3        1
// p_default_Material_n140_DepthBufferTexture_texture    texture  float4          2d    4        1
// p_default_Setup_n9_n62_Texture_texture    texture  float4          2d    5        1
// p_default_Setup_n9_n52_Texture_texture    texture  float4          2d    6        1
// p_default_Setup_n9_D3C0D0305579947_cp1_Param_texture    texture  float4          2d    7        1
// DrawableBuffer                    cbuffer      NA          NA    1        1
// SceneBuffer                       cbuffer      NA          NA    2        1
// MaterialBuffer                    cbuffer      NA          NA    3        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   xyzw
// TEXCOORD                 2   xyz         2     NONE   float   xyz 
// SV_IsFrontFace           0   x           3    FFACE    uint   x   
//
//
// 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 cb1[3], immediateIndexed
// dcl_constantbuffer cb2[46], immediateIndexed
dcl_constantbuffer cb2[82], immediateIndexed
dcl_constantbuffer cb3[9], 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) t2
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_input_ps_siv linear noperspective v0.xyw, position
dcl_input_ps linear v1.xyzw
dcl_input_ps linear v2.xyz
dcl_input_ps_sgv v3.x, is_front_face
dcl_output o0.xyzw
// dcl_temps 9
dcl_temps 11
dcl_resource_texture2d (float,float,float,float) t125
mul r0.xyzw, cb2[24].xxxx, cb3[2].zwxy
mad r0.zw, v1.xxxy, cb3[3].xxxy, r0.zzzw
mad r0.xy, v1.xyxx, cb3[1].zwzz, r0.xyxx
sample_indexable(texture2d)(float,float,float,float) r0.xy, r0.xyxx, t6.xyzw, s11
mad r1.xy, r0.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
sample_indexable(texture2d)(float,float,float,float) r0.xy, r0.zwzz, t1.xyzw, s11
mad r0.xy, r0.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r0.w, r0.xyxx, r0.xyxx
add r0.w, -r0.w, l(1.000000)
max r0.w, r0.w, l(0.000000)
sqrt r0.z, r0.w
dp2 r0.w, r1.xyxx, r1.xyxx
add r0.w, -r0.w, l(1.000000)
max r0.w, r0.w, l(0.000000)
sqrt r1.z, r0.w
mov r2.x, cb3[7].z
mov r2.z, l(1.000000)
mad r1.xyz, r1.xyzx, r2.xxzx, l(-1.000000, -1.000000, -1.000000, 0.000000)
sample_indexable(texture2d)(float,float,float,float) r0.w, v1.xyxx, t7.yzwx, s13
add r0.w, -r0.w, l(1.000000)
max r1.w, cb3[5].w, l(0.008000)
add r2.x, r0.w, -r1.w
add r0.w, r0.w, -r2.x
div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
mul r3.xyzw, v1.xyxy, cb3[4].xyzw
mad r2.yz, cb2[24].xxxx, cb3[3].zzwz, r3.xxyx
mad r3.xy, cb2[24].xxxx, cb3[5].xyxx, r3.zwzz
sample_indexable(texture2d)(float,float,float,float) r2.w, r3.xyxx, t2.xyzw, s11
sample_indexable(texture2d)(float,float,float,float) r2.y, r2.yzyy, t5.xwyz, s11
max r2.z, r2.y, l(0.000000)
min r2.z, r2.z, l(0.990000)
add r2.x, -r2.x, r2.z
mul_sat r0.w, r0.w, r2.x
mad r2.x, r0.w, l(-2.000000), l(3.000000)
mul r0.w, r0.w, r0.w
mul r0.w, r0.w, r2.x
mad r3.xyzw, v0.xyxy, cb2[45].zwzw, cb2[45].xyxy
mad r4.xy, r3.zwzz, cb2[18].xyxx, cb2[18].zwzz
mul r4.xy, r4.xyxx, v0.wwww
mov r4.z, v0.w

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


dp3 r2.x, -r4.xyzx, -r4.xyzx
rsq r2.x, r2.x
mul r4.xyz, r2.xxxx, -r4.xyzx
dp3 r5.x, r4.xyzx, cb2[0].xyzx
dp3 r5.y, r4.xyzx, cb2[1].xyzx
dp3 r5.z, r4.xyzx, cb2[2].xyzx
movc r4.xyz, v3.xxxx, v2.xyzx, -v2.xyzx
dp3 r2.x, r4.xyzx, r4.xyzx
rsq r2.x, r2.x
mul r4.xyz, r2.xxxx, r4.xyzx
dp3_sat r2.x, r4.xyzx, r5.xyzx
log r2.x, r2.x
mul r4.w, r2.x, cb3[6].w
mul r2.x, r2.x, cb3[7].y
exp r2.x, r2.x
mul_sat r2.x, r2.x, cb3[6].z
add r2.x, -r2.x, l(1.000000)
exp r4.w, r4.w
mul_sat r4.w, r4.w, cb3[7].x
add r4.w, -r4.w, l(1.000000)
add r1.w, -r1.w, r4.w
add r4.w, -r1.w, r4.w
add r1.w, -r1.w, r2.z
div r2.z, l(1.000000, 1.000000, 1.000000, 1.000000), r4.w
mul_sat r1.w, r1.w, r2.z
mad r2.z, r1.w, l(-2.000000), l(3.000000)
mul r1.w, r1.w, r1.w
mul r1.w, r1.w, r2.z
min r0.w, r0.w, r1.w
mul r1.w, r0.w, r2.y
mad r0.w, r2.y, r0.w, l(-1.000000)
add_sat r2.y, cb3[6].y, l(1.000000)
mul r1.w, r1.w, r2.y
mad_sat r0.w, r2.y, r0.w, l(1.000000)
mad r1.xyz, r1.wwww, r1.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
mov r6.x, cb3[5].z
mov r6.z, l(1.000000)
mad r0.xyz, r0.xyzx, r6.xxzx, -r1.xyzx
sample_indexable(texture2d)(float,float,float,float) r1.w, v1.zwzz, t3.yzwx, s13
add r1.w, -r1.w, l(1.000000)
max r2.y, cb3[6].x, l(0.008000)
add r2.z, r1.w, -r2.y
add r1.w, r1.w, -r2.z
div r1.w, l(1.000000, 1.000000, 1.000000, 1.000000), r1.w
add r2.y, -r2.y, r2.x
add r2.x, -r2.y, r2.x
div r2.x, l(1.000000, 1.000000, 1.000000, 1.000000), r2.x
max r4.w, r2.w, l(0.000000)
min r4.w, r4.w, l(0.990000)
add r2.yz, -r2.yyzy, r4.wwww
mul_sat r2.x, r2.x, r2.y
mul_sat r1.w, r1.w, r2.z
mad r2.y, r1.w, l(-2.000000), l(3.000000)
mul r1.w, r1.w, r1.w
mul r1.w, r1.w, r2.y
mad r2.y, r2.x, l(-2.000000), l(3.000000)
mul r2.x, r2.x, r2.x
mul r2.x, r2.x, r2.y
min r1.w, r1.w, r2.x
mul r2.x, r1.w, r2.w
mad r1.w, r2.w, r1.w, -r0.w
mul r2.yz, v1.zzwz, cb3[1].xxyx
sample_indexable(texture2d)(float,float,float,float) r2.y, r2.yzyy, t0.yxzw, s11
add_sat r2.y, r2.y, cb3[8].y
mul r2.x, r2.y, r2.x
mad_sat r0.w, r2.y, r1.w, r0.w
mad r0.xyz, r2.xxxx, r0.xyzx, r1.xyzx
deriv_rty_fine r1.xy, v1.xyxx
deriv_rtx_fine r2.xy, v1.xyxx
mul r1.x, r1.x, r2.y
mad r1.x, r2.x, r1.y, -r1.x
mov r1.z, -r2.y
lt r1.w, r1.x, l(0.000000)
lt r1.x, l(0.000000), |r1.x|
movc r1.w, r1.w, l(-1.000000), l(1.000000)
mul r1.yz, r1.yyzy, r1.wwww
mul r2.xyzw, r3.xyzw, v0.wwww
sample_indexable(texture2d)(float,float,float,float) r3.x, r3.zwzz, t4.xyzw, s10
mad r3.x, r3.x, cb2[20].x, cb2[20].y
max r3.x, r3.x, l(0.000001)
div r3.x, l(1.000000, 1.000000, 1.000000, 1.000000), r3.x
mov r6.xy, r2.zwzz
mov r2.z, v0.w
mov r2.w, l(1.000000)
mov r6.zw, r2.zzzw
dp4 r3.y, cb2[15].xyzw, r6.xyzw
deriv_rty_fine r7.x, r3.y
deriv_rtx_fine r8.z, r3.y
dp4 r3.y, cb2[16].xyzw, r6.xyzw
dp4 r3.z, cb2[17].xyzw, r6.xyzw
deriv_rty_fine r7.yz, r3.yyzy
deriv_rtx_fine r8.xy, r3.yzyy
dp3 r3.y, r7.xyzx, r4.xyzx
mad r3.yzw, -r3.yyyy, r4.xxyz, r7.xxyz
mul r6.xyz, r1.zzzz, r3.yzwy
dp3 r1.z, r8.zxyz, r4.xyzx
mad r7.xyz, -r1.zzzz, r4.yzxy, r8.xyzx
mad r6.xyz, r7.zxyz, r1.yyyy, r6.xyzx
dp3 r1.y, r6.xyzx, r6.xyzx
rsq r1.y, r1.y
mul r8.xyz, r1.yyyy, r6.xyzx
movc r1.xyz, r1.xxxx, r8.xyzx, r6.xyzx
mul r6.xyz, r1.yzxy, r4.zxyz
mad r6.xyz, r4.yzxy, r1.zxyz, -r6.xyzx
mul r8.xyz, r4.zxyz, r7.xyzx
mad r7.xyz, r4.yzxy, r7.yzxy, -r8.xyzx
dp3 r3.y, r3.yzwy, r7.xyzx
lt r3.y, r3.y, l(0.000000)
movc r3.y, r3.y, l(-1.000000), l(1.000000)
mul r1.w, r1.w, r3.y
mul r3.yzw, r1.wwww, r6.xxyz
mul r3.yzw, r0.yyyy, r3.yyzw
mad r1.xyz, r0.xxxx, r1.xyzx, r3.yzwy
mad r0.xyz, r0.zzzz, r4.xyzx, r1.xyzx
dp3 r1.x, r0.xyzx, r0.xyzx
rsq r1.x, r1.x
mul r0.xyz, r0.xyzx, r1.xxxx
dp3_sat r0.x, r0.xyzx, r5.xyzx
log r0.x, r0.x
mul r0.x, r0.x, cb3[8].x
exp r0.x, r0.x
mul r0.x, r0.x, cb3[7].w
dp4 r1.x, cb2[15].xyzw, r2.xyzw
dp4 r1.y, cb2[16].xyzw, r2.xyzw
dp4 r1.z, cb2[17].xyzw, r2.xyzw
add r1.xyz, r1.xyzx, -cb2[10].xyzx
dp3 r0.y, r1.xyzx, cb2[11].xyzx
add r0.y, -r0.y, r3.x
max r0.y, r0.y, l(0.000000)
mul_sat r0.y, r0.y, cb3[0].y
mul r0.y, r0.y, r0.w
mul r0.x, r0.x, r0.y
mov_sat r0.xyzw, r0.xxxx
add r1.x, r0.w, -cb1[2].x
mov o0.xyzw, r0.xyzw
lt r0.x, r1.x, l(0.000000)
discard_nz r0.x
ret 
// Approximately 178 instruction slots used
