//65618774a3f7f39c-ps.txt
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.17672
//
//   using 3Dmigoto v1.2.27 on Thu Feb 04 21:50:07 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
//
// }
//
// 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 [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 [unused]
//   float4 FogParams2;                 // Offset:  400 Size:    16
//   float4 FogParams3;                 // Offset:  416 Size:    16
//   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 [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
//   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 InstanceBuffer
// {
//
//   struct InstanceStruct
//   {
//       
//       float4 InstanceParams[8];      // Offset:    0
//
//   } InstanceParameters[256];         // Offset:    0 Size: 32768
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// SamplerGenericTrilinearWrap       sampler      NA          NA   11        1
// SamplerGenericBilinearClamp       sampler      NA          NA   13        1
// p_default_Material_n30_n70_fogCube_texture    texture  float4        cube    0        1
// p_default_Material_n25_n38_Texture_texture    texture  float4          2d    1        1
// AttenuationSampler_texture        texture  float4          2d   44        1
// DrawableBuffer                    cbuffer      NA          NA    1        1
// SceneBuffer                       cbuffer      NA          NA    2        1
// MaterialBuffer                    cbuffer      NA          NA    3        1
// InstanceBuffer                    cbuffer      NA          NA    5        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   xyzw
// 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[96], immediateIndexed
dcl_constantbuffer cb3[1], immediateIndexed
dcl_constantbuffer cb5[2041], dynamicIndexed
dcl_sampler s11, mode_default
dcl_sampler s13, mode_default
dcl_resource_texturecube (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t44
dcl_input_ps_siv linear noperspective v0.xyw, position
dcl_input_ps linear v1.xyzw
dcl_input_ps linear v2.xy
dcl_input_ps constant v3.x
dcl_output o0.xyzw
// dcl_temps 5
dcl_temps 7
dcl_resource_texture2d (float,float,float,float) t125
mad r0.xy, v0.xyxx, cb2[45].zwzz, cb2[45].xyxx
mul r0.xy, r0.xyxx, v0.wwww
mov r0.z, v0.w
mov r0.w, l(1.000000)

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


dp4 r1.x, cb2[15].xyzw, r0.xyzw
dp4 r1.y, cb2[16].xyzw, r0.xyzw
dp4 r1.z, cb2[17].xyzw, r0.xyzw
mul r0.xyz, cb2[27].xyzx, cb3[0].zzzz
ishl r0.w, v3.x, l(3)
mul r2.xyz, v1.xyzx, cb5[r0.w + 0].xxxx
dp3 r0.w, l(0.300000, 0.590000, 0.110000, 0.000000), r0.xyzx
mad r3.xyz, -cb3[0].zzzz, cb2[27].xyzx, r0.wwww
mad r0.xyz, cb3[0].xxxx, r3.xyzx, r0.xyzx
sample_indexable(texture2d)(float,float,float,float) r3.xyz, v2.xyxx, t1.xyzw, s11
dp3 r0.w, r3.xyzx, l(0.299000, 0.587000, 0.114000, 0.000000)
mul r0.w, r0.w, v1.w
mul r0.xyz, r2.xyzx, r0.xyzx
add r1.w, -cb3[0].y, l(1.000000)
mul r0.xyz, r0.xyzx, r1.wwww
mad r0.xyz, r2.xyzx, cb3[0].yyyy, r0.xyzx
mad r0.xyz, cb3[0].zzzz, cb2[27].xyzx, r0.xyzx
max r1.w, r0.z, l(1.000000)
max r2.x, r0.y, r0.x
max r1.w, r1.w, r2.x
div r1.w, l(1.000000, 1.000000, 1.000000, 1.000000), r1.w
mul r0.xyz, r0.xyzx, r1.wwww
eq r1.w, cb2[95].w, l(0.000000)
movc r2.xyz, r1.wwww, cb2[95].xyzx, cb2[35].xyzx
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
add r1.xyw, r1.xyxz, -cb2[10].xyxz
mad r3.x, r1.z, cb2[9].y, cb2[25].y
mov r3.yw, cb2[25].zzzz
sample_l_indexable(texture2d)(float,float,float,float) r1.z, r3.xyxx, t44.xzyw, s13, l(0.000000)
dp3 r2.w, r1.xywx, r1.xywx
sqrt r2.w, r2.w
lt r3.x, l(0.000000), cb2[26].w
if_nz r3.x
  mul r3.xy, r1.xyxx, cb2[9].wwww
  mad r4.x, cb2[25].w, r1.y, r3.x
  mad r4.y, -cb2[25].w, r1.x, r3.y
  mov r4.z, r1.w
  sample_indexable(texturecube)(float,float,float,float) r1.xyw, r4.xyzx, t0.xywz, s11
  add r1.xyw, r1.xyxw, -cb2[95].xyxz
  mad r1.xyw, cb2[26].wwww, r1.xyxw, cb2[95].xyxz
else 
  mov r1.xyw, cb2[95].xyxz
endif 
max r1.xyw, r1.xyxw, l(0.000000, 0.000000, 0.000000, 0.000000)
log r1.xyw, r1.xyxw
mul r1.xyw, r1.xyxw, cb2[26].yyyy
exp r1.xyw, r1.xyxw
mad r3.z, r2.w, cb2[9].x, cb2[25].x
sample_l_indexable(texture2d)(float,float,float,float) r2.w, r3.zwzz, t44.yzwx, s13, l(0.000000)
mad r1.xyw, cb2[26].xxxx, r1.xyxw, -r0.xyxz
mad r0.xyz, r2.wwww, r1.xywx, r0.xyzx
mad r1.xyw, cb2[26].xxxx, r2.xyxz, -r0.xyxz
mad r0.xyz, r1.zzzz, r1.xywx, r0.xyzx
mul o0.xyz, r0.xyzx, cb2[29].wwww
mov r0.x, v3.x
mul r0.y, r0.w, cb1[r0.x + 3].x
mad r0.x, r0.w, cb1[r0.x + 3].x, -cb1[2].x
min r0.x, r0.x, l(0.000000)
lt r0.x, r0.x, l(0.000000)
discard_nz r0.x
mov o0.w, r0.y
ret 
// Approximately 69 instruction slots used
