//096564a4aa25b42f-ps.txt
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.17672
//
//   using 3Dmigoto v1.2.27 on Fri Jan 29 09:13:08 2016
//
//
// Buffer Definitions: 
//
// 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 [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
//   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
// ------------------------------ ---------- ------- ----------- ---- --------
// SamplerGenericTrilinearWrap       sampler      NA          NA   11        1
// p_default_Setup_n19_n137_Texture_texture    texture  float4          2d    0        1
// p_default_Setup_n3_5637D76019617032_cp1_Param_texture    texture  float4          2d    3        1
// p_default_Setup_n1_n53_Texture_texture    texture  float4          2d    4        1
// p_default_Setup_n3_2FCBF5109468681_Param_texture    texture  float4          2d    5        1
// p_default_Setup_n9_4DF3FB3016561432_cp3_Param_texture    texture  float4          2d    6        1
// p_default_Setup_n0_n53_Texture_texture    texture  float4          2d    7        1
// p_default_Setup_n14_n53_Texture_texture    texture  float4          2d    8        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   xy  
// TEXCOORD                 2   xyz         2     NONE   float   xyz 
// PSIZE                    0   x           3     NONE    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[46], immediateIndexed
dcl_constantbuffer cb2[82], immediateIndexed
dcl_constantbuffer cb3[15], immediateIndexed
dcl_sampler s11, mode_default
dcl_resource_texture2d (float,float,float,float) t0
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) t8
dcl_input_ps_siv linear noperspective v0.xyw, position
dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xyz
dcl_output o0.xyzw
// dcl_temps 9
dcl_temps 11
dcl_resource_texture2d (float,float,float,float) t125
add r0.x, cb3[11].z, -cb3[12].x
div r0.x, l(1.000000, 1.000000, 1.000000, 1.000000), r0.x
mad r1.xyzw, v0.xyxy, cb2[45].zwzw, cb2[45].xyxy
mul r2.xyzw, r1.zwxy, v0.wwww

//Screen space correction, therefore need the '0.5'
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, l(0.5)
add r2.x, r2.x, -r10.w


mad r0.yz, r1.zzwz, cb2[18].xxyx, cb2[18].zzwz
mul r1.xy, r0.yzyy, v0.wwww
mov r3.xy, r2.zwzz

//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 r3.x, r3.x, -r10.w


mov r3.z, v0.w
mov r3.w, l(1.000000)
dp4 r4.x, cb2[15].xyzw, r3.xyzw
dp4 r4.y, cb2[16].xyzw, r3.xyzw
dp4 r4.z, cb2[17].xyzw, r3.xyzw
mov r2.zw, r3.zzzw
add r0.yzw, r4.xxyz, -cb2[10].xxyz
dp3 r0.y, r0.yzwy, cb2[11].xyzx
add r0.y, r0.y, -cb3[12].x
mul_sat r0.x, r0.x, r0.y
mad r0.y, r0.x, l(-2.000000), l(3.000000)
mul r0.x, r0.x, r0.x
mul r0.x, r0.x, r0.y
min r0.x, r0.x, l(1.000000)
add r0.y, -cb3[11].w, cb3[12].y
mad r0.x, r0.x, r0.y, cb3[11].w
mul r0.yzw, cb3[1].yyyy, cb3[3].xxyz
mul r0.yzw, r0.yyzw, r4.xxyz
sample_indexable(texture2d)(float,float,float,float) r1.w, r0.yzyy, t5.xzwy, s11
sample_indexable(texture2d)(float,float,float,float) r0.z, r0.zwzz, t5.xzyw, s11
sample_indexable(texture2d)(float,float,float,float) r0.y, r0.ywyy, t5.xyzw, s11
dp3 r0.w, v2.xyzx, v2.xyzx
rsq r0.w, r0.w
mul r3.xyz, r0.wwww, v2.xyzx
mul r0.y, r0.y, |r3.y|
mad r0.y, r0.z, |r3.x|, r0.y
mad_sat r0.y, r1.w, |r3.z|, r0.y
add_sat r4.xy, r0.yyyy, cb3[11].xyxx
mov r4.w, l(1.000000)
mov r5.xz, r4.yywy
mul r6.xyzw, v1.xyxy, cb3[8].xyzw
mul r0.yz, r6.zzwz, cb3[9].xxyx
sample_indexable(texture2d)(float,float,float,float) r5.y, r0.yzyy, t3.xyzw, s11
dp3_sat r0.y, cb3[5].xyzx, r5.xyzx
add r0.z, -cb3[4].w, cb3[5].w
div r0.z, l(1.000000, 1.000000, 1.000000, 1.000000), r0.z
dp3 r0.w, cb3[2].xyzx, cb3[2].xyzx
rsq r0.w, r0.w
mul r5.xyz, r0.wwww, cb3[2].xyzx
dp3 r0.w, -r5.xyzx, r3.xyzx
add r1.w, r0.w, -cb3[4].w
add r0.w, r0.w, -cb3[2].w
mul_sat r0.z, r0.z, r1.w
mad r1.w, r0.z, l(-2.000000), l(3.000000)
mul r0.z, r0.z, r0.z
mul r0.z, r0.z, r1.w
min r0.z, r0.z, l(1.000000)
mul r0.y, r0.z, r0.y
mul r5.xy, r6.zwzz, cb3[7].zwzz
sample_indexable(texture2d)(float,float,float,float) r5.zw, r6.xyxx, t8.zwxy, s11
mad r5.zw, r5.zzzw, l(0.000000, 0.000000, 2.000000, 2.000000), l(0.000000, 0.000000, -1.000000, -1.000000)
mul r5.zw, r5.zzzw, cb3[13].xxxx
sample_indexable(texture2d)(float,float,float,float) r4.z, r5.xyxx, t3.xzyw, s11
dp3_sat r0.z, cb3[4].xyzx, r4.xzwx
add r1.w, -cb3[2].w, cb3[3].w
div r1.w, l(1.000000, 1.000000, 1.000000, 1.000000), r1.w
mul_sat r0.w, r0.w, r1.w
mad r1.w, r0.w, l(-2.000000), l(3.000000)
mul r0.w, r0.w, r0.w
mul r0.w, r0.w, r1.w
min r0.w, r0.w, l(1.000000)
mul r0.z, r0.w, r0.z
max r0.w, r0.z, r0.y
add r0.w, -r0.w, l(1.000000)
mul r0.x, r0.x, r0.w
mul r4.xyzw, v1.xyxy, cb3[6].zwxy
mad r4.zw, cb2[24].xxxx, cb3[10].xxxy, r4.zzzw
sample_indexable(texture2d)(float,float,float,float) r4.xy, r4.xyxx, t7.xyzw, s11
mad r6.xy, r4.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) r4.xy, r4.zwzz, t0.xyzw, s11
mad r4.xy, r4.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
mul r4.xy, r0.xxxx, r4.xyxx
dp2 r0.x, r6.xyxx, r6.xyxx
add r0.x, -r0.x, l(1.000000)
max r0.x, r0.x, l(0.000000)
sqrt r6.z, r0.x
mov r7.x, cb3[12].z
mov r7.z, l(1.000000)
mul r6.xyz, r6.xyzx, r7.xxzx
mul r0.xw, v1.xxxy, cb3[10].zzzw
sample_indexable(texture2d)(float,float,float,float) r0.xw, r0.xwxx, t4.xzwy, s11
mad r7.xy, r0.xwxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r0.x, r7.xyxx, r7.xyxx
add r0.x, -r0.x, l(1.000000)
max r0.x, r0.x, l(0.000000)
sqrt r7.z, r0.x
mov r8.x, cb3[13].z
mov r8.z, l(1.000000)
mad r7.xyz, r7.xyzx, r8.xxzx, -r6.xyzx
mad r6.xyz, r0.yyyy, r7.xyzx, r6.xyzx
mul r5.xy, r5.zwzz, r0.zzzz
mov r5.z, l(0)
add r5.xyz, r5.xyzx, r6.xyzx
dp3 r0.x, r5.xyzx, r5.xyzx
rsq r0.x, r0.x
mov r4.z, l(0)
mad r4.xyz, r5.xyzx, r0.xxxx, r4.xyzx
dp3 r0.x, r4.xyzx, r4.xyzx
rsq r0.x, r0.x
mul r4.xyz, r0.xxxx, r4.xyzx
dp4 r0.x, cb2[15].xyzw, r2.xyzw
deriv_rty_fine r5.x, r0.x
deriv_rtx_fine r6.z, r0.x
dp4 r0.x, cb2[16].xyzw, r2.xyzw
dp4 r0.w, cb2[17].xyzw, r2.xyzw
deriv_rty_fine r5.yz, r0.xxwx
deriv_rtx_fine r6.xy, r0.xwxx
dp3 r0.x, r5.xyzx, r3.xyzx
mad r2.xyz, -r0.xxxx, r3.xyzx, r5.xyzx
deriv_rty_fine r5.xy, v1.xyxx
deriv_rtx_fine r0.xw, v1.xxxy
mul r1.w, r5.x, r0.w
mad r0.x, r0.x, r5.y, -r1.w
mov r5.z, -r0.w
lt r0.w, r0.x, l(0.000000)
lt r0.x, l(0.000000), |r0.x|
movc r0.w, r0.w, l(-1.000000), l(1.000000)
mul r5.xy, r5.yzyy, r0.wwww
mul r5.yzw, r2.xxyz, r5.yyyy
dp3 r1.w, r6.zxyz, r3.xyzx
mad r6.xyz, -r1.wwww, r3.yzxy, r6.xyzx
mad r5.xyz, r6.zxyz, r5.xxxx, r5.yzwy
dp3 r1.w, r5.xyzx, r5.xyzx
rsq r1.w, r1.w
mul r7.xyz, r1.wwww, r5.xyzx
movc r5.xyz, r0.xxxx, r7.xyzx, r5.xyzx
mul r7.xyz, r3.zxyz, r5.yzxy
mad r7.xyz, r3.yzxy, r5.zxyz, -r7.xyzx
mul r8.xyz, r3.zxyz, r6.xyzx
mad r6.xyz, r3.yzxy, r6.yzxy, -r8.xyzx
dp3 r0.x, r2.xyzx, r6.xyzx
lt r0.x, r0.x, l(0.000000)
movc r0.x, r0.x, l(-1.000000), l(1.000000)
mul r0.x, r0.x, r0.w
mul r2.xyz, r0.xxxx, r7.xyzx
mul r2.xyz, r2.xyzx, r4.yyyy
mad r2.xyz, r4.xxxx, r5.xyzx, r2.xyzx
mad r2.xyz, r4.zzzz, r3.xyzx, r2.xyzx
dp3 r0.x, r2.xyzx, r2.xyzx
rsq r0.x, r0.x
mul r2.xyz, r0.xxxx, r2.xyzx
mov r1.z, v0.w
dp3 r0.x, -r1.xyzx, -r1.xyzx
rsq r0.x, r0.x
mul r1.xyz, r0.xxxx, -r1.xyzx
dp3 r3.z, r1.xyzx, cb2[2].xyzx
dp3 r3.x, r1.xyzx, cb2[0].xyzx
dp3 r3.y, r1.xyzx, cb2[1].xyzx
dp3 r0.x, -r3.xyzx, r2.xyzx
add r0.x, r0.x, r0.x
mad r0.xw, r2.xxxy, -r0.xxxx, -r3.xxxy
mov o0.xyz, r2.xyzx
mul r0.xw, r0.xxxw, cb3[13].wwww
sample_indexable(texture2d)(float,float,float,float) r0.x, r0.xwxx, t6.yxzw, s11
mul r1.xy, v1.xyxx, cb3[9].zwzz
sample_indexable(texture2d)(float,float,float,float) r0.w, r1.xyxx, t6.yzwx, s11
mul r0.w, r0.w, cb3[14].x
mul_sat r0.x, r0.w, r0.x
add r0.w, -cb3[12].w, cb3[14].y
mad r0.w, r0.y, r0.w, cb3[12].w
mad r0.y, r0.y, l(-5.000000), l(9.000000)
add r1.x, -r0.w, cb3[13].y
mad r0.w, r0.z, r1.x, r0.w
add r1.x, -r0.y, l(6.000000)
mad r0.y, r0.z, r1.x, r0.y
add r0.z, -r0.y, r0.w
mad r0.x, r0.x, r0.z, r0.y
max r0.x, r0.x, l(2.000000)
log r0.x, r0.x
add r0.x, r0.x, l(-1.000000)
mul r0.x, r0.x, l(0.0833333358)
min o0.w, r0.x, l(1.000000)
ret 
// Approximately 180 instruction slots used
