// UI - Main menu background

// ---- Created with 3Dmigoto v1.3.15 on Wed Mar 13 17:40:29 2019

cbuffer _Globals : register(b0)
{
  float4 texIdx : packoffset(c0);
  float4 cDiff : packoffset(c1);
  float4 cAmb : packoffset(c2);
  float4 vDiffSrc : packoffset(c3);
  row_major float4x4 mW2P : packoffset(c4);
  float4 mL2W[192] : packoffset(c8);
  bool IsEnableGammaCorrection : packoffset(c200);
  float Gamma : packoffset(c200.y);
}



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


void main(
  float4 v0 : POSITION0,
  float4 v1 : COLOR0,
  float4 v2 : TEXCOORD0,
  float4 v3 : TEXCOORD1,
  float4 v4 : TEXCOORD2,
  float2 v5 : TEXCOORD3,
  float v6 : BLENDWEIGHT0,
  out float4 o0 : SV_Position0,
  out float4 o1 : TEXCOORD0,
  out float4 o2 : TEXCOORD1,
  out float4 o3 : TEXCOORD2)
{
  float4 r0,r1;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.x = (int)v6.x;
  r0.y = (int)r0.x * 3;
  r0.xz = mad((int2)r0.xx, int2(3,3), int2(1,2));
  r0.y = dot(v0.xyzw, mL2W[r0.y].xyzw);
  r0.x = dot(v0.xyzw, mL2W[r0.x].xyzw);
  r0.z = dot(v0.xyzw, mL2W[r0.z].xyzw);
  r1.xyzw = mW2P._m10_m11_m12_m13 * r0.xxxx;
  r1.xyzw = r0.yyyy * mW2P._m00_m01_m02_m03 + r1.xyzw;
  r0.xyzw = r0.zzzz * mW2P._m20_m21_m22_m23 + r1.xyzw;
  o0.xyzw = v0.wwww * mW2P._m30_m31_m32_m33 + r0.xyzw;
  r0.xyzw = v1.xyzw * vDiffSrc.xxxx + vDiffSrc.wwww;
  r0.xyzw = cDiff.xyzw * r0.xyzw;
  r0.xyzw = cAmb.xyzw * r0.xyzw;
  r1.xyz = log2(abs(r0.xyz));
  r1.xyz = IsEnableGammaCorrection * r1.xyz;
  r1.xyz = exp2(r1.xyz);
  o1.xyz = IsEnableGammaCorrection ? r1.xyz : r0.xyz;
  o1.w = r0.w;
  r0.xyzw = cmp(float4(0,0,0,0) < texIdx.xyzw);
  o2.xyzw = r0.xxyy ? v3.xyyx : v2.xyyx;
  r0.xyzw = r0.zzww ? v3.xyyx : v2.xyyx;
  r1.xyzw = cmp(float4(1,1,2,2) < texIdx.zwzw);
  r0.xyzw = r1.xxyy ? v4.xyyx : r0.xyzw;
  o3.xyzw = r1.zzww ? v5.xyyx : r0.xyzw;

float filter = IniParams[0].z;
if (filter == 37001) {
	float4 s = StereoParams.Load(0);
	float depth = IniParams[0].y;
	o0.x += s.x * depth * o0.w;
	// Stretch to remove black bars:
	o0.x *= (1 + abs(s.x) * depth);
}

  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.15 on Wed Mar 13 17:40:29 2019
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
//   float4 texIdx;                     // Offset:    0 Size:    16
//   float4 cDiff;                      // Offset:   16 Size:    16
//   float4 cAmb;                       // Offset:   32 Size:    16
//   float4 vDiffSrc;                   // Offset:   48 Size:    16
//   row_major float4x4 mW2P;           // Offset:   64 Size:    64
//   float4 mL2W[192];                  // Offset:  128 Size:  3072
//   bool IsEnableGammaCorrection;      // Offset: 3200 Size:     4
//   float Gamma;                       // Offset: 3204 Size:     4
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// $Globals                          cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// COLOR                    0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 0   xy          2     NONE   float   xy
// TEXCOORD                 1   xy          3     NONE   float   xy
// TEXCOORD                 2   xy          4     NONE   float   xy
// TEXCOORD                 3   xy          5     NONE   float   xy
// BLENDWEIGHT              0   x           6     NONE   float   x
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyzw        3     NONE   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[201], dynamicIndexed
dcl_input v0.xyzw
dcl_input v1.xyzw
dcl_input v2.xy
dcl_input v3.xy
dcl_input v4.xy
dcl_input v5.xy
dcl_input v6.x
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_temps 2
ftoi r0.x, v6.x
imul null, r0.y, r0.x, l(3)
imad r0.xz, r0.xxxx, l(3, 0, 3, 0), l(1, 0, 2, 0)
dp4 r0.y, v0.xyzw, cb0[r0.y + 8].xyzw
dp4 r0.x, v0.xyzw, cb0[r0.x + 8].xyzw
dp4 r0.z, v0.xyzw, cb0[r0.z + 8].xyzw
mul r1.xyzw, r0.xxxx, cb0[5].xyzw
mad r1.xyzw, r0.yyyy, cb0[4].xyzw, r1.xyzw
mad r0.xyzw, r0.zzzz, cb0[6].xyzw, r1.xyzw
mad o0.xyzw, v0.wwww, cb0[7].xyzw, r0.xyzw
mad r0.xyzw, v1.xyzw, cb0[3].xxxx, cb0[3].wwww
mul r0.xyzw, r0.xyzw, cb0[1].xyzw
mul r0.xyzw, r0.xyzw, cb0[2].xyzw
log r1.xyz, |r0.xyzx|
mul r1.xyz, r1.xyzx, cb0[200].yyyy
exp r1.xyz, r1.xyzx
movc o1.xyz, cb0[200].xxxx, r1.xyzx, r0.xyzx
mov o1.w, r0.w
lt r0.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000), cb0[0].xyzw
movc o2.xyzw, r0.xxyy, v3.xyyx, v2.xyyx
movc r0.xyzw, r0.zzww, v3.xyyx, v2.xyyx
lt r1.xyzw, l(1.000000, 1.000000, 2.000000, 2.000000), cb0[0].zwzw
movc r0.xyzw, r1.xxyy, v4.xyyx, r0.xyzw
movc o3.xyzw, r1.zzww, v5.xyyx, r0.xyzw
ret
// Approximately 25 instruction slots used

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