//Halo light smoke
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);

cbuffer cb4 : register(b4)
{
  float4 cb4[276];
}

void main(
  float4 v0 : POSITION0,
  float4 v1 : COLOR0,
  float4 v2 : TEXCOORD0,
  out float4 o0 : SV_POSITION0,
  out float4 o1 : TEXCOORD8,
  out float4 o2 : COLOR0,
  out float4 o3 : COLOR1,
  out float4 o4 : TEXCOORD9,
  out float4 o5 : TEXCOORD0,
  out float4 o6 : TEXCOORD1,
  out float4 o7 : TEXCOORD2,
  out float4 o8 : TEXCOORD3,
  out float4 o9 : TEXCOORD4,
  out float4 o10 : TEXCOORD5,
  out float4 o11 : TEXCOORD6,
  out float4 o12 : TEXCOORD7)
{
  float4 r0, r1, r2, r3;
  
float4 s = StereoParams.Load(0);  

  o2.xyzw = cb4[28].xyzw * v1.xyzw;
  r1.xyzw = cb4[21].xyzw * v0.yyyy;
  r1.xyzw = cb4[20].xyzw * v0.xxxx + r1.xyzw;
  r1.xyzw = cb4[22].xyzw * v0.zzzz + r1.xyzw;
  r1.xyzw = cb4[23].xyzw * v0.wwww + r1.xyzw;
  
o0.xyzw = r1.xyzw;  
r1.x += s.x * (r1.w - s.y);   

  r2.xy = r1.xy * float2(1, -1) + r1.ww;
  r2.zw = cb4[31].xy * r1.ww;
  o6.xy = r2.xy * 0.5 + r2.zw;
  o7.x = cb4[30].x * r1.z;

  r2.xyz = cb4[25].xyz * v0.yyy;
  r2.xyz = cb4[24].xyz * v0.xxx + r2.xyz;
  r2.xyz = cb4[26].xyz * v0.zzz + r2.xyz;
  r2.xyz = cb4[27].xyz * v0.www + r2.xyz;

  r2.x = dot(r2.xyz, r2.xyz);

  // rsqrt(abs(x)), protegido contra INF
  r3.y = rsqrt(abs(r2.x));
  r3.x = (int)r3.y == 0x7f800000;
  r2.x = r3.x ? 3.402823466e+38 : r3.y;

  // rcp, protegido contra INF
  r3.y = rcp(r2.x);
  r3.x = (int)r3.y & 0x7fffffff;
  r3.x = (int)r3.x == 0x7f800000;
  r2.x = r3.x ? 3.402823466e+38 : r3.y;

  r2.x = cb4[29].x * r2.x;
  r2.x = exp2(r2.x);

  // rcp final -> o4.x
  r3.y = rcp(r2.x);
  r3.x = (int)r3.y & 0x7fffffff;
  r3.x = (int)r3.x == 0x7f800000;
  o4.x = r3.x ? 3.402823466e+38 : r3.y;

  r0.xyzw = r1.xyzw;
  o6.zw  = r1.zw;
  o5.xy  = v2.xy;
//  o0.xyzw = r0.xyzw;
  o1.xyzw = r0.xyzw;
  o3.xyzw = float4(0, 0, 0, 1);
  o4.yzw  = float3(0, 0, 0);
  o5.zw   = float2(0, 1);
  o7.yzw  = float3(0, 0, 1);
  o8.xyzw  = float4(0, 0, 0, 1);
  o9.xyzw  = float4(0, 0, 0, 1);
  o10.xyzw = float4(0, 0, 0, 1);
  o11.xyzw = float4(0, 0, 0, 1);
  o12.xyzw = float4(0, 0, 0, 1);
}