// ---- Created with 3Dmigoto v1.2.57 on Thu Jul 27 13:32:56 2017

cbuffer _Globals : register(b0)
{
  float4 specColor : packoffset(c0);
  float4 ControlData : packoffset(c1);
  float4 difColor : packoffset(c2);
  float4 ambient : packoffset(c3);
  float4 lightCount : packoffset(c4);
  float4 g_avLightPos : packoffset(c5);
  float4 g_avLightColor : packoffset(c6);
  float4 g_avConeDir : packoffset(c7);
  float4 g_vAmbientSettings : packoffset(c8);

  struct
  {
    float4 vDesc;
    float4 vFogLayerPlane;
    float4 vFogLayerColor;
    float4 vFogLayerSettings;
    float4 vFogColor;
    float4 vFogDistance;
  } g_FogDesc : packoffset(c9);

  float4 g_vDitherSettings : packoffset(c15);
  float4 g_vKSettings : packoffset(c16);
  float4x4 g_mPrevObjViewProj : packoffset(c17);
  float4 LightPos0 : packoffset(c21);
  float4x4 g_mViewProj : packoffset(c22);
  float4 Settings : packoffset(c26) = {0.5,10,0,0};
  float4 TexScale : packoffset(c27);
  float4 Gray : packoffset(c28);
  float4 GrayColor : packoffset(c29) = {1,1,1,1};
}



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


void main( 
  float4 v0 : SV_Position0,
  float4 v1 : COLOR0,
  float4 v2 : COLOR1,
  float2 v3 : TEXCOORD0,
  float2 w3 : TEXCOORD1,
  float2 v4 : TEXCOORD2,
  float2 w4 : TEXCOORD3,
  float4 v5 : TEXCOORD4,
  float4 v6 : TEXCOORD5,
  float3 v7 : TEXCOORD6,
  out float4 o0 : SV_Target0,
  out float4 o1 : SV_Target1,
  out float4 o2 : SV_Target2)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.x = cmp(g_vKSettings.x < 0.5);
  if (r0.x != 0) {
    r0.xy = float2(0,0);
  } else {
    r1.xyz = v7.xyz;
    r1.w = 1;
    r2.x = dot(r1.xyzw, g_mViewProj._m00_m10_m20_m30);
    r2.y = dot(r1.xyzw, g_mViewProj._m01_m11_m21_m31);
    r0.w = dot(r1.xyzw, g_mViewProj._m03_m13_m23_m33);
    r2.xy = r2.xy / r0.ww;
    r3.x = dot(r1.xyzw, g_mPrevObjViewProj._m00_m10_m20_m30);
    r3.y = dot(r1.xyzw, g_mPrevObjViewProj._m01_m11_m21_m31);
    r0.w = dot(r1.xyzw, g_mPrevObjViewProj._m03_m13_m23_m33);
    r1.xy = r3.xy / r0.ww;
    r0.xz = r2.xy + -r1.xy;
    r0.y = g_vKSettings.y * -r0.z;
    r0.z = dot(r0.xy, r0.xy);
    r0.z = sqrt(r0.z);
    r0.w = cmp(2 < r0.z);
    if (r0.w != 0) {
      r0.z = 2 / r0.z;
      r0.xy = r0.xy * r0.zz;
    }
  }
  o0.xyzw = float4(0,0,0,0);
  o1.xyzw = float4(0,0,0,0);
  o2.xy = r0.xy;
  o2.zw = float2(0,0);
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.57 on Thu Jul 27 13:32:56 2017
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   float4 specColor;                  // Offset:    0 Size:    16 [unused]
//   float4 ControlData;                // Offset:   16 Size:    16 [unused]
//   float4 difColor;                   // Offset:   32 Size:    16 [unused]
//   float4 ambient;                    // Offset:   48 Size:    16 [unused]
//   float4 lightCount;                 // Offset:   64 Size:    16 [unused]
//   float4 g_avLightPos;               // Offset:   80 Size:    16 [unused]
//   float4 g_avLightColor;             // Offset:   96 Size:    16 [unused]
//   float4 g_avConeDir;                // Offset:  112 Size:    16 [unused]
//   float4 g_vAmbientSettings;         // Offset:  128 Size:    16 [unused]
//   
//   struct
//   {
//       
//       float4 vDesc;                  // Offset:  144
//       float4 vFogLayerPlane;         // Offset:  160
//       float4 vFogLayerColor;         // Offset:  176
//       float4 vFogLayerSettings;      // Offset:  192
//       float4 vFogColor;              // Offset:  208
//       float4 vFogDistance;           // Offset:  224
//
//   } g_FogDesc;                       // Offset:  144 Size:    96 [unused]
//   float4 g_vDitherSettings;          // Offset:  240 Size:    16 [unused]
//   float4 g_vKSettings;               // Offset:  256 Size:    16
//   float4x4 g_mPrevObjViewProj;       // Offset:  272 Size:    64
//   float4 LightPos0;                  // Offset:  336 Size:    16 [unused]
//   float4x4 g_mViewProj;              // Offset:  352 Size:    64
//   float4 Settings;                   // Offset:  416 Size:    16 [unused]
//      = 0x3f000000 0x41200000 0x00000000 0x00000000 
//   float4 TexScale;                   // Offset:  432 Size:    16 [unused]
//   float4 Gray;                       // Offset:  448 Size:    16 [unused]
//   float4 GrayColor;                  // Offset:  464 Size:    16 [unused]
//      = 0x3f800000 0x3f800000 0x3f800000 0x3f800000 
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// $Globals                          cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float       
// COLOR                    0   xyzw        1     NONE   float       
// COLOR                    1   xyzw        2     NONE   float       
// TEXCOORD                 0   xy          3     NONE   float       
// TEXCOORD                 1     zw        3     NONE   float       
// TEXCOORD                 2   xy          4     NONE   float       
// TEXCOORD                 3     zw        4     NONE   float       
// TEXCOORD                 4   xyz         5     NONE   float       
// TEXCOORD                 5   xyzw        6     NONE   float       
// TEXCOORD                 6   xyz         7     NONE   float   xyz 
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
// SV_Target                1   xyzw        1   TARGET   float   xyzw
// SV_Target                2   xyzw        2   TARGET   float   xyzw
//
ps_4_0
dcl_constantbuffer cb0[26], immediateIndexed
dcl_input_ps linear v7.xyz
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_temps 4
lt r0.x, cb0[16].x, l(0.500000)
if_nz r0.x
  mov r0.xy, l(0,0,0,0)
else 
  mov r1.xyz, v7.xyzx
  mov r1.w, l(1.000000)
  dp4 r2.x, r1.xyzw, cb0[22].xyzw
  dp4 r2.y, r1.xyzw, cb0[23].xyzw
  dp4 r0.w, r1.xyzw, cb0[25].xyzw
  div r2.xy, r2.xyxx, r0.wwww
  dp4 r3.x, r1.xyzw, cb0[17].xyzw
  dp4 r3.y, r1.xyzw, cb0[18].xyzw
  dp4 r0.w, r1.xyzw, cb0[20].xyzw
  div r1.xy, r3.xyxx, r0.wwww
  add r0.xz, -r1.xxyx, r2.xxyx
  mul r0.y, -r0.z, cb0[16].y
  dp2 r0.z, r0.xyxx, r0.xyxx
  sqrt r0.z, r0.z
  lt r0.w, l(2.000000), r0.z
  if_nz r0.w
    div r0.z, l(2.000000), r0.z
    mul r0.xy, r0.zzzz, r0.xyxx
  endif 
endif 
mov o0.xyzw, l(0,0,0,0)
mov o1.xyzw, l(0,0,0,0)
mov o2.xy, r0.xyxx
mov o2.zw, l(0,0,0,0)
ret 
// Approximately 29 instruction slots used

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