$darkmode
Threaded asynchronous file loader for heavy assets (HDR, textures). More...
Go to the source code of this file.
Data Structures | |
| struct | AsyncRequest |
| Container for asynchronous load results and metadata. More... | |
Macros | |
| #define | ASYNC_MAX_PATH 256 |
| Maximum path length for an asynchronous load request. More... | |
Enumerations | |
| enum | AsyncState { ASYNC_IDLE = 0 , ASYNC_PENDING , ASYNC_LOADING , ASYNC_WAITING_FOR_PBO , ASYNC_CONVERTING , ASYNC_READY , ASYNC_FAILED } |
| Lifecycle states for an individual asynchronous request. More... | |
Functions | |
| AsyncLoader * | async_loader_create (struct TracyManager *mgr) |
| Creates and initializes a new async loader instance. More... | |
| void | async_loader_destroy (AsyncLoader *loader) |
| Destroys the async loader and frees resources. More... | |
| bool | async_loader_request (AsyncLoader *loader, const char *path) |
| Submits a new file path for background loading. More... | |
| bool | async_loader_poll (AsyncLoader *loader, AsyncRequest *out_req) |
| Polls the loader for any completed requests. More... | |
| void | async_loader_provide_pbo (AsyncLoader *loader, void *mapped_ptr, GLuint pbo_id) |
| Provides a mapped PBO pointer to the async loader for conversion. More... | |
| void | async_loader_cancel (AsyncLoader *loader) |
| Cancels the current request if it is waiting for a PBO. More... | |
Threaded asynchronous file loader for heavy assets (HDR, textures).
This module manages a background worker thread that handles I/O and image decoding, preventing main-thread stalls during asset transitions.
| #define ASYNC_MAX_PATH 256 |
Maximum path length for an asynchronous load request.
| enum AsyncState |
Lifecycle states for an individual asynchronous request.
| void async_loader_cancel | ( | AsyncLoader * | loader | ) |
Cancels the current request if it is waiting for a PBO.
Use this if the main thread fails to map a PBO and cannot proceed.
| loader | The loader instance. |
| AsyncLoader* async_loader_create | ( | struct TracyManager * | mgr | ) |
Creates and initializes a new async loader instance.
| mgr | The Tracy instrumentation manager. |
| void async_loader_destroy | ( | AsyncLoader * | loader | ) |
Destroys the async loader and frees resources.
| loader | The loader instance to destroy. |
| bool async_loader_poll | ( | AsyncLoader * | loader, |
| AsyncRequest * | out_req | ||
| ) |
Polls the loader for any completed requests.
This should be called from the main (OpenGL) thread once per frame.
| loader | The loader instance. | |
| [out] | out_req | Pointer to store the successfully loaded data. |
| void async_loader_provide_pbo | ( | AsyncLoader * | loader, |
| void * | mapped_ptr, | ||
| GLuint | pbo_id | ||
| ) |
Provides a mapped PBO pointer to the async loader for conversion.
Call this when async_loader_poll returns a request in ASYNC_WAITING_FOR_PBO state.
| loader | The loader instance. |
| mapped_ptr | Pointer to the mapped PBO memory. |
| pbo_id | ID of the PBO being used. |
| bool async_loader_request | ( | AsyncLoader * | loader, |
| const char * | path | ||
| ) |
Submits a new file path for background loading.
| loader | The loader instance. |
| path | The absolute path to the HDR/texture file. |