//73ddc1aa126ed508-ps.txt
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.17672
//
//   using 3Dmigoto v1.2.27 on Sat Feb 06 14:09:28 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 [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
//   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_4FE05D605316617_Param_texture    texture  float4          2d    0        1
// p_default_Setup_n14_n67_Texture_texture    texture  float4          2d    2        1
// p_default_Setup_n0_n49_Texture_texture    texture  float4          2d    3        1
// p_default_Setup_n0_n67_Texture_texture    texture  float4          2d    4        1
// p_default_Setup_n1_n67_Texture_texture    texture  float4          2d    5        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
// COLOR                    0   xyzw        1     NONE   float    yz 
// TEXCOORD                 0   xyzw        2     NONE   float   xy  
// TEXCOORD                 2   xyz         3     NONE   float   xyz 
// PSIZE                    0   x           4     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[8], immediateIndexed
dcl_sampler s11, mode_default
dcl_resource_texture2d (float,float,float,float) t0
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_input_ps_siv linear noperspective v0.xyw, position
dcl_input_ps linear v1.yz
dcl_input_ps linear v2.xy
dcl_input_ps linear v3.xyz
dcl_output o0.xyzw
// dcl_temps 7
dcl_temps 9
dcl_resource_texture2d (float,float,float,float) t125
mul r0.xy, v2.xyxx, cb3[5].xyxx
sample_indexable(texture2d)(float,float,float,float) r0.xy, r0.xyxx, t5.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
mad r1.xy, cb2[24].xxxx, cb3[5].zwzz, v2.xyxx
mul r1.zw, r1.xxxy, cb3[3].zzzw
mul r1.xy, r1.xyxx, cb3[4].xyxx
sample_indexable(texture2d)(float,float,float,float) r0.w, r1.xyxx, t3.xyzw, s11
mul r2.z, r0.w, cb3[0].w
sample_indexable(texture2d)(float,float,float,float) r1.xy, r1.zwzz, t4.xyzw, s11
mad r1.xy, r1.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
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 r3.x, cb3[2].w
mov r3.z, l(1.000000)
mul r1.xyz, r1.xyzx, r3.xxzx
mov r3.x, cb3[7].z
mov r3.z, l(1.000000)
mad r0.xyz, r0.xyzx, r3.xxzx, -r1.xyzx
add_sat r2.xy, v1.zyzz, cb3[7].xyxx
mov r2.w, l(1.000000)
dp3_sat r0.w, cb3[2].xyzx, r2.xzwx
dp3_sat r1.w, cb3[1].xyzx, r2.yzwy
mad r0.xyz, r0.wwww, r0.xyzx, r1.xyzx
mad r2.xyzw, v0.xyxy, cb2[45].zwzw, cb2[45].xyxy
mad r1.xy, r2.zwzz, cb2[18].xyxx, cb2[18].zwzz
mul r2.xyzw, r2.zwxy, v0.wwww

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


mul r1.xy, r1.xyxx, v0.wwww
mov r1.z, v0.w
dp3 r3.x, -r1.xyzx, -r1.xyzx
rsq r3.x, r3.x
mul r1.xyz, -r1.xyzx, r3.xxxx
dp3 r3.x, r1.xyzx, cb2[0].xyzx
dp3 r3.y, r1.xyzx, cb2[1].xyzx
dp3 r3.z, r1.xyzx, cb2[2].xyzx
mov r4.xy, r2.zwzz
mov r4.z, v0.w
mov r4.w, l(1.000000)
dp4 r1.x, cb2[15].xyzw, r4.xyzw
deriv_rty_fine r5.y, r1.x
deriv_rtx_fine r1.x, r1.x
dp4 r3.w, cb2[16].xyzw, r4.xyzw
dp4 r4.x, cb2[17].xyzw, r4.xyzw
mov r2.zw, r4.zzzw
deriv_rty_fine r5.z, r3.w
deriv_rtx_fine r1.y, r3.w
deriv_rty_fine r5.x, r4.x
deriv_rtx_fine r1.z, r4.x
dp3 r3.w, v3.xyzx, v3.xyzx
rsq r3.w, r3.w
mul r4.xyz, r3.wwww, v3.xyzx
mul r6.xyz, r4.yzxy, r5.xyzx
mad r5.xyz, r5.zxyz, r4.zxyz, -r6.xyzx
dp3 r6.x, r5.xyzx, r3.xyzx
dp3 r3.w, r1.xyzx, r5.xyzx
mul r5.xyz, r1.yzxy, r4.zxyz
mad r1.xyz, r4.yzxy, r1.zxyz, -r5.xyzx
dp3 r6.y, r1.xyzx, r3.xyzx
div r1.xy, r6.xyxx, r3.wwww
mul r3.xy, v2.xyxx, cb3[4].zwzz
deriv_rty_fine r3.zw, r3.xxxy
mul r1.yz, r1.yyyy, r3.zzwz
deriv_rtx_fine r3.zw, r3.xxxy
mad r1.xy, r1.xxxx, r3.zwzz, r1.yzyy
sample_indexable(texture2d)(float,float,float,float) r1.z, r3.xyxx, t0.yzxw, s11
add r1.z, r1.z, l(-0.500000)
mul r1.z, r1.z, cb3[6].x
mad r1.xy, r1.xyxx, r1.zzzz, r3.xyxx
mad r1.xy, v2.xyxx, cb3[3].xyxx, r1.xyxx
sample_indexable(texture2d)(float,float,float,float) r1.xy, r1.xyxx, t2.xyzw, s11
mad r1.xy, r1.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r3.x, r1.xyxx, r1.xyxx
add r3.x, -r3.x, l(1.000000)
max r3.x, r3.x, l(0.000000)
sqrt r1.z, r3.x
mov r3.x, cb3[6].w
mov r3.z, l(1.000000)
mad r1.xyz, r1.xyzx, r3.xxzx, -r0.xyzx
mad r0.xyz, r1.wwww, r1.xyzx, r0.xyzx
dp4 r1.x, cb2[15].xyzw, r2.xyzw
deriv_rty_fine r3.x, r1.x
deriv_rtx_fine r1.z, r1.x
dp4 r3.w, cb2[16].xyzw, r2.xyzw
dp4 r2.x, cb2[17].xyzw, r2.xyzw
deriv_rty_fine r3.y, r3.w
deriv_rtx_fine r1.x, r3.w
deriv_rty_fine r3.z, r2.x
deriv_rtx_fine r1.y, r2.x
dp3 r2.x, r3.xyzx, r4.xyzx
mad r2.xyz, -r2.xxxx, r4.xyzx, r3.xyzx
deriv_rty_fine r3.xy, v2.xyxx
deriv_rtx_fine r5.xy, v2.xyxx
mul r2.w, r3.x, r5.y
mad r2.w, r5.x, r3.y, -r2.w
mov r3.z, -r5.y
lt r3.x, r2.w, l(0.000000)
lt r2.w, l(0.000000), |r2.w|
movc r3.x, r3.x, l(-1.000000), l(1.000000)
mul r3.yz, r3.yyzy, r3.xxxx
mul r5.xyz, r2.xyzx, r3.zzzz
dp3 r3.z, r1.zxyz, r4.xyzx
mad r1.xyz, -r3.zzzz, r4.yzxy, r1.xyzx
mad r3.yzw, r1.zzxy, r3.yyyy, r5.xxyz
dp3 r4.w, r3.yzwy, r3.yzwy
rsq r4.w, r4.w
mul r5.xyz, r3.yzwy, r4.wwww
movc r3.yzw, r2.wwww, r5.xxyz, r3.yyzw
mul r5.xyz, r3.zwyz, r4.zxyz
mad r5.xyz, r4.yzxy, r3.wyzw, -r5.xyzx
mul r6.xyz, r1.xyzx, r4.zxyz
mad r1.xyz, r4.yzxy, r1.yzxy, -r6.xyzx
dp3 r1.x, r2.xyzx, r1.xyzx
lt r1.x, r1.x, l(0.000000)
movc r1.x, r1.x, l(-1.000000), l(1.000000)
mul r1.x, r1.x, r3.x
mul r1.xyz, r1.xxxx, r5.xyzx
mul r1.xyz, r0.yyyy, r1.xyzx
mad r1.xyz, r0.xxxx, r3.yzwy, r1.xyzx
mad r0.xyz, r0.zzzz, r4.xyzx, r1.xyzx
dp3 r1.x, r0.xyzx, r0.xyzx
rsq r1.x, r1.x
mul o0.xyz, r0.xyzx, r1.xxxx
add r0.x, cb3[1].w, -cb3[6].y
mad r0.x, r0.w, r0.x, cb3[6].y
add r0.y, -r0.x, cb3[6].z
mad r0.x, r1.w, r0.y, r0.x
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 137 instruction slots used
