$darkmode
Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
postprocess_readback.c File Reference
#include "app_settings.h"
#include "effects/fx_motion_blur.h"
#include "gl_common.h"
#include "postprocess_internal.h"
Include dependency graph for postprocess_readback.c:

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...
 
static void fill_histogram_buckets (const float *lum_data, int *buckets, int size, float *min_lum, float *max_lum)
 
static void trigger_histogram_readback (PostProcess *post_processing, int write_idx)
 
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...
 
void postprocess_update_matrices (PostProcess *post_processing, mat4 view_proj)
 Updates view-projection matrices for effects requiring depth-reconstruction. More...
 

Variables

static const float LUM_MIN_EXTREME = 1e30F
 
static const float LUM_MAX_EXTREME = -1e30F
 

Function Documentation

◆ fill_histogram_buckets()

static void fill_histogram_buckets ( const float *  lum_data,
int *  buckets,
int  size,
float *  min_lum,
float *  max_lum 
)
static

◆ 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.

◆ trigger_histogram_readback()

static void trigger_histogram_readback ( PostProcess *  post_processing,
int  write_idx 
)
static

Variable Documentation

◆ LUM_MAX_EXTREME

const float LUM_MAX_EXTREME = -1e30F
static

◆ LUM_MIN_EXTREME

const float LUM_MIN_EXTREME = 1e30F
static