$darkmode
Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
app.h
Go to the documentation of this file.
1 #ifndef APP_H
2 #define APP_H
3 
4 #include "action_notifier.h"
5 #include "adaptive_sampler.h"
6 #include "app_binding.h"
7 #include "app_ui.h"
8 #include "async/async_coordinator.h"
9 #include "async_loader.h"
10 #include "camera.h"
11 #include "effect_benchmark.h"
12 #include "env_manager.h"
13 #include "fps.h"
14 #include "gl_common.h"
15 #include "gpu_profiler.h"
16 #include "gpu_profiler_ui.h"
17 #include "perf_mode.h"
18 #include "postprocess.h"
19 #include "scene.h"
20 #include "tracy_manager.h"
21 #include "ui.h"
22 #include <cglm/cglm.h>
23 
24 #ifdef USE_SSBO_RENDERING
25 #include "ssbo_rendering.h"
26 #endif
27 
28 typedef struct AsyncLoader
29  AsyncLoader;
35 typedef struct App {
36  /* --- Pointers and Dynamic Objects --- */
40  double last_frame_time;
41  double delta_time;
42  uint64_t frame_count;
45  /* --- Sub-Modules (RAII/In-Place) --- */
52 
55  /* --- App State Flags and Values --- */
56  int width;
57  int height;
72  /* --- Global GPU Resources --- */
73  GLuint lum_ssbo[2];
76  /* --- Global Configuration Uniforms --- */
77  float u_metallic;
78  float u_roughness;
79  float u_ao;
80  float u_exposure;
83  AsyncCoordinator
86 } App;
87 
88 /* --- Core Control Flow --- */
89 
93 int app_init(App* app, int width, int height, const char* title);
94 
98 void app_cleanup(App* app);
99 
103 void app_run(App* app);
104 
108 void app_update(App* app);
109 
110 #include "app_input.h"
111 
113 
114 #endif /* APP_H */
Temporary on-screen notification system for user actions.
Adaptive sampling utility for performance metrics.
@ TRACY_SCREENSHOT_WIDTH
Definition: app.h:112
@ TRACY_SCREENSHOT_HEIGHT
Definition: app.h:112
void app_run(App *app)
Enters the main application rendering and event loop.
Definition: app.c:186
void app_cleanup(App *app)
Safely releases all GPU and CPU resources held by the application.
Definition: app.c:147
int app_init(App *app, int width, int height, const char *title)
Fully initializes the application state, window, and OpenGL context.
Definition: app.c:29
void app_update(App *app)
One-frame logic update (physics, timers, camera).
Definition: app.c:327
User input orchestration and application state toggles.
UI rendering module for the application.
Threaded asynchronous file loader for heavy assets (HDR, textures).
First-person camera module with realistic physics and head-bobbing.
Automated A/B GPU cost measurement for individual postprocess effects.
Environment and IBL management module.
Common OpenGL definitions, RAII helpers, and utilities.
Runtime performance optimization module.
High-level post-processing pipeline and effects.
Buffer-backed instancing for ultra-large-scale rendering.
Manager for action notifications.
Definition: action_notifier.h:41
Collector for performance samples within a rolling or fixed window.
Definition: adaptive_sampler.h:38
Central registry that holds application key bindings.
Definition: app_binding.h:48
Definition: app_ui.h:199
The central state container for the entire application.
Definition: app.h:35
float u_roughness
Definition: app.h:78
Camera camera
Definition: app.h:53
int saved_height
Definition: app.h:60
AppUIOverlay overlay
Definition: app.h:50
TracyManager tracy_mgr
Definition: app.h:74
int resize_pending
Definition: app.h:61
int log_gpu_metrics
Definition: app.h:70
int saved_x
Definition: app.h:59
int pending_width
Definition: app.h:62
int width
Definition: app.h:56
double last_frame_time
Definition: app.h:40
GLuint lum_ssbo[2]
Definition: app.h:73
EffectBenchmark effect_bench
Definition: app.h:69
int saved_y
Definition: app.h:59
int height
Definition: app.h:57
float u_metallic
Definition: app.h:77
float u_ao
Definition: app.h:79
FpsCounter fps_counter
Definition: app.h:46
float * lum_histogram_buffer
Definition: app.h:43
EnvManager env_mgr
Definition: app.h:65
PostProcess postprocess
Definition: app.h:38
GLFWwindow * window
Definition: app.h:39
double delta_time
Definition: app.h:41
int is_fullscreen
Definition: app.h:58
int pending_height
Definition: app.h:63
GPUProfilerUI timeline_ui
Definition: app.h:49
AppBindingRegistry binding_registry
Definition: app.h:51
AsyncCoordinator async_coord
Definition: app.h:84
int camera_enabled
Definition: app.h:64
uint64_t frame_count
Definition: app.h:42
Scene scene
Definition: app.h:37
float u_exposure
Definition: app.h:80
PerfModeContext perf_context
Definition: app.h:67
int saved_width
Definition: app.h:60
int perf_mode_active
Definition: app.h:66
AdaptiveSampler fps_sampler
Definition: app.h:47
AsyncLoader * async_loader
Definition: app.h:82
GPUProfiler gpu_profiler
Definition: app.h:48
ActionNotifier notifier
Definition: app.h:68
Opaque handle to the asynchronous loader context.
Definition: async_loader.c:17
Represents a 3D camera with orientation, movement, and physical properties.
Definition: camera.h:40
State for the automated benchmark sweep.
Definition: effect_benchmark.h:64
Encapsulates state for environment loading, transitions, and IBL.
Definition: env_manager.h:26
Definition: fps.h:4
Manages the visual state and animations for the GPU timeline.
Definition: gpu_profiler_ui.h:12
Manages GPU timing using double-buffered queries to avoid stalls.
Definition: gpu_profiler.h:86
State container for performance mode.
Definition: perf_mode.h:52
Main pipeline state for post-processing.
Definition: postprocess.h:353
Encapsulates all 3D scene data, geometry, and rendering state.
Definition: scene.h:138
Handles Tracy-specific instrumentation and asynchronous GPU screenshots.
Definition: tracy_manager.h:20
Minimal immediate-mode User Interface (UI) library.
struct GLFWwindow GLFWwindow
Definition: window.h:4