How can we create a new RDG buffer where the NumElements depends on another pass?

Hey there. Simple question about the Render Dependency Graph.

For context, I have a FRDGBuilder executing multiple passes sequentially. I need to create a new buffer after one of the passes where the NumElements is based on the output of that pass.

FPrefixSumShaderInterface::AddPass(GraphBuilder, SharedBufferSRV, SharedBufferUAV, NumTriangles);

The last elements of the SharedBuffer holds the integer I require, but we need to do a readback to get it. As far as I know we cant do a readback in-between passes and use the result to create a new buffer?

Something like this:

FPrefixSumShaderInterface::AddPass(GraphBuilder, SharedBufferSRV, SharedBufferUAV, NumTriangles);
// Get uint32 total-count from SharedBuffer ...
// Create new RDG buffer using this value   ...
// Third shader pass that uses this buffer  ...
1 Like