//DMC3 proper shadows.
// ---- Created with 3Dmigoto v1.3.7 on Sun Mar 25 14:23:12 2018

cbuffer VS_CONSTANT_BUFFER : register(b0)
{
  float4 sdwColor : packoffset(c0);
  float4 screenScale : packoffset(c1);
  float4 screenOffset : packoffset(c2);
}



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


void main(
  float3 v0 : POSITION0,
  out float4 o0 : SV_POSITION0,
  out float2 o1 : TEXCOORD0,
  out float4 o2 : COLOR1,
  out float4 o3 : COLOR0)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;

  float4 stereo = StereoParams.Load(0);
  float4 iniparams = IniParams.Load(0);
  float4 iniparams1 = IniParams.Load(int2(1,0));
  float4 iniparams3 = IniParams.Load(int2(3,0));
  
  r0.xyz = v0.xyz;
  r0.w = 1;
  r1.xyzw = screenScale.xyzw * r0.xyzw;
  r0.xyzw = screenOffset.xyzw * r0.wwww;
  r0.xyzw = r1.xyzw + r0.xyzw;
  r0.y = -r0.y;
  r1.xy = float2(0,0);
  r2.xyzw = sdwColor.xyzw;
  r3.xyzw = float4(0,0,0,1);
  o0.xzw = r0.xzw;
  o0.y = r0.y;
  if (r0.z<0.999999 && r0.z>0.00001)
  {
	o0.x+=stereo.x;
	r0.z = -r0.z * r0.w + r0.w;
	r0.z=r0.w-r0.z;
	o0.x-=stereo.x*r0.z*stereo.y;
  }
  o2.xyzw = r3.xyzw;
  o3.xyzw = r2.xyzw;
  o1.xy = r1.xy;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.7 on Sun Mar 25 14:23:12 2018
//
//
// Buffer Definitions:
//
// cbuffer VS_CONSTANT_BUFFER
// {
//
//   float4 sdwColor;                   // Offset:    0 Size:    16
//   float4 screenScale;                // Offset:   16 Size:    16
//   float4 screenOffset;               // Offset:   32 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// VS_CONSTANT_BUFFER                cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyz         0     NONE   float   xyz
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xy          1     NONE   float   xy
// COLOR                    1   xyzw        2     NONE   float   xyzw
// COLOR                    0   xyzw        3     NONE   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed | skipOptimization
dcl_constantbuffer cb0[3], immediateIndexed
dcl_input v0.xyz
dcl_output_siv o0.xyzw, position
dcl_output o1.xy
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_temps 4
//
// Initial variable locations:
//   v0.x <- vi.position.x; v0.y <- vi.position.y; v0.z <- vi.position.z;
//   o3.x <- <main return value>.oColor.x; o3.y <- <main return value>.oColor.y; o3.z <- <main return value>.oColor.z; o3.w <- <main return value>.oColor.w;
//   o2.x <- <main return value>.oFogCol.x; o2.y <- <main return value>.oFogCol.y; o2.z <- <main return value>.oFogCol.z; o2.w <- <main return value>.oFogCol.w;
//   o1.x <- <main return value>.oTexcoord.x; o1.y <- <main return value>.oTexcoord.y;
//   o0.x <- <main return value>.oPosition.x; o0.y <- <main return value>.oPosition.y; o0.z <- <main return value>.oPosition.z; o0.w <- <main return value>.oPosition.w
//
#line 25 "C:\dev\dmc\dmc3\code\dmc3\source\dmc3nb\shaders\hlsl\vs\DMC3_SHW.hlsl"
mov r0.xyz, v0.xyzx  // r0.x <- pos.x; r0.y <- pos.y; r0.z <- pos.z
mov r0.w, l(1.000000)  // r0.w <- pos.w
mul r1.xyzw, r0.xyzw, cb0[1].xyzw
mul r0.xyzw, r0.wwww, cb0[2].xyzw
add r0.xyzw, r0.xyzw, r1.xyzw  // r0.x <- vo.oPosition.x; r0.y <- vo.oPosition.y; r0.z <- vo.oPosition.z; r0.w <- vo.oPosition.w
mov r0.y, -r0.y
mov r1.xy, l(0,0,0,0)  // r1.x <- vo.oTexcoord.x; r1.y <- vo.oTexcoord.y
mov r2.xyzw, cb0[0].xyzw  // r2.x <- vo.oColor.x; r2.y <- vo.oColor.y; r2.z <- vo.oColor.z; r2.w <- vo.oColor.w
mov r3.xyzw, l(0,0,0,1.000000)  // r3.x <- vo.oFogCol.x; r3.y <- vo.oFogCol.y; r3.z <- vo.oFogCol.z; r3.w <- vo.oFogCol.w

#line 36
mov o0.xzw, r0.xxzw
mov o0.y, r0.y
mov o2.xyzw, r3.xyzw
mov o3.xyzw, r2.xyzw
mov o1.xy, r1.xyxx
ret
// Approximately 15 instruction slots used

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