// Velocity buffer from camera movement (AO smearing while moving forwards / backwards)
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.31 on Wed Mar 02 08:07:07 2016
//
//
// Buffer Definitions: 
//
// cbuffer CTemporalEffectsProvider
// {
//
//   float4x4 CurrentToPrevMatrix;      // Offset:    0 Size:    64
//   float4 JitterParameters;           // Offset:   64 Size:    16 [unused]
//   float4 SceneTextureSize;           // Offset:   80 Size:    16
//   float4 TemporalParameters;         // Offset:   96 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// DepthTexture                      texture   float          2d    0        1
// MotionVectorsTexture              texture  float2          2d    1        1
// outMotionVectorTexture                UAV  float2          2d    0        1
// CTemporalEffectsProvider          cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// no Input
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// no Output
cs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[6], immediateIndexed
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_uav_typed_texture2d (float,float,float,float) u0
dcl_input vThreadID.xy
dcl_temps 4
dcl_thread_group 8, 8, 1

dcl_resource_texture2d (float,float,float,float) t125

ld_indexable(texture2d)(float,float,float,float) r3.xyzw, l(0, 0, 0, 0), t125.xyzw

utof r0.xy, vThreadID.xyxx
mul r0.xy, r0.xyxx, cb0[5].zwzz
mad r0.xy, r0.xyxx, l(2.000000, -2.000000, 0.000000, 0.000000), l(-1.000000, 1.000000, 0.000000, 0.000000)
mov r1.xy, vThreadID.xyxx
mov r1.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r0.z, r1.xyzw, t0.yzxw
ld_indexable(texture2d)(float,float,float,float) r1.xy, r1.xyww, t1.xyzw
mov r0.w, l(1.000000)
dp4 r1.z, r0.xyzw, cb0[3].xyzw
rcp r1.z, r1.z

// Correct velocity buffer when moving forwards / backwards to reduce AO
// smearing (not exact). r1.z is 1.0 for no velocity, we want to adjust
// relative to that. We do not include convergence as this is a relative
// adjustment, not absolute.
add r3.w, r1.z, l(-1.0)
mad r0.x, -r3.w, r3.x, r0.x

dp4 r2.x, r0.xyzw, cb0[0].xyzw
dp4 r2.y, r0.xyzw, cb0[1].xyzw
mad r0.xyzw, r2.xyxx, r1.zzzz, -r0.xyxx
mul r0.xyzw, r0.xyzw, l(0.500000, -0.500000, 0.500000, 0.500000)
eq r1.zw, r1.xxxy, l(0.000000, 0.000000, 0.000000, 0.000000)
and r1.z, r1.w, r1.z
movc r0.xyzw, r1.zzzz, r0.xyzw, r1.xyxx
store_uav_typed u0.xyzw, vThreadID.xyyy, r0.xyzw
ret 
// Approximately 19 instruction slots used