// ---- Created with 3Dmigoto v1.2.39 on Wed Jun 22 10:29:20 2016

cbuffer _Globals : register(b0)
{
  float4x4 LocalToWorld : packoffset(c0);
  float4x4 ScreenToWorldMatrix : packoffset(c4);
  bool bDecompressSceneColor : packoffset(c8);
  float4 PackedParameters : packoffset(c9);
  float4 MinMaxBlurClamp : packoffset(c10);
  float4 LightColorAndFalloffExponent : packoffset(c11);
  float3 DistanceFieldParameters : packoffset(c12);
  float4x4 ScreenToShadowMatrix : packoffset(c13);
  float4 ShadowBufferAndTexelSize : packoffset(c17);
  float ShadowOverrideFactor : packoffset(c18);
  float SSSMultiplier : packoffset(c18.y);
  bool bReceiveDynamicShadows : packoffset(c18.z);
  bool bEnableDistanceShadowFading : packoffset(c18.w);
  float2 DistanceFadeParameters : packoffset(c19);
  float4 IBLPositionAndWeight0 : packoffset(c20);
  float4 IBLPositionAndWeight1 : packoffset(c21);
  float4 IBLPositionAndWeight2 : packoffset(c22);
  float4 IBLPositionAndWeight3 : packoffset(c23);
  float4x4 IBLProxyOBB0 : packoffset(c24);
  float4x4 IBLProxyOBB1 : packoffset(c28);
  float4x4 IBLProxyOBB2 : packoffset(c32);
  float4 IBLUseProxyVolume : packoffset(c36);
  float4x4 IBLLastProxyOBB0 : packoffset(c37);
  float4x4 IBLLastProxyOBB1 : packoffset(c41);
  float4x4 IBLLastProxyOBB2 : packoffset(c45);
  float4 IBLUseLastProxyVolume : packoffset(c49);
  float ForcedIBLWeight : packoffset(c50);
  float AdditionalReflections : packoffset(c50.y);
  float4x4 InvViewProjectionMatrix : packoffset(c51);
  float3 CameraWorldPos : packoffset(c55);
  float3 ActorWorldPos : packoffset(c56);
  float4 ObjectWorldPositionAndRadius : packoffset(c57);
  float3 ObjectOrientation : packoffset(c58);
  float3 ObjectPostProjectionPosition : packoffset(c59);
  float3 ObjectNDCPosition : packoffset(c60);
  float4 ObjectMacroUVScales : packoffset(c61);
  float3 FoliageImpulseDirection : packoffset(c62);
  float4 FoliageNormalizedRotationAxisAndAngle : packoffset(c63);
  float4 WindDirectionAndSpeed : packoffset(c64);
  float3x3 LocalToWorldMatrix : packoffset(c65);
  float3x3 WorldToLocalMatrix : packoffset(c68);
  float3x3 WorldToViewMatrix : packoffset(c71);
  float3x3 ViewToWorldMatrix : packoffset(c74);
  float4 UniformPixelVector_0 : packoffset(c77);
  float4 UniformPixelVector_1 : packoffset(c78);
  float4 UniformPixelVector_2 : packoffset(c79);
  float4 UniformPixelVector_3 : packoffset(c80);
  float4 UniformPixelVector_4 : packoffset(c81);
  float4 UniformPixelVector_5 : packoffset(c82);
  float4 UniformPixelVector_6 : packoffset(c83);
  float4 UniformPixelVector_7 : packoffset(c84);
  float4 UniformPixelVector_8 : packoffset(c85);
  float4 UniformPixelVector_9 : packoffset(c86);
  float4 UniformPixelVector_10 : packoffset(c87);
  float4 UniformPixelVector_11 : packoffset(c88);
  float4 UniformPixelScalars_0 : packoffset(c89);
  float4 UniformPixelScalars_1 : packoffset(c90);
  float4 UniformPixelScalars_2 : packoffset(c91);
  float4 UniformPixelScalars_3 : packoffset(c92);
  float4 UniformPixelScalars_4 : packoffset(c93);
  float4 UniformPixelScalars_5 : packoffset(c94);
  float4 UniformPixelScalars_6 : packoffset(c95);
  float4 UniformPixelScalars_7 : packoffset(c96);
  float3 TemporalAAParameters : packoffset(c97);
  float4x4 PreviousLocalToWorld : packoffset(c98);
  float LocalToWorldRotDeterminantFlip : packoffset(c102);
  float3x3 WorldToLocal : packoffset(c103);
  float4 LightmapCoordinateScaleBias : packoffset(c106);
  float4 ShadowmapCoordinateScaleBias : packoffset(c107);
}

cbuffer VSOffsetConstants : register(b1)
{
  float4x4 ViewProjectionMatrix : packoffset(c0);
  float4 CameraPositionVS : packoffset(c4);
  float4 PreViewTranslation : packoffset(c5);
}

cbuffer PSOffsetConstants : register(b2)
{
  float4 ScreenPositionScaleBias : packoffset(c0);
  float4 MinZ_MaxZRatio : packoffset(c1);
  float NvStereoEnabled : packoffset(c2);
  float4 DiffuseOverrideParameter : packoffset(c3);
  float4 SpecularOverrideParameter : packoffset(c4);
  float4 CameraPositionPS : packoffset(c5);
  float4 ScreenAndTexelSize : packoffset(c6);
}

SamplerState SceneDepthTextureSampler_s : register(s0);
SamplerState PixelTexture2D_0Sampler_s : register(s1);
SamplerState PixelTexture2D_1Sampler_s : register(s2);
SamplerState PixelTexture2D_2Sampler_s : register(s3);
Texture2D<float4> SceneDepthTexture : register(t0);
Texture2D<float4> PixelTexture2D_0 : register(t1);
Texture2D<float4> PixelTexture2D_1 : register(t2);
Texture2D<float4> PixelTexture2D_2 : register(t3);


// 3Dmigoto declarations
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);


void main( 
  float4 v0 : TEXCOORD10,
  float4 v1 : TEXCOORD11,
  float4 v2 : COLOR0,
  float4 v3 : TEXCOORD0,
  float4 v4 : TEXCOORD5,
  float4 v5 : TEXCOORD6,
  uint v6 : SV_IsFrontFace0,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xy = UniformPixelScalars_1.xx * v3.xy + UniformPixelVector_1.xy;
  r0.xy = PixelTexture2D_0.SampleBias(PixelTexture2D_0Sampler_s, r0.xy, 0).xy;
  r0.zw = UniformPixelScalars_2.zz * v3.xy + UniformPixelVector_2.xy;
  r0.zw = PixelTexture2D_1.SampleBias(PixelTexture2D_1Sampler_s, r0.zw, 0).xy;
  r0.xyzw = r0.xyxy + r0.zwzw;
  r1.xy = UniformPixelScalars_4.yy * v3.xy + UniformPixelVector_3.xy;
  r1.xy = PixelTexture2D_2.SampleBias(PixelTexture2D_2Sampler_s, r1.xy, 0).xy;
  r0.xyzw = r1.xyxy + r0.xyzw;
  r0.xyzw = UniformPixelVector_11.xyxy * r0.xyzw;
  r1.x = dot(r0.zw, r0.zw);
  r1.x = -0.100000001 + r1.x;
  r1.x = cmp(r1.x < 0);
  if (r1.x != 0) discard;
  r1.xyz = ViewProjectionMatrix._m01_m11_m31 * v4.yyy;
  r1.xyz = ViewProjectionMatrix._m00_m10_m30 * v4.xxx + r1.xyz;
  r1.xyz = ViewProjectionMatrix._m02_m12_m32 * v4.zzz + r1.xyz;
  r1.xyz = ViewProjectionMatrix._m03_m13_m33 * v4.www + r1.xyz;

float4 stereo = StereoParams.Load(0);
r1.x += stereo.x*(r1.z - stereo.y);

  r1.xy = r1.xy / r1.zz;
  r1.xy = r1.xy * ScreenPositionScaleBias.xy + ScreenPositionScaleBias.wz;
  r0.xy = r0.xy * float2(0.00392156886,-0.00392156886) + r1.xy;
  r0.zw = float2(4,4) * r0.zw;
  r0.zw = max(float2(-255,-255), r0.zw);
  r0.zw = min(float2(255,255), r0.zw);
  r0.zw = float2(0.00392156886,0.00392156886) * r0.zw;
  r0.x = SceneDepthTexture.SampleLevel(SceneDepthTextureSampler_s, r0.xy, 0).x;
  r0.x = min(0.999000013, r0.x);
  r0.x = r0.x * MinZ_MaxZRatio.z + -MinZ_MaxZRatio.w;
  r0.x = 1 / r0.x;
  r0.x = cmp(r1.z >= r0.x);
  r0.xy = r0.xx ? float2(0,0) : r0.zw;
  o0.xy = max(float2(0,0), r0.xy);
  r0.xy = min(float2(0,0), r0.xy);
  o0.zw = -r0.xy;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.39 on Wed Jun 22 10:29:20 2016
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   float4x4 LocalToWorld;             // Offset:    0 Size:    64 [unused]
//   float4x4 ScreenToWorldMatrix;      // Offset:   64 Size:    64 [unused]
//   bool bDecompressSceneColor;        // Offset:  128 Size:     4 [unused]
//   float4 PackedParameters;           // Offset:  144 Size:    16 [unused]
//   float4 MinMaxBlurClamp;            // Offset:  160 Size:    16 [unused]
//   float4 LightColorAndFalloffExponent;// Offset:  176 Size:    16 [unused]
//   float3 DistanceFieldParameters;    // Offset:  192 Size:    12 [unused]
//   float4x4 ScreenToShadowMatrix;     // Offset:  208 Size:    64 [unused]
//   float4 ShadowBufferAndTexelSize;   // Offset:  272 Size:    16 [unused]
//   float ShadowOverrideFactor;        // Offset:  288 Size:     4 [unused]
//   float SSSMultiplier;               // Offset:  292 Size:     4 [unused]
//   bool bReceiveDynamicShadows;       // Offset:  296 Size:     4 [unused]
//   bool bEnableDistanceShadowFading;  // Offset:  300 Size:     4 [unused]
//   float2 DistanceFadeParameters;     // Offset:  304 Size:     8 [unused]
//   float4 IBLPositionAndWeight0;      // Offset:  320 Size:    16 [unused]
//   float4 IBLPositionAndWeight1;      // Offset:  336 Size:    16 [unused]
//   float4 IBLPositionAndWeight2;      // Offset:  352 Size:    16 [unused]
//   float4 IBLPositionAndWeight3;      // Offset:  368 Size:    16 [unused]
//   float4x4 IBLProxyOBB0;             // Offset:  384 Size:    64 [unused]
//   float4x4 IBLProxyOBB1;             // Offset:  448 Size:    64 [unused]
//   float4x4 IBLProxyOBB2;             // Offset:  512 Size:    64 [unused]
//   float4 IBLUseProxyVolume;          // Offset:  576 Size:    16 [unused]
//   float4x4 IBLLastProxyOBB0;         // Offset:  592 Size:    64 [unused]
//   float4x4 IBLLastProxyOBB1;         // Offset:  656 Size:    64 [unused]
//   float4x4 IBLLastProxyOBB2;         // Offset:  720 Size:    64 [unused]
//   float4 IBLUseLastProxyVolume;      // Offset:  784 Size:    16 [unused]
//   float ForcedIBLWeight;             // Offset:  800 Size:     4 [unused]
//   float AdditionalReflections;       // Offset:  804 Size:     4 [unused]
//   float4x4 InvViewProjectionMatrix;  // Offset:  816 Size:    64 [unused]
//   float3 CameraWorldPos;             // Offset:  880 Size:    12 [unused]
//   float3 ActorWorldPos;              // Offset:  896 Size:    12 [unused]
//   float4 ObjectWorldPositionAndRadius;// Offset:  912 Size:    16 [unused]
//   float3 ObjectOrientation;          // Offset:  928 Size:    12 [unused]
//   float3 ObjectPostProjectionPosition;// Offset:  944 Size:    12 [unused]
//   float3 ObjectNDCPosition;          // Offset:  960 Size:    12 [unused]
//   float4 ObjectMacroUVScales;        // Offset:  976 Size:    16 [unused]
//   float3 FoliageImpulseDirection;    // Offset:  992 Size:    12 [unused]
//   float4 FoliageNormalizedRotationAxisAndAngle;// Offset: 1008 Size:    16 [unused]
//   float4 WindDirectionAndSpeed;      // Offset: 1024 Size:    16 [unused]
//   float3x3 LocalToWorldMatrix;       // Offset: 1040 Size:    44 [unused]
//   float3x3 WorldToLocalMatrix;       // Offset: 1088 Size:    44 [unused]
//   float3x3 WorldToViewMatrix;        // Offset: 1136 Size:    44 [unused]
//   float3x3 ViewToWorldMatrix;        // Offset: 1184 Size:    44 [unused]
//   float4 UniformPixelVector_0;       // Offset: 1232 Size:    16 [unused]
//   float4 UniformPixelVector_1;       // Offset: 1248 Size:    16
//   float4 UniformPixelVector_2;       // Offset: 1264 Size:    16
//   float4 UniformPixelVector_3;       // Offset: 1280 Size:    16
//   float4 UniformPixelVector_4;       // Offset: 1296 Size:    16 [unused]
//   float4 UniformPixelVector_5;       // Offset: 1312 Size:    16 [unused]
//   float4 UniformPixelVector_6;       // Offset: 1328 Size:    16 [unused]
//   float4 UniformPixelVector_7;       // Offset: 1344 Size:    16 [unused]
//   float4 UniformPixelVector_8;       // Offset: 1360 Size:    16 [unused]
//   float4 UniformPixelVector_9;       // Offset: 1376 Size:    16 [unused]
//   float4 UniformPixelVector_10;      // Offset: 1392 Size:    16 [unused]
//   float4 UniformPixelVector_11;      // Offset: 1408 Size:    16
//   float4 UniformPixelScalars_0;      // Offset: 1424 Size:    16 [unused]
//   float4 UniformPixelScalars_1;      // Offset: 1440 Size:    16
//   float4 UniformPixelScalars_2;      // Offset: 1456 Size:    16
//   float4 UniformPixelScalars_3;      // Offset: 1472 Size:    16 [unused]
//   float4 UniformPixelScalars_4;      // Offset: 1488 Size:    16
//   float4 UniformPixelScalars_5;      // Offset: 1504 Size:    16 [unused]
//   float4 UniformPixelScalars_6;      // Offset: 1520 Size:    16 [unused]
//   float4 UniformPixelScalars_7;      // Offset: 1536 Size:    16 [unused]
//   float3 TemporalAAParameters;       // Offset: 1552 Size:    12 [unused]
//   float4x4 PreviousLocalToWorld;     // Offset: 1568 Size:    64 [unused]
//   float LocalToWorldRotDeterminantFlip;// Offset: 1632 Size:     4 [unused]
//   float3x3 WorldToLocal;             // Offset: 1648 Size:    44 [unused]
//   float4 LightmapCoordinateScaleBias;// Offset: 1696 Size:    16 [unused]
//   float4 ShadowmapCoordinateScaleBias;// Offset: 1712 Size:    16 [unused]
//
// }
//
// cbuffer VSOffsetConstants
// {
//
//   float4x4 ViewProjectionMatrix;     // Offset:    0 Size:    64
//   float4 CameraPositionVS;           // Offset:   64 Size:    16 [unused]
//   float4 PreViewTranslation;         // Offset:   80 Size:    16 [unused]
//
// }
//
// cbuffer PSOffsetConstants
// {
//
//   float4 ScreenPositionScaleBias;    // Offset:    0 Size:    16
//   float4 MinZ_MaxZRatio;             // Offset:   16 Size:    16
//   float NvStereoEnabled;             // Offset:   32 Size:     4 [unused]
//   float4 DiffuseOverrideParameter;   // Offset:   48 Size:    16 [unused]
//   float4 SpecularOverrideParameter;  // Offset:   64 Size:    16 [unused]
//   float4 CameraPositionPS;           // Offset:   80 Size:    16 [unused]
//   float4 ScreenAndTexelSize;         // Offset:   96 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// SceneDepthTextureSampler          sampler      NA          NA    0        1
// PixelTexture2D_0Sampler           sampler      NA          NA    1        1
// PixelTexture2D_1Sampler           sampler      NA          NA    2        1
// PixelTexture2D_2Sampler           sampler      NA          NA    3        1
// SceneDepthTexture                 texture  float4          2d    0        1
// PixelTexture2D_0                  texture  float4          2d    1        1
// PixelTexture2D_1                  texture  float4          2d    2        1
// PixelTexture2D_2                  texture  float4          2d    3        1
// $Globals                          cbuffer      NA          NA    0        1
// VSOffsetConstants                 cbuffer      NA          NA    1        1
// PSOffsetConstants                 cbuffer      NA          NA    2        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                10   xyzw        0     NONE   float       
// TEXCOORD                11   xyzw        1     NONE   float       
// COLOR                    0   xyzw        2     NONE   float       
// TEXCOORD                 0   xyzw        3     NONE   float   xy  
// TEXCOORD                 5   xyzw        4     NONE   float   xyzw
// TEXCOORD                 6   xyzw        5     NONE   float       
// SV_IsFrontFace           0   x           6    FFACE    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 cb0[94], immediateIndexed
dcl_constantbuffer cb1[4], immediateIndexed
dcl_constantbuffer cb2[2], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, 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_input_ps linear v3.xy
dcl_input_ps linear v4.xyzw
dcl_output o0.xyzw
dcl_temps 2
mad r0.xy, cb0[90].xxxx, v3.xyxx, cb0[78].xyxx
sample_b_indexable(texture2d)(float,float,float,float) r0.xy, r0.xyxx, t1.xyzw, s1, l(0.000000)
mad r0.zw, cb0[91].zzzz, v3.xxxy, cb0[79].xxxy
sample_b_indexable(texture2d)(float,float,float,float) r0.zw, r0.zwzz, t2.zwxy, s2, l(0.000000)
add r0.xyzw, r0.zwzw, r0.xyxy
mad r1.xy, cb0[93].yyyy, v3.xyxx, cb0[80].xyxx
sample_b_indexable(texture2d)(float,float,float,float) r1.xy, r1.xyxx, t3.xyzw, s3, l(0.000000)
add r0.xyzw, r0.xyzw, r1.xyxy
mul r0.xyzw, r0.xyzw, cb0[88].xyxy
dp2 r1.x, r0.zwzz, r0.zwzz
add r1.x, r1.x, l(-0.100000)
lt r1.x, r1.x, l(0.000000)
discard_nz r1.x
mul r1.xyz, v4.yyyy, cb1[1].xywx
mad r1.xyz, cb1[0].xywx, v4.xxxx, r1.xyzx
mad r1.xyz, cb1[2].xywx, v4.zzzz, r1.xyzx
mad r1.xyz, cb1[3].xywx, v4.wwww, r1.xyzx
div r1.xy, r1.xyxx, r1.zzzz
mad r1.xy, r1.xyxx, cb2[0].xyxx, cb2[0].wzww
mad r0.xy, r0.xyxx, l(0.00392156886, -0.00392156886, 0.000000, 0.000000), r1.xyxx
mul r0.zw, r0.zzzw, l(0.000000, 0.000000, 4.000000, 4.000000)
max r0.zw, r0.zzzw, l(0.000000, 0.000000, -255.000000, -255.000000)
min r0.zw, r0.zzzw, l(0.000000, 0.000000, 255.000000, 255.000000)
mul r0.zw, r0.zzzw, l(0.000000, 0.000000, 0.00392156886, 0.00392156886)
sample_l_indexable(texture2d)(float,float,float,float) r0.x, r0.xyxx, t0.xyzw, s0, l(0.000000)
min r0.x, r0.x, l(0.999000)
mad r0.x, r0.x, cb2[1].z, -cb2[1].w
div r0.x, l(1.000000, 1.000000, 1.000000, 1.000000), r0.x
ge r0.x, r1.z, r0.x
movc r0.xy, r0.xxxx, l(0,0,0,0), r0.zwzz
max o0.xy, r0.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000)
min r0.xy, r0.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000)
mov o0.zw, -r0.xxxy
ret 
// Approximately 34 instruction slots used

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
