//2c1f0d7347b65d5b-ps.txt
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.17672
//
//   using 3Dmigoto v1.2.27 on Thu Feb 04 21:53:25 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 [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
//   float __padding8;                  // Offset:  444 Size:     4 [unused]
//   float4 GlobalParams[16];           // Offset:  448 Size:   256
//   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
//   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
//
// }
//
// cbuffer IrradianceBuffer
// {
//
//   float4 IrradianceStateRed0;        // Offset:    0 Size:    16
//   float4 IrradianceStateRed1;        // Offset:   16 Size:    16
//   float4 IrradianceStateGreen0;      // Offset:   32 Size:    16
//   float4 IrradianceStateGreen1;      // Offset:   48 Size:    16
//   float4 IrradianceStateBlue0;       // Offset:   64 Size:    16
//   float4 IrradianceStateBlue1;       // Offset:   80 Size:    16
//   float4 IrradianceStateBase;        // Offset:   96 Size:    16
//   float4 IrradianceConstantData;     // Offset:  112 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// SamplerGenericPointClamp          sampler      NA          NA   10        1
// SamplerGenericTrilinearWrap       sampler      NA          NA   11        1
// p_default_Material_n197_n215_49EF29C0204713_cp0_Param_texture    texture  float4          2d    0        1
// p_default_Material_n195_153C28D41590713_Param_texture    texture  float4          2d    1        1
// p_default_Setup_n20_n67_NormalBufferTexture_texture    texture  float4          2d    2        1
// p_default_Material_n190_n238_661830C016465534_cp0_Param_texture    texture  float4          2d    3        1
// p_default_Setup_n13_13F634F41634182_Param_texture    texture  float4          2d    4        1
// p_default_Material_n197_n214_661830C016465534_cp0_Param_texture    texture  float4          2d    5        1
// p_default_Material_n197_n215_19B9FD0C15847118_Param_texture    texture  float4          2d    6        1
// p_default_Setup_n1_n27_Texture_texture    texture  float4          2d    7        1
// p_default_Setup_n1_n33_Texture_texture    texture  float4          2d    8        1
// p_default_Setup_n13_1B82E06410809467_Param_texture    texture  float4          2d    9        1
// DrawableBuffer                    cbuffer      NA          NA    1        1
// SceneBuffer                       cbuffer      NA          NA    2        1
// MaterialBuffer                    cbuffer      NA          NA    3        1
// IrradianceBuffer                  cbuffer      NA          NA    6        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      w
// TEXCOORD                 0   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyz         3     NONE   float   xyz 
//
//
// 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[73], immediateIndexed
dcl_constantbuffer cb2[82], immediateIndexed
dcl_constantbuffer cb3[15], immediateIndexed
dcl_constantbuffer cb6[7], immediateIndexed
dcl_sampler s10, mode_default
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) 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_resource_texture2d (float,float,float,float) t9
dcl_input_ps_siv linear noperspective v0.xyw, position
dcl_input_ps linear v1.w
dcl_input_ps linear v2.xyzw
dcl_input_ps linear v3.xyz
dcl_output o0.xyzw
// dcl_temps 10
dcl_temps 12
dcl_resource_texture2d (float,float,float,float) t125
mad r0.xy, v2.xyxx, cb3[11].xyxx, cb3[13].xyxx
sample_indexable(texture2d)(float,float,float,float) r1.xyzw, r0.xyxx, t7.xyzw, s11
sample_indexable(texture2d)(float,float,float,float) r0.xyz, r0.xyxx, t8.xyzw, s11
mul r0.xyz, r0.xyzx, cb3[0].xyzx
mad_sat r0.w, r1.w, cb3[1].w, cb3[13].z
mad r2.xy, v2.zwzz, cb3[12].xyxx, cb3[12].zwzz
sample_indexable(texture2d)(float,float,float,float) r2.z, r2.xyxx, t9.xzyw, s11
mov r2.w, l(1.000000)
mov r3.yz, r2.zzwz
add r1.w, -v1.w, l(1.000000)
mad r1.w, r1.w, l(2.000000), l(-1.000000)
add_sat r3.x, r1.w, cb3[5].w
dp3_sat r4.x, cb3[6].xyzx, r3.xyzx
min r0.w, r0.w, r4.x
add r4.x, r0.w, -cb1[2].x
mov o0.w, r0.w
min r0.w, r4.x, l(0.000000)
lt r0.w, r0.w, l(0.000000)
discard_nz r0.w
add_sat r2.y, r1.w, cb3[7].w
dp3_sat r0.w, cb3[4].xyzx, r2.yzwy
add_sat r3.x, r1.w, cb3[8].w
dp3_sat r2.y, cb3[7].xyzx, r3.xyzx
add r2.y, -r2.y, l(1.000000)
mul r2.y, r0.w, r2.y
mul r4.xyz, cb3[5].xyzx, cb3[10].wwww
mul r4.xyz, r2.yyyy, r4.xyzx
add_sat r2.x, r1.w, cb3[4].w
add_sat r3.w, r1.w, cb3[6].w
dp3_sat r1.w, cb3[10].yzxy, r3.yzwy
dp3_sat r2.x, cb3[9].xyzx, r2.xzwx
add r2.x, -r2.x, l(1.000000)
mul r0.w, r0.w, r2.x
dp3 r2.x, v3.xyzx, v3.xyzx
rsq r2.x, r2.x
mul r2.xyz, r2.xxxx, v3.yxzy
min r2.xyz, |r2.xyzx|, l(1.000000, 1.000000, 1.000000, 0.000000)
mov r3.z, v0.w
mov r3.w, l(1.000000)
mad r5.xyzw, v0.xyxy, cb2[45].zwzw, cb2[45].xyxy
mul r3.xy, r5.xyxx, v0.wwww

//Screen space correction, therefore need the '0.5'
ld_indexable(texture2d)(float,float,float,float) r11.xyzw, l(0, 0, 0, 0), t125.xyzw
add r11.w, v0.w, -r11.y
mul r11.w, r11.w, r11.x
mul r11.w, r11.w, l(0.5)
add r3.x, r3.x, -r11.w


dp4 r6.x, cb2[15].xyzw, r3.xyzw
dp4 r6.y, cb2[16].xyzw, r3.xyzw
dp4 r6.z, cb2[17].xyzw, r3.xyzw
mul r3.xyz, r6.xyzx, cb3[3].yyyy
mov r3.w, -r3.z
mad r6.xyzw, cb2[24].xxxx, cb3[11].zwzw, r3.ywxw
sample_indexable(texture2d)(float,float,float,float) r7.xyzw, r6.zwzz, t4.xyzw, s11
sample_indexable(texture2d)(float,float,float,float) r6.xyzw, r6.xyxx, t4.xyzw, s11
mul r7.xyzw, r2.xxxx, r7.xyzw
mad r6.xyzw, r6.xyzw, r2.yyyy, r7.xyzw
mul r2.xy, cb2[24].xxxx, cb3[11].zwzz
mad r2.xy, r3.xyxx, l(1.000000, -1.000000, 0.000000, 0.000000), r2.xyxx
sample_indexable(texture2d)(float,float,float,float) r3.xyzw, r2.xyxx, t4.xyzw, s11
mad r2.xyzw, r3.xyzw, r2.zzzz, r6.xyzw
mul r2.xyz, r2.xyzx, cb3[8].xyzx
mul r2.xyzw, r0.wwww, r2.xyzw
mul r2.xyz, r2.xyzx, cb3[9].wwww
mad r2.xyz, r2.xyzx, r2.wwww, r4.xyzx
add r0.w, -r1.w, l(1.000000)
mul r0.xyz, r0.xyzx, r1.wwww
mul r0.w, r0.w, cb3[2].w
mul r3.xyz, r1.xyzx, cb3[1].xyzx
mad r1.xyz, -r1.xyzx, cb3[1].xyzx, cb3[2].xyzx
mad r1.xyz, r0.wwww, r1.xyzx, r3.xyzx
sample_indexable(texture2d)(float,float,float,float) r3.xyz, r5.zwzz, t2.xyzw, s10
mul r4.xyz, r3.yyyy, cb2[40].xyzx
mad r3.xyw, r3.xxxx, cb2[39].xyxz, r4.xyxz
mad r3.xyz, r3.zzzz, cb2[41].xyzx, r3.xywx
mul r0.w, r3.y, r3.y
mad r3.w, r3.x, r3.x, -r0.w
dp4 r4.x, r3.xyzw, cb6[1].xyzw
dp4 r4.y, r3.xyzw, cb6[3].xyzw
dp4 r4.z, r3.xyzw, cb6[5].xyzw
mul r6.xyzw, r3.yzzz, r3.xxyz
dp4 r7.x, r6.xyzw, cb6[0].xyzw
dp4 r7.y, r6.xyzw, cb6[2].xyzw
dp4 r7.z, r6.xyzw, cb6[4].xyzw
add r4.xyz, r4.xyzx, r7.xyzx
add r4.xyz, r4.xyzx, cb6[6].xyzx
max r4.xyz, r4.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
add r6.xyz, cb2[27].xyzx, -cb2[38].xyzx
mad r0.w, r3.z, l(0.500000), l(0.500000)
mad r6.xyz, r0.wwww, r6.xyzx, cb2[38].xyzx
add r4.xyz, r4.xyzx, r6.xyzx
sample_indexable(texture2d)(float,float,float,float) r6.xyz, r5.zwzz, t6.xyzw, s11
add r7.xyz, r4.xyzx, r6.xyzx
sample_indexable(texture2d)(float,float,float,float) r0.w, r5.zwzz, t5.yzwx, s10
mad r4.xyz, r0.wwww, r7.xyzx, r4.xyzx
mul r7.xyz, r7.xyzx, r0.wwww
sample_indexable(texture2d)(float,float,float,float) r0.w, r5.zwzz, t3.yzwx, s10
mul r4.xyz, r0.wwww, r4.xyzx
mul r4.xyz, r4.xyzx, cb2[72].xyzx
mad r5.xy, r5.zwzz, cb2[18].xyxx, cb2[18].zwzz
sample_indexable(texture2d)(float,float,float,float) r8.xyz, r5.zwzz, t0.xyzw, s11
mul r5.xy, r5.xyxx, v0.wwww
mov r5.z, v0.w
dp3 r0.w, -r5.xyzx, -r5.xyzx
rsq r0.w, r0.w
mul r5.xyz, r0.wwww, -r5.xyzx
dp3 r9.x, r5.xyzx, cb2[0].xyzx
dp3 r9.y, r5.xyzx, cb2[1].xyzx
dp3 r9.z, r5.xyzx, cb2[2].xyzx
dp3 r0.w, r3.xyzx, r9.xyzx
add_sat r1.w, -r0.w, l(1.000000)
max r0.w, r0.w, l(1.000000012E-007)
log r1.w, r1.w
mul r1.w, r1.w, cb3[14].w
exp r1.w, r1.w
mad r4.xyz, r1.wwww, r4.xyzx, r7.xyzx
max r1.w, r8.y, r8.x
max r1.w, r8.z, r1.w
mad r1.w, r1.w, r1.w, r1.w
mul r1.w, r1.w, l(0.500000)
mul r5.xyz, r1.wwww, r6.xyzx
dp3 r1.w, r6.xyzx, l(0.299000, 0.587000, 0.114000, 0.000000)
max r1.w, r1.w, l(0.000010)
div r5.xyz, r5.xyzx, r1.wwww
dp3 r6.x, cb2[39].xyzx, r3.xyzx
dp3 r6.y, cb2[40].xyzx, r3.xyzx
mad r3.xy, r6.xyxx, l(-0.500000, -0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
sample_indexable(texture2d)(float,float,float,float) r3.xyz, r3.xyxx, t1.xyzw, s11
mul r1.w, cb3[13].w, cb3[14].y
mad r3.xyz, r1.wwww, r3.xyzx, r5.xyzx
add r1.w, -r0.w, l(1.000000)
mul r2.w, r1.w, r1.w
mul r2.w, r2.w, r2.w
mul r1.w, r1.w, r2.w
add r2.w, -cb3[14].z, l(1.000000)
add r3.w, -r2.w, l(1.000000)
mad r1.w, r3.w, r1.w, r2.w
div_sat r0.w, r1.w, r0.w
mul r3.xyz, r0.wwww, r3.xyzx
mul r0.xyz, r0.xyzx, r3.xyzx
mad r0.xyz, r1.xyzx, r4.xyzx, r0.xyzx
add r0.xyz, r2.xyzx, r0.xyzx
mul o0.xyz, r0.xyzx, cb2[29].wwww
ret 
// Approximately 138 instruction slots used
