DX11 compute shader swap buffer

I’m trying to redo a texture effect I made as a compute shader. The texture effect has a feedback loop via FrameDelay so it can use its own render result as an input texture in the next frame. How can I get something like this with compute shader buffers? Using a single RWStructureBuffer is no good, as altering the buffer contents while reading them messes up my calculations.

you will always need 2 resources, or 2 sections in one resource, so all CS dispatch invocation sees the same state of the previous frame. If you swap between readable and output resource/section each frame you can avoid a copy operation and you’d have a stable previous frame data.

You can do this in vvvvanilla if you make your buffer double sized and have a global switch toggled each frame which indicates which part of the buffer is the current frame. In dx11.particles or mp.dx you have a renderer to manage and bind multiple buffers with custom semantics, so you can switch between 2 every frame inside vvvv.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.