//Geometry 2.
// ---- Created with 3Dmigoto v1.3.11 on Sun Sep 02 21:27:19 2018

cbuffer ProjParameters : register(b2)
{
  row_major float4x4 _mxView : packoffset(c0);
  row_major float4x4 _mxProj : packoffset(c4);
}



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


void main(
  float3 v0 : SV_Position0,
  float3 v1 : NORMAL0,
  float2 v2 : TEXCOORD0,
  float4 v3 : COLOR0,
  out float4 o0 : SV_Position0,
  out float4 o1 : TEXCOORD0,
  out float3 o2 : TEXCOORD1,
  out float4 o3 : COLOR0)
{
  float4 r0;
  uint4 bitmask, uiDest;
  float4 fDest;

  float4 res = StereoParams.Load(int3(2,0,0));
  float4 iniparams = IniParams.Load(0);
  float4 iniparams5 = IniParams.Load(int2(5,0));
  float4 iniparams7 = IniParams.Load(int2(7,0));
  
  if (res.x==0 && res.y==0)
  {
	res.x=iniparams7.x;
	res.y=iniparams7.y;
  }
  
  float ar = (4.0/3.0)/(res.x/res.y);
  if (iniparams.w!=0)
  {
	ar = iniparams.w;
  }
  
  r0.xyzw = _mxProj._m10_m11_m12_m13 * v0.yyyy;
  r0.xyzw = v0.xxxx * _mxProj._m00_m01_m02_m03 + r0.xyzw;
  r0.xyzw = v0.zzzz * _mxProj._m20_m21_m22_m23 + r0.xyzw;
  o0.xyzw = _mxProj._m30_m31_m32_m33 + r0.xyzw;
  o0.x+=iniparams5.x*500;
  o0.y+=iniparams5.y*500;
  //o0.x=o0.x*iniparams.w*iniparams.z;
  o0.x=o0.x*ar*iniparams.z;
  o0.y=o0.y*iniparams.z;
  o1.xy = v2.xy;
  o2.xyz = v0.xyz;
  r0.xyzw = v3.xyzw + v3.xyzw;
  o3.xyzw = min(float4(1,1,1,1), r0.xyzw);
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.11 on Sun Sep 02 21:27:19 2018
//
//
// Buffer Definitions:
//
// cbuffer ProjParameters
// {
//
//   row_major float4x4 _mxView;        // Offset:    0 Size:    64 [unused]
//   row_major float4x4 _mxProj;        // Offset:   64 Size:    64
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// ProjParameters                    cbuffer      NA          NA    2        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyz         0     NONE   float   xyz
// NORMAL                   0   xyz         1     NONE   float
// TEXCOORD                 0   xy          2     NONE   float   xy
// COLOR                    0   xyzw        3     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xy          1     NONE   float   xy
// TEXCOORD                 1   xyz         2     NONE   float   xyz
// COLOR                    0   xyzw        3     NONE   float   xyzw
//
vs_4_0
dcl_constantbuffer cb2[8], immediateIndexed
dcl_input v0.xyz
dcl_input v2.xy
dcl_input v3.xyzw
dcl_output_siv o0.xyzw, position
dcl_output o1.xy
dcl_output o2.xyz
dcl_output o3.xyzw
dcl_temps 1
mul r0.xyzw, v0.yyyy, cb2[5].xyzw
mad r0.xyzw, v0.xxxx, cb2[4].xyzw, r0.xyzw
mad r0.xyzw, v0.zzzz, cb2[6].xyzw, r0.xyzw
add o0.xyzw, r0.xyzw, cb2[7].xyzw
mov o1.xy, v2.xyxx
mov o2.xyz, v0.xyzx
add r0.xyzw, v3.xyzw, v3.xyzw
min o3.xyzw, r0.xyzw, l(1.000000, 1.000000, 1.000000, 1.000000)
ret
// Approximately 9 instruction slots used

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