//Decals 2 second PS?
// ---- Created with 3Dmigoto v1.2.64 on Sat Sep 09 11:29:49 2017

cbuffer _Globals : register(b0)
{
  float4 _sp_screen_coord_offset : packoffset(c0);
}

SamplerState _samp0_samplerstate_s : register(s0);
SamplerState _samp3_samplerstate_s : register(s3);
Texture2D<float4> _samp0 : register(t0);
Texture2D<float4> _samp3 : register(t3);


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


void main( 
  float4 v0 : SV_Position0,
  float4 v1 : TEXCOORD7,
  float4 v2 : TEXCOORD0,
  float4 v3 : TEXCOORD3,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r10,r11,r12;
  uint4 bitmask, uiDest;
  float4 fDest;

  float4 stereo = StereoParams.Load(0);
  //v3.x+=stereo.x*(v3.w-stereo.y);
  r0.xy = v3.xy / v3.ww;
  r0.xy = r0.xy * _sp_screen_coord_offset.xy + _sp_screen_coord_offset.zw;
  r0.xyzw = _samp3.Sample(_samp3_samplerstate_s, r0.xy).xyzw;
  r0.xyzw = r0.xyzw * float4(255,255,255,255) + float4(0.5,0.5,0.5,0.5);
  r0.xyzw = floor(r0.xyzw);
  r0.x = dot(r0.xyzw, float4(256,1,0.00390625,1.52587891e-005));
  r0.x = -v3.z + r0.x;
  r0.y = cmp(1 >= r0.x);
  r1.xyzw = _samp0.Sample(_samp0_samplerstate_s, v2.xy).xyzw;
  r1.xyzw = saturate(v1.xyzw * r1.xyzw);
  r0.x = r1.w * r0.x;
  o0.w = r0.y ? r0.x : r1.w;
  o0.xyz = r1.xyz;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20789
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   float4 _sp_screen_coord_offset;    // Offset:    0 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// _samp0_samplerstate               sampler      NA          NA    0        1
// _samp3_samplerstate               sampler      NA          NA    3        1
// _samp0                            texture  float4          2d    0        1
// _samp3                            texture  float4          2d    3        1
// $Globals                          cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float       
// TEXCOORD                 7   xyzw        1     NONE   float   xyzw
// TEXCOORD                 0   xy          2     NONE   float   xy  
// TEXCOORD                 3   xyzw        3     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[1], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s3, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t3
dcl_input_ps linear v1.xyzw
dcl_input_ps linear v2.xy
dcl_input_ps linear v3.xyzw
dcl_output o0.xyzw
dcl_temps 2
div r0.xy, v3.xyxx, v3.wwww
mad r0.xy, r0.xyxx, cb0[0].xyxx, cb0[0].zwzz
sample_indexable(texture2d)(float,float,float,float) r0.xyzw, r0.xyxx, t3.xyzw, s3
mad r0.xyzw, r0.xyzw, l(255.000000, 255.000000, 255.000000, 255.000000), l(0.500000, 0.500000, 0.500000, 0.500000)
round_ni r0.xyzw, r0.xyzw
dp4 r0.x, r0.xyzw, l(256.000000, 1.000000, 0.003906, 0.000015)
add r0.x, r0.x, -v3.z
ge r0.y, l(1.000000), r0.x
sample_indexable(texture2d)(float,float,float,float) r1.xyzw, v2.xyxx, t0.xyzw, s0
mul_sat r1.xyzw, r1.xyzw, v1.xyzw
mul r0.x, r0.x, r1.w
movc o0.w, r0.y, r0.x, r1.w
mov o0.xyz, r1.xyzx
ret 
// Approximately 14 instruction slots used

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