// Objects Outlines

cbuffer g_CameraPS_CB : register(b0)
{

  struct
  {
    float4 fs_projection_params;
    float4 fs_inverse_projection_xy;
    float4 fs_customPixelClipPlane;
    float4 fs_viewportScaleBias;
    row_major float4x4 fs_invViewMtx;
  } g_CameraPS : packoffset(c0);

}

cbuffer g_MiscGroupPS_CB : register(b1)
{

  struct
  {
    float4 fs_defunct;
    float4 fs_liveCubemapReflectionPlane;
    float4 fs_viewMtx0;
    float4 fs_viewMtx1;
    float4 fs_viewMtx2;
    float4 fs_exposure;
    float4 fs_screenSize;
    float4 fs_time;
    float4 fs_random;
    float4 fs_test_values;
    float4 fs_debug;
    float4 fs_viewportSize;
    float4 fs_debug_grassLayers;
    float4 fs_defunct_4;
    float4 fs_defunct_5;
    float4 fs_defunct_6;
    float4 fs_defunct_7;
    float4 fs_defunct_8;
  } g_MiscGroupPS : packoffset(c0);

}

cbuffer g_SheenCompositeParamsPS_CB : register(b2)
{

  struct
  {
    float4 color;
    float4 scrollAxis;
    float4 params1;
  } g_SheenCompositeParamsPS : packoffset(c0);

}

SamplerState texture0_ss_s : register(s0);
SamplerState texture1_ss_s : register(s1);
Texture2D<float4> texture0 : register(t0);
Texture2D<float4> texture1 : register(t1);


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


void main(
  float4 v0 : SV_Position0,
  float4 v1 : TEXCOORD0,
  float4 v2 : TEXCOORD1,
  float4 v3 : TEXCOORD2,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.x = texture1.SampleLevel(texture1_ss_s, v1.xy, 0).x;
  r0.x = -r0.x * g_CameraPS.fs_projection_params.w + 1;
  r0.x = g_CameraPS.fs_projection_params.x / r0.x;
  r1.x = v1.w * r0.x;
  r0.yzw = g_CameraPS.fs_invViewMtx._m10_m11_m12 * r1.xxx;
  r1.x = v1.z * r0.x + g_CameraPS.fs_projection_params.z;
  
  //Fix
  float4 stereo = StereoParams.Load(0);
  r1.x -= stereo.x * (r0.x - stereo.y) * g_CameraPS.fs_inverse_projection_xy.x;
  
  r0.yzw = r1.xxx * g_CameraPS.fs_invViewMtx._m00_m01_m02 + r0.yzw;
  r0.xyz = r0.xxx * g_CameraPS.fs_invViewMtx._m20_m21_m22 + r0.yzw;
  r0.xyz = g_CameraPS.fs_invViewMtx._m30_m31_m32 + r0.xyz;
  r0.x = dot(r0.xyz, g_SheenCompositeParamsPS.scrollAxis.xyz);
  r0.x = -g_MiscGroupPS.fs_time.x * g_SheenCompositeParamsPS.params1.x + r0.x;
  r0.x = 7 * r0.x;
  r0.x = sin(r0.x);
  r0.x = r0.x * 0.5 + 0.5;
  r0.x = r0.x * r0.x;
  r0.y = r0.x * r0.x;
  r0.x = r0.x * r0.y;
  r0.y = texture0.Sample(texture0_ss_s, v1.xy).w;
  r0.y = g_SheenCompositeParamsPS.color.w * r0.y;
  o0.w = r0.y * r0.x;
  o0.xyz = g_SheenCompositeParamsPS.color.xyz;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.3.11 on Sat Jun 16 12:41:15 2018
//
//
// Buffer Definitions:
//
// cbuffer g_CameraPS_CB
// {
//
//   struct CameraPS
//   {
//
//       float4 fs_projection_params;   // Offset:    0
//       float4 fs_inverse_projection_xy;// Offset:   16
//       float4 fs_customPixelClipPlane;// Offset:   32
//       float4 fs_viewportScaleBias;   // Offset:   48
//       row_major float4x4 fs_invViewMtx;// Offset:   64
//
//   } g_CameraPS;                      // Offset:    0 Size:   128
//
// }
//
// cbuffer g_MiscGroupPS_CB
// {
//
//   struct MiscGroupPS
//   {
//
//       float4 fs_defunct;             // Offset:    0
//       float4 fs_liveCubemapReflectionPlane;// Offset:   16
//       float4 fs_viewMtx0;            // Offset:   32
//       float4 fs_viewMtx1;            // Offset:   48
//       float4 fs_viewMtx2;            // Offset:   64
//       float4 fs_exposure;            // Offset:   80
//       float4 fs_screenSize;          // Offset:   96
//       float4 fs_time;                // Offset:  112
//       float4 fs_random;              // Offset:  128
//       float4 fs_test_values;         // Offset:  144
//       float4 fs_debug;               // Offset:  160
//       float4 fs_viewportSize;        // Offset:  176
//       float4 fs_debug_grassLayers;   // Offset:  192
//       float4 fs_defunct_4;           // Offset:  208
//       float4 fs_defunct_5;           // Offset:  224
//       float4 fs_defunct_6;           // Offset:  240
//       float4 fs_defunct_7;           // Offset:  256
//       float4 fs_defunct_8;           // Offset:  272
//
//   } g_MiscGroupPS;                   // Offset:    0 Size:   288
//
// }
//
// cbuffer g_SheenCompositeParamsPS_CB
// {
//
//   struct SheenCompositeParamsPS
//   {
//
//       float4 color;                  // Offset:    0
//       float4 scrollAxis;             // Offset:   16
//       float4 params1;                // Offset:   32
//
//   } g_SheenCompositeParamsPS;        // Offset:    0 Size:    48
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// texture0_ss                       sampler      NA          NA    0        1
// texture1_ss                       sampler      NA          NA    1        1
// texture0                          texture  float4          2d    0        1
// texture1                          texture  float4          2d    1        1
// g_CameraPS_CB                     cbuffer      NA          NA    0        1
// g_MiscGroupPS_CB                  cbuffer      NA          NA    1        1
// g_SheenCompositeParamsPS_CB       cbuffer      NA          NA    2        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyzw        2     NONE   float
// TEXCOORD                 2   xyzw        3     NONE   float
//
//
// 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[8], immediateIndexed
dcl_constantbuffer cb1[8], immediateIndexed
dcl_constantbuffer cb2[3], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_input_ps linear v1.xyzw
dcl_output o0.xyzw
dcl_temps 2
sample_l_indexable(texture2d)(float,float,float,float) r0.x, v1.xyxx, t1.xyzw, s1, l(0.000000)
mad r0.x, -r0.x, cb0[0].w, l(1.000000)
div r0.x, cb0[0].x, r0.x
mul r1.x, r0.x, v1.w
mul r0.yzw, r1.xxxx, cb0[5].xxyz
mad r1.x, v1.z, r0.x, cb0[0].z
mad r0.yzw, r1.xxxx, cb0[4].xxyz, r0.yyzw
mad r0.xyz, r0.xxxx, cb0[6].xyzx, r0.yzwy
add r0.xyz, r0.xyzx, cb0[7].xyzx
dp3 r0.x, r0.xyzx, cb2[1].xyzx
mad r0.x, -cb1[7].x, cb2[2].x, r0.x
mul r0.x, r0.x, l(7.000000)
sincos r0.x, null, r0.x
mad r0.x, r0.x, l(0.500000), l(0.500000)
mul r0.x, r0.x, r0.x
mul r0.y, r0.x, r0.x
mul r0.x, r0.y, r0.x
sample_indexable(texture2d)(float,float,float,float) r0.y, v1.xyxx, t0.xwyz, s0
mul r0.y, r0.y, cb2[0].w
mul o0.w, r0.x, r0.y
mov o0.xyz, cb2[0].xyzx
ret
// Approximately 22 instruction slots used

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