$darkmode
Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
async_loader.h
Go to the documentation of this file.
1 
9 #ifndef ASYNC_LOADER_H
10 #define ASYNC_LOADER_H
11 
12 #include "gl_common.h"
13 #include <stdbool.h>
14 
16 #define ASYNC_MAX_PATH 256
17 
22 typedef enum {
23  ASYNC_IDLE = 0,
29  ASYNC_READY,
33 
38 #include <stdint.h>
39 
40 typedef struct AsyncRequest {
42  /* --- Internal Data for Async Ops --- */
43  float* float_data; /* For loading stage */
44  uint16_t* half_data; /* For legacy upload (if no PBO) */
46  GLuint pbo_id; /* ID of the PBO used for this request */
47  int width;
48  int height;
49  int channels;
50  double submission_time;
51  volatile AsyncState
53 } AsyncRequest;
54 
59 typedef struct AsyncLoader AsyncLoader;
60 
61 struct TracyManager;
62 
69 
74 void async_loader_destroy(AsyncLoader* loader);
75 
82 bool async_loader_request(AsyncLoader* loader, const char* path);
83 
92 bool async_loader_poll(AsyncLoader* loader, AsyncRequest* out_req);
93 
103 void async_loader_provide_pbo(AsyncLoader* loader, void* mapped_ptr,
104  GLuint pbo_id);
105 
112 void async_loader_cancel(AsyncLoader* loader);
113 
114 #endif /* ASYNC_LOADER_H */
AsyncState
Lifecycle states for an individual asynchronous request.
Definition: async_loader.h:22
@ ASYNC_READY
Definition: async_loader.h:29
@ ASYNC_PENDING
Definition: async_loader.h:24
@ ASYNC_CONVERTING
Definition: async_loader.h:28
@ ASYNC_IDLE
Definition: async_loader.h:23
@ ASYNC_FAILED
Definition: async_loader.h:31
@ ASYNC_WAITING_FOR_PBO
Definition: async_loader.h:27
@ ASYNC_LOADING
Definition: async_loader.h:26
void async_loader_provide_pbo(AsyncLoader *loader, void *mapped_ptr, GLuint pbo_id)
Provides a mapped PBO pointer to the async loader for conversion.
Definition: async_loader.c:368
bool async_loader_poll(AsyncLoader *loader, AsyncRequest *out_req)
Polls the loader for any completed requests.
Definition: async_loader.c:325
bool async_loader_request(AsyncLoader *loader, const char *path)
Submits a new file path for background loading.
Definition: async_loader.c:273
void async_loader_cancel(AsyncLoader *loader)
Cancels the current request if it is waiting for a PBO.
Definition: async_loader.c:396
void async_loader_destroy(AsyncLoader *loader)
Destroys the async loader and frees resources.
Definition: async_loader.c:240
AsyncLoader * async_loader_create(struct TracyManager *mgr)
Creates and initializes a new async loader instance.
Definition: async_loader.c:196
#define ASYNC_MAX_PATH
Maximum path length for an asynchronous load request.
Definition: async_loader.h:16
Common OpenGL definitions, RAII helpers, and utilities.
Opaque handle to the asynchronous loader context.
Definition: async_loader.c:17
Container for asynchronous load results and metadata.
Definition: async_loader.h:40
int channels
Definition: async_loader.h:49
void * pbo_mapped_ptr
Definition: async_loader.h:45
char path[256]
Definition: async_loader.h:41
uint16_t * half_data
Definition: async_loader.h:44
double submission_time
Definition: async_loader.h:50
volatile AsyncState state
Definition: async_loader.h:52
int width
Definition: async_loader.h:47
int height
Definition: async_loader.h:48
float * float_data
Definition: async_loader.h:43
GLuint pbo_id
Definition: async_loader.h:46
Handles Tracy-specific instrumentation and asynchronous GPU screenshots.
Definition: tracy_manager.h:20