System::setFileSystem is used to set the file callbacks the low level system uses for Open/Seek/Read of files. It provides a place for two optional entries, AsyncRead and AsyncCancel to allow for non-blocking file IO. The Unreal plugin, sadly, doesn’t implement these calls. Because of this, FMod threads stall a lot on our PS/4 builds.
The reason is that when an FMod thread makes a call into say FFModFileSystem::OpenCallback, that request first blocks on access to the FMOD File Access Coordinator thread’s mCommand to submit its request, then once any previous command has completed it blocks again on the FMODFAC getting swapped in, doing the command and triggering its command complete event. Then we have to wait for the calling thread to get swapped in and return to FMod. Oof. This cycle happens for every 2K read as well.
I started putting calls to FPlatformTime::Seconds() before and after all these calls, and these stalls can easily take 10’s of ms, and I’ve seen over 100ms on many occasions if there’s other disk IO going on or lots of other activity in the game. This can’t be good.
I’ve been looking around for examples of doing the Async versions so we don’t stall, but I can’t find any guidance on what to do. Has anyone done this Unreal?