baldurk / renderdoc

RenderDoc is a stand-alone graphics debugging tool.
https://renderdoc.org
MIT License
9.06k stars 1.35k forks source link

Vulkan AS rebuild-on-replay: Serialise and Replay #3451

Closed cmannett85-arm closed 1 month ago

cmannett85-arm commented 1 month ago

The VkAccelerationStructureInfo structure is serialised followed by the unified geometry readback buffer. On replay the upload buffer is populated from the capture and then copied to GPU local mem, at which point the upload mem is freed as replay cannot modify the AS input data.

When the initial state Apply() is called the ASes are built from the input data one at a time so that a single scratch buffer can be built (enlarging when needed) and re-used. Although this is slower it is necessary on Mali as it has poor space efficiency for the scratch buffer and so can easily OOM a device if all the ASes are built in a single command buffer submission.

Tested on:

cmannett85-arm commented 1 month ago

I've rebased to pick up the mutable VkInitialContents change you made, and added the single input data mem block and build-on-apply-once change as separate commits.