diff options
Diffstat (limited to 'source/blender/draw/engines/eevee_next/eevee_shader_shared.hh')
-rw-r--r-- | source/blender/draw/engines/eevee_next/eevee_shader_shared.hh | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh b/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh index 97fc9c5a547..d9fee1b6073 100644 --- a/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh +++ b/source/blender/draw/engines/eevee_next/eevee_shader_shared.hh @@ -74,6 +74,54 @@ BLI_STATIC_ASSERT_ALIGN(CameraData, 16) /** \} */ /* -------------------------------------------------------------------- */ +/** \name VelocityModule + * \{ */ + +#define VELOCITY_INVALID 512.0 + +enum eVelocityStep : uint32_t { + STEP_PREVIOUS = 0, + STEP_NEXT = 1, + STEP_CURRENT = 2, +}; + +struct VelocityObjectIndex { + /** Offset inside #VelocityObjectBuf for each timestep. Indexed using eVelocityStep. */ + int3 ofs; + /** Temporary index to copy this to the #VelocityIndexBuf. */ + uint resource_id; + +#ifdef __cplusplus + VelocityObjectIndex() : ofs(-1, -1, -1), resource_id(-1){}; +#endif +}; +BLI_STATIC_ASSERT_ALIGN(VelocityObjectIndex, 16) + +struct VelocityGeometryIndex { + /** Offset inside #VelocityGeometryBuf for each timestep. Indexed using eVelocityStep. */ + int3 ofs; + /** If true, compute deformation motion blur. */ + bool1 do_deform; + /** Length of data inside #VelocityGeometryBuf for each timestep. Indexed using eVelocityStep. */ + int3 len; + + int _pad0; + +#ifdef __cplusplus + VelocityGeometryIndex() : ofs(-1, -1, -1), do_deform(false), len(-1, -1, -1), _pad0(1){}; +#endif +}; +BLI_STATIC_ASSERT_ALIGN(VelocityGeometryIndex, 16) + +struct VelocityIndex { + VelocityObjectIndex obj; + VelocityGeometryIndex geo; +}; +BLI_STATIC_ASSERT_ALIGN(VelocityGeometryIndex, 16) + +/** \} */ + +/* -------------------------------------------------------------------- */ /** \name Ray-Tracing * \{ */ @@ -131,6 +179,9 @@ float4 utility_tx_sample(sampler2DArray util_tx, float2 uv, float layer) #ifdef __cplusplus using CameraDataBuf = draw::UniformBuffer<CameraData>; +using VelocityIndexBuf = draw::StorageArrayBuffer<VelocityIndex, 16>; +using VelocityObjectBuf = draw::StorageArrayBuffer<float4x4, 16>; +using VelocityGeometryBuf = draw::StorageArrayBuffer<float4, 16, true>; } // namespace blender::eevee #endif |