// toggle text companion name with button or key
// ---- Created with 3Dmigoto v1.3.16 on Fri Oct 04 11:29:54 2019
Texture2D<float4> t0 : register(t0);

SamplerState s0_s : register(s0);

cbuffer cb0 : register(b0)
{
  float4 cb0[3];
}




// 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 : ORIGINAL_POSITION0,
  float4 v3 : TEXCOORD0,
  float4 v4 : TEXCOORD1,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2;
  uint4 bitmask, uiDest;
  float4 fDest;

  float4 iniParams = IniParams.Load(0);
  if (iniParams.x == 1) {discard;}

  r0.xyz = log2(v1.xyz);
  r0.xyz = cb0[0].xxx * r0.xyz;
  r1.xyz = float3(0.416666657,0.416666657,0.416666657) * r0.xyz;
  r0.xyz = exp2(r0.xyz);
  r1.xyz = exp2(r1.xyz);
  r1.xyz = r1.xyz * float3(1.05499995,1.05499995,1.05499995) + float3(-0.0549999997,-0.0549999997,-0.0549999997);
  r2.xyz = float3(12.9200001,12.9200001,12.9200001) * r0.xyz;
  r0.xyz = cmp(r0.xyz >= float3(0.00313066994,0.00313066994,0.00313066994));
  r0.xyz = r0.xyz ? r1.xyz : r2.xyz;
  r0.w = cmp(cb0[0].y != 1.000000);
  o0.xyz = r0.www ? r0.xyz : v1.xyz;
  r0.x = t0.Sample(s0_s, v4.xy).w;
  r0.x = v1.w * r0.x;
  r0.y = r0.x * -2 + 1;
  o0.w = cb0[2].x * r0.y + r0.x;
  return;
}
