Loading texture assets asynchronously
All our demos so far preload all texture assets at startup, which works fine for applications with small data sizes that can be loaded instantly. Indeed, we downscaled all the Bistro textures to 512x512. However, as content size enters the gigabyte range, it becomes desirable to implement lazy-loading or streaming mechanisms to load assets as needed. Let’s enhance our demos with basic lazy-loading functionality that allows textures to load while the application continues rendering the scene. Multithreading will leverage the Taskflow library along with standard C++20 capabilities. To make the example more relevant and the graphics more visually appealing, we’ll also increase the dimensions of our compressed textures to 2048x2048.
Getting ready
We recommend revisiting the Multithreading with Taskflow recipe from Chapter 1.
The source code for this recipe is located in Chapter11/05_LazyLoading
.
How to do it...
To...