Description
The current gltf loader code uses threading to load images from disk into memory prior to pushing them to the GPU.
However, it does this by creating a thread-pool of std::thread::hardware_concurrency()
size.
Vulkan-Samples/framework/gltf_loader.cpp
Lines 545 to 564 in 216e065
The code attempts to mitigate this later on by limiting the number of staging buffers that will be created to 64 MB at a time:
Vulkan-Samples/framework/gltf_loader.cpp
Lines 568 to 584 in 216e065
but IMO the "damage" is already done. My machine peaks at over 5 GB of RAM usage at loading the large scenes used in performance examples.
While the threading might be useful for speeding up the overall load, consuming all the CPUs on the machine to do so feels excessive, and I would suggest that at least 1 CPU be left in reserve for the main thread.
Additionally, it should be possible to limit the number of images loaded concurrently by using a blocking queue or a (C++) semaphore to block the thread pool from doing more work when there pending images waiting for upload.