//haloes from light shafts
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.11 on Sun Jun 24 18:37:25 2018
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
//   bool PhyreMaterialSwitches;        // Offset:    0 Size:     4 [unused]
//   bool PhyreContextSwitches;         // Offset:    4 Size:     4 [unused]
//   float DepthScale;                  // Offset:    8 Size:     4 [unused]
//      = 0x3f800000
//   float4x4 World;                    // Offset:   16 Size:    64
//   float4 UVOffsetScaleRot;           // Offset:   80 Size:    16 [unused]
//      = 0x00000000 0x00000000 0x3f800000 0x00000000
//   float4 DiffuseTint;                // Offset:   96 Size:    16 [unused]
//      = 0x3f800000 0x3f800000 0x3f800000 0x3f800000
//   float AlphaScale;                  // Offset:  112 Size:     4 [unused]
//      = 0x3f800000
//
// }
//
// cbuffer SceneWideParameterConstantBuffer
// {
//
//   float4x4 ViewProjection;           // Offset:    0 Size:    64
//   float4x4 ViewProjectionPrev;       // Offset:   64 Size:    64 [unused]
//   float4x4 View;                     // Offset:  128 Size:    64 [unused]
//   float4x4 Projection;               // Offset:  192 Size:    64 [unused]
//   float4x4 ViewInverse;              // Offset:  256 Size:    64 [unused]
//   float4x4 ProjInverse;              // Offset:  320 Size:    64 [unused]
//   float3 EyePosition;                // Offset:  384 Size:    12 [unused]
//   float cameraNearTimesFar;          // Offset:  396 Size:     4 [unused]
//   float cameraFarMinusNear;          // Offset:  400 Size:     4 [unused]
//   float time;                        // Offset:  404 Size:     4 [unused]
//   float2 cameraNearFar;              // Offset:  408 Size:     8 [unused]
//   float2 ViewportWidthHeight;        // Offset:  416 Size:     8 [unused]
//   float2 screenWidthHeightInv;       // Offset:  424 Size:     8 [unused]
//   float2 screenWidthHeight;          // Offset:  432 Size:     8 [unused]
//   float2 ProjectionJitter;           // Offset:  440 Size:     8 [unused]
//   float2 ProjectionJitterPrev;       // Offset:  448 Size:     8 [unused]
//   uint checkerBoardID;               // Offset:  456 Size:     4 [unused]
//   float m_pad;                       // Offset:  460 Size:     4 [unused]
//   uint PointLightCount;              // Offset:  464 Size:     4 [unused]
//   uint SpotLightCount;               // Offset:  468 Size:     4 [unused]
//   uint FoliageSpheresCount;          // Offset:  472 Size:     4 [unused]
//   uint m_padExtra;                   // Offset:  476 Size:     4 [unused]
//   float4 FogParameters0;             // Offset:  480 Size:    16 [unused]
//   float4 FogParameters1;             // Offset:  496 Size:    16 [unused]
//   float4 FogParameters2;             // Offset:  512 Size:    16 [unused]
//   float4 FogParameters3;             // Offset:  528 Size:    16 [unused]
//   float4 FogPlanes;                  // Offset:  544 Size:    16 [unused]
//   float3 CubeSunDir;                 // Offset:  560 Size:    12 [unused]
//   float CamExposure;                 // Offset:  572 Size:     4 [unused]
//   float3 CubeSunColor;               // Offset:  576 Size:    12 [unused]
//   float padding1;                    // Offset:  588 Size:     4 [unused]
//   float2 WindDirection;              // Offset:  592 Size:     8 [unused]
//   float2 CubeFadeValues;             // Offset:  600 Size:     8 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// $Globals                          cbuffer      NA          NA    0        1
// SceneWideParameterConstantBuffer    cbuffer      NA          NA    1        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyz         0     NONE   float   xyz
// TEXCOORD                 0   xy          1     NONE   float   xy
// COLOR                    0   xyzw        2     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xy          1     NONE   float   xy
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyzw        3     NONE   float   xyzw
//
vs_4_0

// Declare stereoparams & iniparams
dcl_resource_texture2d (float,float,float,float) t125
dcl_resource_texture1d (float,float,float,float) t120

dcl_constantbuffer cb0[4], immediateIndexed
dcl_constantbuffer cb1[4], immediateIndexed
dcl_input v0.xyz
dcl_input v1.xy
dcl_input v2.xyzw
dcl_output_siv o0.xyzw, position
dcl_output o1.xy
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_temps 6
mov r0.xyz, v0.xyzx
mov r0.w, l(1.000000)
dp4 r1.x, r0.xyzw, cb0[1].xyzw
dp4 r1.y, r0.xyzw, cb0[2].xyzw
dp4 r1.z, r0.xyzw, cb0[3].xyzw
mov r1.w, l(1.000000)
dp4 r0.x, r1.xyzw, cb1[0].xyzw
dp4 r0.y, r1.xyzw, cb1[1].xyzw
dp4 r0.z, r1.xyzw, cb1[2].xyzw
dp4 r0.w, r1.xyzw, cb1[3].xyzw
mov o0.xyzw, r0.xyzw
mov o2.xyzw, r0.xyzw

//Fix position, remove halos
mov r0.xyzw, o2.xyzw
ld_indexable(texture2d)(float,float,float,float) r1.xyzw, l(0, 0, 0, 0), t125.xyzw
add r1.w, r0.w, -r1.y
mul r1.w, r1.w, r1.x
add r0.x, r0.x, r1.w
mov o2.xyzw, r0.xyzw


mov o1.xy, v1.xyxx
mov o3.xyzw, v2.xyzw
ret
