$darkmode
Implementation of the IBL generation state machine. More...
#include "ibl_coordinator.h"#include "app_settings.h"#include "log.h"#include "pbr.h"#include "utils.h"#include <float.h>#include <math.h>#include <string.h>Functions | |
| static bool | is_software_renderer (void) |
| static int | ibl_irradiance_slices (void) |
| static int | ibl_specular_mip0_slices (void) |
| static int | ibl_specular_mip1_slices (void) |
| static int | ibl_specular_mips_grouping_start (void) |
| static void | ibl_stats_reset (IBLCoordinator *ctx) |
| Reset stage timing statistics for a new IBL stage. More... | |
| static void | ibl_stats_accumulate (IBLCoordinator *ctx, double gpu_ms) |
| Accumulate a slice's GPU timing into the stage statistics. More... | |
| static void | ibl_stats_log_summary (IBLCoordinator *ctx, uint64_t frame, const char *stage_name) |
| Log a single INFO summary line for a completed IBL stage. More... | |
| void | ibl_coordinator_init (IBLCoordinator *coord, GLuint shader_spmap, GLuint shader_irmap, GLuint shader_lum_pass1, GLuint shader_lum_pass2) |
| Initializes the IBL coordinator with necessary shader resources. More... | |
| void | ibl_coordinator_cleanup (IBLCoordinator *coord) |
| Cleanups any pending resources held by the coordinator. More... | |
| void | ibl_coordinator_reset (IBLCoordinator *coord) |
| Resets the coordinator to IDLE state. More... | |
| void | ibl_coordinator_start (IBLCoordinator *coord, GLuint hdr_tex, int width, int height) |
| Starts the IBL generation process for a new HDR texture. More... | |
| static IBLState | process_luminance (IBLCoordinator *coord, unsigned long long frame) |
| static IBLState | process_luminance_wait (IBLCoordinator *coord, unsigned long long frame) |
| static IBLState | process_specular_init (IBLCoordinator *coord, unsigned long long frame) |
| static IBLState | process_specular_mips (IBLCoordinator *coord, unsigned long long frame) |
| static IBLState | process_irradiance (IBLCoordinator *coord, unsigned long long frame) |
| IBLState | ibl_coordinator_update (IBLCoordinator *coord, uint64_t frame_count) |
| Advances the state machine by one step (slice or pass). More... | |
| int | ibl_coordinator_get_results (IBLCoordinator *coord, GLuint *out_hdr_tex, GLuint *out_spec_tex, GLuint *out_irr_tex, float *out_threshold) |
| Retrieves the results of the IBL generation. More... | |
Variables | |
| static const int | IBL_SOFTWARE_FALLBACK_SLICES = 1 |
| Default slice count for software renderers (no slicing). Slicing is disabled to avoid the massive overhead of multiple draw calls on CPU-bound renderers (llvmpipe, etc.). More... | |
| static const int | IBL_IRRADIANCE_HARDWARE_SLICES = 12 |
| Number of slices for irradiance convolution on hardware (GPU). More... | |
| static const int | IBL_SPECULAR_MIP0_HARDWARE_SLICES = 24 |
| Number of slices for the largest specular mip (Mip 0) on hardware. More... | |
| static const int | IBL_SPECULAR_MIP1_HARDWARE_SLICES = 8 |
| Number of slices for the second specular mip (Mip 1) on hardware. More... | |
| static const int | IBL_SPECULAR_MIP_GROUPING_START_MIP = 3 |
| Mip level from which specular mips are grouped in a single frame. More... | |
| static const int | IBL_SOFTWARE_MIP_GROUPING_START_MIP = 0 |
| Mip level for software grouping (all mips at once). More... | |
| static const float | IBL_THRESHOLD_FALLBACK_MIN = 1.0F |
| static const int | IBL_LOG_LABEL_SIZE = 128 |
Implementation of the IBL generation state machine.
| void ibl_coordinator_cleanup | ( | IBLCoordinator * | coord | ) |
Cleanups any pending resources held by the coordinator.
| coord | Pointer to the coordinator instance. |
| int ibl_coordinator_get_results | ( | IBLCoordinator * | coord, |
| GLuint * | out_hdr_tex, | ||
| GLuint * | out_spec_tex, | ||
| GLuint * | out_irr_tex, | ||
| float * | out_threshold | ||
| ) |
Retrieves the results of the IBL generation.
| coord | Pointer to the coordinator instance. |
| out_hdr_tex | Pointer to receive the HDR texture handle. |
| out_spec_tex | Pointer to receive the specular texture handle. |
| out_irr_tex | Pointer to receive the irradiance texture handle. |
| out_threshold | Pointer to receive the computed luminance threshold. |
| void ibl_coordinator_init | ( | IBLCoordinator * | coord, |
| GLuint | shader_spmap, | ||
| GLuint | shader_irmap, | ||
| GLuint | shader_lum_pass1, | ||
| GLuint | shader_lum_pass2 | ||
| ) |
Initializes the IBL coordinator with necessary shader resources.
| coord | Pointer to the coordinator instance. |
| shader_spmap | Handle to the specular pre-filter shader. |
| shader_irmap | Handle to the irradiance convolution shader. |
| shader_lum_pass1 | Handle to luminance pass 1 shader. |
| shader_lum_pass2 | Handle to luminance pass 2 shader. |
| void ibl_coordinator_reset | ( | IBLCoordinator * | coord | ) |
Resets the coordinator to IDLE state.
| coord | Pointer to the coordinator instance. |
| void ibl_coordinator_start | ( | IBLCoordinator * | coord, |
| GLuint | hdr_tex, | ||
| int | width, | ||
| int | height | ||
| ) |
Starts the IBL generation process for a new HDR texture.
| coord | Pointer to the coordinator instance. |
| hdr_tex | Handle to the source HDR texture (must be valid). |
| width | Width of the HDR texture. |
| height | Height of the HDR texture. |
| IBLState ibl_coordinator_update | ( | IBLCoordinator * | coord, |
| uint64_t | frame_count | ||
| ) |
Advances the state machine by one step (slice or pass).
| coord | Pointer to the coordinator instance. |
| frame_count | Current frame number (for logging purposes). |
|
static |
|
static |
|
static |
|
static |
|
static |
Accumulate a slice's GPU timing into the stage statistics.
|
static |
Log a single INFO summary line for a completed IBL stage.
|
static |
Reset stage timing statistics for a new IBL stage.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Number of slices for irradiance convolution on hardware (GPU).
|
static |
|
static |
Default slice count for software renderers (no slicing). Slicing is disabled to avoid the massive overhead of multiple draw calls on CPU-bound renderers (llvmpipe, etc.).
|
static |
Mip level for software grouping (all mips at once).
|
static |
Number of slices for the largest specular mip (Mip 0) on hardware.
|
static |
Number of slices for the second specular mip (Mip 1) on hardware.
|
static |
Mip level from which specular mips are grouped in a single frame.
|
static |