Previous position/velocity in material (no bp)

I’m hoping someone knows a way to either store and retrieve next frame a value in a custom node or if there’s any HLSL code to get the last position. I want to avoid BP setting parameter as I could have hundreds at any time needing access to it every frame. Velocity would work too as it’s the end goal.

Thanks

there is a previous frame switch in the material editor.