Download

What is the point of GraphBuilder.QueueTextureExtraction()/QueueBufferExtraction?

Graphics novice here, so if you can identify any misunderstandings I have, correct me!

Currently wondering if GraphBuilder.QueueTextureExtraction() is necessary. From what I can tell it is effectively just a command list instruction (maybe??) that copies contents from an FRDGTextureRef (in my case, an OutputTexture buffer from a compute shader) to a TRefCountPtr<IPooledRenderTarget>, from which the texture can then be copied into a render-target of choice with RHICmdList.CopyToResolveTarget().

The thing is, RHICmdList.CopyToResolveTarget() takes an FRHITexture as both it’s source and it’s destination.

FRDGTextureRef has a function GetRHI() which returns a FRHITexture, so why ever call GraphBuilder.QueueTextureExtraction()? Just call RHICmdList.CopyToResolve() with FRDGTextureRef->GetRHI() as the source to copy from.

My guess is that it has something to do with the lifetimes of these objects. Maybe the contents of an FRDGTextureRef ceases to exist after you call GraphBuilder.Execute()?

Thanks!

That’s the exact reason. From what I have found using RDG the FRDGBuffers
are local to the GraphBuilder. so after the Execute() call they cease to exists. Using QueueBufferExtraction/QueueTextureExtraction let’s you bring your buffers out of the current Graph using FDRGPooledBuffers.

As an addition for others struggling with this it is possible to bring in the current GraphBuilder a pooled buffer (that is genereted in another Graph) using the GraphBuilder.RegisterExtranrBuffer/RegisterExternalTexture. It helped me as I am building buffers only once (BeginPlay) and use them every frame (Tick()).

Hope this helps as the documentation for RDG is quite scarce.

1 Like