Skip to main content

UNIFORM_WGSL

Constant UNIFORM_WGSL 

Source
pub const UNIFORM_WGSL: &str = "\
struct MilkU {
    // x: time (s), y: fps (the nominal 30, as the EEL side reports), z: frame, w: progress
    clock: vec4<f32>,
    // bass, mid, treb, vol — MilkDrop-scaled, exactly what the EEL programs read
    bands: vec4<f32>,
    // the attenuated versions of the same four
    bands_att: vec4<f32>,
    // w, h, 1/w, 1/h of the field
    texsize: vec4<f32>,
    // aspectx, aspecty, 1/aspectx, 1/aspecty — the EEL convention (longer axis reads 1)
    aspect: vec4<f32>,
    // four uniform randoms, fresh each frame, deterministic from the preset salt
    rand_frame: vec4<f32>,
    // four uniform randoms, fixed for the preset's life
    rand_preset: vec4<f32>,
    // x: decay for this frame (already rate-converted), y: brightness, z: occlude,
    // w: feedback quantize steps (0 = off, negative = ADR-0118 Alternative D)
    misc: vec4<f32>,
    // the four corner colours hue_shader interpolates between
    hue: array<vec4<f32>, 4>,
    // q1..q32 as _qa.._qh
    q: array<vec4<f32>, 8>,
    // slow_roam_cos, roam_cos, slow_roam_sin, roam_sin
    roam: array<vec4<f32>, 4>,
    // the 24 rot_* matrices, 4 rows each; .xyz of a row is what float4x3 indexing reads
    rot: array<vec4<f32>, 96>,
}
";
Expand description

The uniform block, as WGSL. Field-for-field with MilkUniform in render/scenes/warp_mesh/shader.rs — every member is 16-byte data, so the Rust #[repr(C)] layout and the WGSL std140-ish layout agree by construction, and a test naga-parses this text so the two cannot drift silently.