//6d544cb2ca62f2dc-ps.txt
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.17672
//
//   using 3Dmigoto v1.2.27 on Fri Feb 05 21:52:51 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 [unused]
//   float4 __InstancedMaterialOpacity[256];// Offset:   48 Size:  4096
//
// }
//
// 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
//   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 [unused]
//   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 [unused]
//   float4 FogParams2;                 // Offset:  400 Size:    16
//   float4 FogParams3;                 // Offset:  416 Size:    16
//   float3 GlobalAmbient;              // Offset:  432 Size:    12 [unused]
//   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 [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
//   float4 GlobalFogColor;             // Offset: 1520 Size:    16
//   float4 VolumetricLightGlobalParams;// Offset: 1536 Size:    16
//   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_Material_n32_n54_n57_661830C016465534_cp0_Param_texture    texture  float4          2d    0        1
// p_default_Material_n43_DepthBufferTexture_texture    texture  float4          2d    1        1
// p_default_Material_n40_n79_fogCube_texture    texture  float4        cube    2        1
// p_default_Setup_n1_Texture_texture    texture  float4          2d    3        1
// AttenuationSampler_texture        texture  float4          2d   44        1
// LightAccumulation_texture         texture  float4          2d   51        1
// SpecularAccumulation_texture      texture  float4          2d   52        1
// AmbientAccumulation_texture       texture  float4          2d   53        1
// VolumetricLightIntensity_texture    texture  float4          3d   59        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
// COLOR                    0   xyzw        1     NONE   float      w
// TEXCOORD                 0   xyzw        2     NONE   float   xy  
// PSIZE                    0   x           3     NONE    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[259], dynamicIndexed
dcl_constantbuffer cb2[97], immediateIndexed
dcl_constantbuffer cb3[4], 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_texturecube (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texture2d (float,float,float,float) t44
dcl_resource_texture2d (float,float,float,float) t51
dcl_resource_texture2d (float,float,float,float) t52
dcl_resource_texture2d (float,float,float,float) t53
dcl_resource_texture3d (float,float,float,float) t59
dcl_input_ps_siv linear noperspective v0.xyw, position
dcl_input_ps linear v1.w
dcl_input_ps linear v2.xy
dcl_input_ps constant v3.x
dcl_output o0.xyzw
// dcl_temps 8
dcl_temps 10
dcl_resource_texture2d (float,float,float,float) t125
mad r0.xyzw, v0.xyxy, cb2[45].zwzw, cb2[45].xyxy
mul r1.xy, r0.zwzz, 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) r9.xyzw, l(0, 0, 0, 0), t125.xyzw
add r9.w, v0.w, -r9.y
mul r9.w, r9.w, r9.x
mul r9.w, r9.w, l(0.5)
add r1.x, r1.x, -r9.w


dp4 r2.x, cb2[15].xyzw, r1.xyzw
dp4 r2.y, cb2[16].xyzw, r1.xyzw
dp4 r2.z, cb2[17].xyzw, r1.xyzw
mul r1.xy, v2.xyxx, cb3[2].xyxx
sample_indexable(texture2d)(float,float,float,float) r1.xyzw, r1.xyxx, t3.xyzw, s11
add r0.w, cb3[3].y, l(2.000000)
mul r0.w, r0.w, l(0.010000)
mul r3.xyz, r0.wwww, cb3[0].xyzx
mul r1.xyzw, r1.xyzw, cb3[1].xyzw
mul r0.w, r1.w, v1.w
sample_indexable(texture2d)(float,float,float,float) r4.xyz, r0.xyxx, t51.xyzw, s13
sample_indexable(texture2d)(float,float,float,float) r5.xyz, r0.xyxx, t52.xyzw, s13
add r2.xyw, r2.xyxz, -cb2[10].xyxz
dp3 r1.w, r2.xywx, cb2[11].xyzx
sample_indexable(texture2d)(float,float,float,float) r3.w, r0.xyxx, t1.yzwx, s10
mad r3.w, r3.w, cb2[20].x, cb2[20].y
max r3.w, r3.w, l(0.000001)
div r3.w, l(1.000000, 1.000000, 1.000000, 1.000000), r3.w
add r1.w, r1.w, -r3.w
lt r1.w, |r1.w|, cb3[2].z
and r1.w, r1.w, l(0x3f800000)
max r0.w, r0.w, l(0.000000)
mov r3.w, v3.x
mul r0.w, r0.w, cb1[r3.w + 3].x
mul o0.w, r1.w, r0.w
ftoi r6.xy, v0.xyxx
mov r6.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r0.w, r6.xyww, t0.yzwx
add r1.w, cb3[2].w, cb3[3].x
add_sat r1.w, -r1.w, l(1.000000)
mul r3.w, r0.w, r0.w
mad r0.w, cb3[2].w, r0.w, r1.w
mad_sat r0.w, r3.w, cb3[3].x, r0.w
add r7.xyz, -cb2[94].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
mad_sat r7.xyz, r0.wwww, r7.xyzx, cb2[94].xyzx
mul r5.xyz, r5.xyzx, r7.xyzx
ld_indexable(texture2d)(float,float,float,float) r6.xyz, r6.xyzw, t53.xyzw
add r4.xyz, r4.xyzx, r6.xyzx
mul r4.xyz, r4.xyzx, r7.xyzx
mul r3.xyz, r3.xyzx, r5.xyzx
mad r1.xyz, r4.xyzx, r1.xyzx, r3.xyzx
max r1.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
eq r0.w, cb2[95].w, l(0.000000)
movc r3.xyz, r0.wwww, cb2[95].xyzx, cb2[35].xyzx
max r3.xyz, r3.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
log r3.xyz, r3.xyzx
mul r3.xyz, r3.xyzx, cb2[26].yyyy
exp r3.xyz, r3.xyzx
mad r4.x, r2.z, cb2[9].y, cb2[25].y
mov r4.yw, cb2[25].zzzz
sample_l_indexable(texture2d)(float,float,float,float) r0.w, r4.xyxx, t44.xzwy, s13, l(0.000000)
dp3 r1.w, r2.xywx, r2.xywx
sqrt r1.w, r1.w
lt r2.z, l(0.000000), cb2[26].w
if_nz r2.z
  mul r4.xy, r2.xyxx, cb2[9].wwww
  mad r5.x, cb2[25].w, r2.y, r4.x
  mad r5.y, -cb2[25].w, r2.x, r4.y
  mov r5.z, r2.w
  sample_indexable(texturecube)(float,float,float,float) r2.xyz, r5.xyzx, t2.xyzw, s11
  add r2.xyz, r2.xyzx, -cb2[95].xyzx
  mad r2.xyz, cb2[26].wwww, r2.xyzx, cb2[95].xyzx
else 
  mov r2.xyz, cb2[95].xyzx
endif 
max r2.xyz, r2.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
log r2.xyz, r2.xyzx
mul r2.xyz, r2.xyzx, cb2[26].yyyy
exp r2.xyz, r2.xyzx
mad r4.z, r1.w, cb2[9].x, cb2[25].x
sample_l_indexable(texture2d)(float,float,float,float) r1.w, r4.zwzz, t44.yzwx, s13, l(0.000000)
mad r2.xyz, cb2[26].xxxx, r2.xyzx, -r1.xyzx
mad r1.xyz, r1.wwww, r2.xyzx, r1.xyzx
mad r2.xyz, cb2[26].xxxx, r3.xyzx, -r1.xyzx
mad r1.xyz, r0.wwww, r2.xyzx, r1.xyzx
div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), cb2[20].y
add r0.w, -r0.w, v0.w
rcp r1.w, cb2[96].x
mul r0.w, r0.w, r1.w
rsq r0.w, |r0.w|
div r0.z, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
mov_sat r0.xyz, r0.xyzx
mad r0.xyz, r0.xyzx, l(1.000000, 1.000000, 0.984375, 0.000000), l(0.000000, 0.000000, -0.0117187500, 0.000000)
sample_l_indexable(texture3d)(float,float,float,float) r0.xyz, r0.xyzx, t59.xyzw, s13, l(0.000000)
add o0.xyz, r0.xyzx, r1.xyzx
ret 
// Approximately 90 instruction slots used
