Module renderer

Module renderer 

Source
Expand description

Main renderer assembling the per-frame Milkdrop pipeline.

Current pipeline (MVP):

  1. Warp pass — sample prev_texture at the per-vertex warped UV (computed CPU-side by [onedrop-engine::warp_eval]) and write to render_texture, applying decay + feedback filters in the fragment shader.
  2. Copy-to-prevrender_textureprev_texture so next frame’s warp pass can sample the previous frame’s content.
  3. Comp pass — sample render_texture, apply display-only filters (currently just gamma_adj; user comp shaders later in sprint B2), write to final_texture. Filters here intentionally don’t feed back into the warp loop.

final_texture is what render_texture() exposes to the GUI/CLI.

Future passes (waveforms, shapes, motion vectors, sprites, blur) compose on top of this foundation.

Structs§

MilkRenderer
Main Milkdrop renderer.

Constants§

DEFAULT_MESH_COLS
Fallback warp mesh resolution. Used by call-sites that bypass RenderConfig (tests, benches). The real default comes from RenderConfig::mesh_cols/mesh_rows, which MeshQuality::Medium resolves to 48×36. MD2 ships 32×24 → 192×96.
DEFAULT_MESH_ROWS

Functions§

build_shader_uniforms_from 🔒
Build the ShaderUniforms payload from any RenderState + GPU context. Shared between the primary and secondary render paths so each chain can run with its own gamma_adj / echo_alpha / audio / q snapshot.
hue_shader_for 🔒
Time-driven RGB tint MD2 cycles through each frame. Three oscillators with mutually-prime periods produce a slow rainbow rotation that never repeats (rationals on the unit circle); presets that multiply ret * hue_shader get the rainbow rotation MD2 is tuned for, while presets that ignore it keep their authored colour palette because the per-channel output stays in [0, 1] and floats around ~0.5. .w is reserved for a future per-corner mix factor.