Buffering a viewporttexture?

Godot Version

4.3

Question

I’m using a SubViewport + ColorRect with custom shader to generate a ViewportTexture which I apply to a material elsewhere in the project.

I need the previous frame of the ViewportTexture to feed back in to the custom shader.

currently I’m using a second SubViewport + TextureRect with the ViewportTexture applied to create a buffer, then feed the resulting ViewportTexture back to my shader.

This works, but there’s a problem when the shader uses transparency because ViewportTextures force pre-multiplied alpha, meaning the buffer has this applied twice. I could make a shader for the buffer which divides rgb by alpha but I feels like unnecessary multiplying and dividing colour can cause floating point artefacts particularly with low alpha values

Is there a more elegant/cleaner way of buffering a ViewportTexture?

I have seen the node BackBufferCopy but I don’t understand how it’s used or even if it would be useful in this scenario

thanks