$darkmode
Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
postprocess_readback.h File Reference

Async GPU readback and histogram API for post-processing. More...

#include <glad/glad.h>
#include <cglm/types.h>
#include <stdint.h>
Include dependency graph for postprocess_readback.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void postprocess_update_time (PostProcess *post_processing, float delta_time)
 Increments internal clocks. More...
 
GLuint postprocess_get_exposure_pbo (PostProcess *post_processing, int index)
 
GLuint postprocess_get_histogram_pbo (PostProcess *post_processing, int index)
 
GLsync postprocess_get_exposure_sync (PostProcess *post_processing, int index)
 
GLsync postprocess_get_histogram_sync (PostProcess *post_processing, int index)
 
void postprocess_set_exposure_sync (PostProcess *post_processing, int index, GLsync sync)
 
void postprocess_set_histogram_sync (PostProcess *post_processing, int index, GLsync sync)
 
void postprocess_update_readbacks (PostProcess *post_processing, uint64_t frame_count)
 Updates all async GPU readbacks (Exposure, Histogram). Handles PBO mapping and Sync management internally to avoid CPU stalls. More...
 
void postprocess_set_exposure_target (PostProcess *post_processing, float threshold)
 Updates the target exposure threshold for AE. More...
 
void postprocess_update_matrices (PostProcess *post_processing, mat4 view_proj)
 Updates view-projection matrices for effects requiring depth-reconstruction. More...
 
int postprocess_compute_luminance_histogram (PostProcess *post_processing, uint64_t frame_count, int *buckets, int size, float *min_lum, float *max_lum)
 Computes the luminance histogram from the GPU readback. More...
 

Detailed Description

Async GPU readback and histogram API for post-processing.

Consumers that need PBO readback, histogram computation, or matrix updates should include this header.

Function Documentation

◆ postprocess_compute_luminance_histogram()

int postprocess_compute_luminance_histogram ( PostProcess *  post_processing,
uint64_t  frame_count,
int *  buckets,
int  size,
float *  min_lum,
float *  max_lum 
)

Computes the luminance histogram from the GPU readback.

Returns
1 if buckets were updated, 0 otherwise.
Here is the call graph for this function:

◆ postprocess_get_exposure_pbo()

GLuint postprocess_get_exposure_pbo ( PostProcess *  post_processing,
int  index 
)

◆ postprocess_get_exposure_sync()

GLsync postprocess_get_exposure_sync ( PostProcess *  post_processing,
int  index 
)

◆ postprocess_get_histogram_pbo()

GLuint postprocess_get_histogram_pbo ( PostProcess *  post_processing,
int  index 
)

◆ postprocess_get_histogram_sync()

GLsync postprocess_get_histogram_sync ( PostProcess *  post_processing,
int  index 
)

◆ postprocess_set_exposure_sync()

void postprocess_set_exposure_sync ( PostProcess *  post_processing,
int  index,
GLsync  sync 
)

◆ postprocess_set_exposure_target()

void postprocess_set_exposure_target ( PostProcess *  post_processing,
float  threshold 
)

Updates the target exposure threshold for AE.

Here is the call graph for this function:

◆ postprocess_set_histogram_sync()

void postprocess_set_histogram_sync ( PostProcess *  post_processing,
int  index,
GLsync  sync 
)

◆ postprocess_update_matrices()

void postprocess_update_matrices ( PostProcess *  post_processing,
mat4  view_proj 
)

Updates view-projection matrices for effects requiring depth-reconstruction.

Parameters
post_processingPointer to the struct.
view_projThe current frame's View-Proj matrix.

◆ postprocess_update_readbacks()

void postprocess_update_readbacks ( PostProcess *  post_processing,
uint64_t  frame_count 
)

Updates all async GPU readbacks (Exposure, Histogram). Handles PBO mapping and Sync management internally to avoid CPU stalls.

Here is the call graph for this function:

◆ postprocess_update_time()

void postprocess_update_time ( PostProcess *  post_processing,
float  delta_time 
)

Increments internal clocks.

Parameters
post_processingPointer to the struct.
delta_timeSECONDS elapsed since last frame.