//21f100973cdba142-ps.txt
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.17672
//
//   using 3Dmigoto v1.2.27 on Fri Jan 29 08:58:53 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 [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 [unused]
//   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_8CD6AD409878073_cp6_Param_texture    texture  float4          2d    0        1
// p_default_Setup_n4_1BB3530022408697_cp0_Param_texture    texture  float4          2d    1        1
// p_default_Setup_6724402023250908_cp0_Param_texture    texture  float4          2d    2        1
// p_default_Setup_n4_9075B4F026705685_cp2_Param_texture    texture  float4          2d    3        1
// p_default_Setup_n5_9075B4F026705685_cp2_Param_texture    texture  float4          2d    5        1
// p_default_Setup_n4_n69_Texture_texture    texture  float4          2d    6        1
// p_default_Setup_n3_n69_Texture_texture    texture  float4          2d    7        1
// p_default_Setup_n5_1BB3530022408697_cp0_Param_texture    texture  float4          2d    8        1
// p_default_Setup_n3_1BB3530022408697_cp0_Param_texture    texture  float4          2d    9        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[11], immediateIndexed
dcl_sampler s11, 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) 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_resource_texture2d (float,float,float,float) t9
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 7
dcl_temps 9
dcl_resource_texture2d (float,float,float,float) t125
deriv_rty_fine r0.xy, v1.xyxx
deriv_rtx_fine r1.xy, v1.xyxx
mul r0.x, r0.x, r1.y
mad r0.x, r1.x, r0.y, -r0.x
mov r0.z, -r1.y
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 r0.yz, r0.yyzy, r0.wwww
mad r1.xy, v0.xyxx, cb2[45].zwzz, cb2[45].xyxx
mul r1.xy, r1.xyxx, v0.wwww
mov r1.z, v0.w
mov r1.w, l(1.000000)

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


dp4 r2.x, cb2[15].xyzw, r1.xyzw
deriv_rtx_fine r2.z, r2.x
dp4 r2.w, cb2[16].xyzw, r1.xyzw
dp4 r1.x, cb2[17].xyzw, r1.xyzw
deriv_rty_fine r3.xy, r2.xwxx
deriv_rtx_fine r2.x, r2.w
deriv_rty_fine r3.z, r1.x
deriv_rtx_fine r2.y, r1.x
dp3 r1.x, v2.xyzx, v2.xyzx
rsq r1.x, r1.x
mul r1.yzw, r1.xxxx, v2.xxyz
dp3 r2.w, r3.xyzx, r1.yzwy
mad r3.xyz, -r2.wwww, r1.yzwy, r3.xyzx
mul r4.xyz, r0.zzzz, r3.xyzx
dp3 r0.z, r2.zxyz, r1.yzwy
mad r2.xyz, -r0.zzzz, r1.zwyz, r2.xyzx
mad r4.xyz, r2.zxyz, r0.yyyy, r4.xyzx
dp3 r0.y, r4.xyzx, r4.xyzx
rsq r0.y, r0.y
mul r5.xyz, r0.yyyy, r4.xyzx
movc r0.xyz, r0.xxxx, r5.xyzx, r4.xyzx
mul r4.xyz, r0.yzxy, r1.wyzw
mad r4.xyz, r1.zwyz, r0.zxyz, -r4.xyzx
mul r5.xyz, r1.wyzw, r2.xyzx
mad r1.yzw, r1.zzwy, r2.yyzx, -r5.xxyz
dp3 r1.y, r3.xyzx, r1.yzwy
lt r1.y, r1.y, l(0.000000)
movc r1.y, r1.y, l(-1.000000), l(1.000000)
mul r0.w, r0.w, r1.y
mul r1.yzw, r0.wwww, r4.xxyz
mul r2.xy, v1.xyxx, cb3[3].zwzz
sample_indexable(texture2d)(float,float,float,float) r2.xy, r2.xyxx, t8.xyzw, s11
mad r2.xy, r2.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
mad r0.w, -r2.x, r2.x, l(1.000000)
mad r0.w, -r2.y, r2.y, r0.w
mul r2.zw, r2.xxxy, r2.xxxy
max r2.z, r2.w, r2.z
mul r2.z, r2.z, l(0.0000610351563)
max r0.w, r0.w, r2.z
rsq r0.w, r0.w
mul r2.xy, r2.xyxx, -r0.wwww
mul r3.xyzw, v1.xyxy, cb3[2].xyzw
sample_indexable(texture2d)(float,float,float,float) r2.zw, r3.xyxx, t1.zwxy, s11
sample_indexable(texture2d)(float,float,float,float) r3.y, r3.zwzz, t5.yxzw, s11
mad r2.zw, r2.zzzw, l(0.000000, 0.000000, 2.000000, 2.000000), l(0.000000, 0.000000, -1.000000, -1.000000)
mad r0.w, -r2.z, r2.z, l(1.000000)
mad r0.w, -r2.w, r2.w, r0.w
mul r4.xy, r2.zwzz, r2.zwzz
max r3.w, r4.y, r4.x
mul r3.w, r3.w, l(0.0000610351563)
max r0.w, r0.w, r3.w
rsq r0.w, r0.w
mul r2.zw, r2.zzzw, -r0.wwww
mul r4.xyzw, v1.xyxy, cb3[5].xyzw
sample_indexable(texture2d)(float,float,float,float) r4.xy, r4.xyxx, t9.xyzw, s11
sample_indexable(texture2d)(float,float,float,float) r5.y, r4.zwzz, t3.yxzw, s11
mad r4.xy, r4.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
mad r0.w, -r4.x, r4.x, l(1.000000)
mad r0.w, -r4.y, r4.y, r0.w
mul r4.zw, r4.xxxy, r4.xxxy
max r3.w, r4.w, r4.z
mul r3.w, r3.w, l(0.0000610351563)
max r0.w, r0.w, r3.w
rsq r0.w, r0.w
mul r4.xy, r4.xyxx, -r0.wwww
mul r4.xy, r4.xyxx, cb3[9].zzzz
add_sat r0.w, cb3[8].w, cb3[9].x
mul r4.xy, r4.xyxx, r0.wwww
mad r2.zw, r2.zzzw, cb3[7].xxxx, -r4.xxxy
mov r5.z, l(1.000000)
mul r6.xyzw, v1.xyxy, cb3[6].xyzw
sample_indexable(texture2d)(float,float,float,float) r4.zw, r6.xyxx, t0.zwxy, s11
sample_indexable(texture2d)(float,float,float,float) r3.w, r6.zwzz, t7.xzwy, s11
mad_sat r5.x, r4.z, cb3[1].w, cb3[0].w
mad_sat r3.x, r4.w, cb3[7].w, cb3[8].x
dp3_sat r4.z, cb3[1].xyzx, r5.xyzx
mad r2.zw, r4.zzzz, r2.zzzw, r4.xxxy
mad r2.xy, r2.xyxx, cb3[7].zzzz, -r2.zwzz
mov r3.z, l(1.000000)
dp3_sat r3.x, cb3[0].xyzx, r3.xyzx
mad r2.xy, r3.xxxx, r2.xyxx, r2.zwzz
mul r5.xyzw, v1.xyxy, cb3[4].zwxy
mad r2.zw, cb2[24].xxxx, cb3[3].xxxy, r5.zzzw
sample_indexable(texture2d)(float,float,float,float) r3.y, r5.xyxx, t6.xyzw, s11
sample_indexable(texture2d)(float,float,float,float) r2.zw, r2.zwzz, t2.zwxy, s11
mad r2.zw, r2.zzzw, l(0.000000, 0.000000, 2.000000, 2.000000), l(0.000000, 0.000000, -1.000000, -1.000000)
mad r3.z, -r2.z, r2.z, l(1.000000)
mad r3.z, -r2.w, r2.w, r3.z
mul r4.xy, r2.zwzz, r2.zwzz
max r4.x, r4.y, r4.x
mul r4.x, r4.x, l(0.0000610351563)
max r3.z, r3.z, r4.x
rsq r3.z, r3.z
mul r2.zw, r2.zzzw, -r3.zzzz
mad r2.xy, r2.zwzz, cb3[9].yyyy, r2.xyxx
mul r1.yzw, r1.yyzw, r2.yyyy
mad r0.xyz, r2.xxxx, r0.xyzx, r1.yzwy
mad r0.xyz, v2.xyzx, r1.xxxx, -r0.xyzx
dp3 r1.x, r0.xyzx, r0.xyzx
rsq r1.x, r1.x
mul o0.xyz, r0.xyzx, r1.xxxx
add r0.x, cb3[9].w, -cb3[10].x
mad r0.x, r3.w, r0.x, cb3[10].x
add r0.x, r0.x, l(-1.000000)
mad r0.x, r0.w, r0.x, l(1.000000)
add r0.y, -cb3[8].z, cb3[8].y
mad r0.y, r3.y, r0.y, cb3[8].z
add r0.y, -r0.x, r0.y
mad r0.x, r4.z, r0.y, r0.x
add r0.y, -r0.x, cb3[7].y
mad r0.x, r3.x, 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 130 instruction slots used
