#[repr(C)]pub struct ShaderUniforms {Show 34 fields
pub time: f32,
pub fps: f32,
pub frame: f32,
pub progress: f32,
pub bass: f32,
pub mid: f32,
pub treb: f32,
pub vol: f32,
pub bass_att: f32,
pub mid_att: f32,
pub treb_att: f32,
pub vol_att: f32,
pub blur1_min: f32,
pub blur1_max: f32,
pub blur2_min: f32,
pub blur2_max: f32,
pub blur3_min: f32,
pub blur3_max: f32,
pub gamma_adj: f32,
pub _reserved1: f32,
pub echo_zoom: f32,
pub echo_alpha: f32,
pub echo_orient: f32,
pub red_blue_stereo: f32,
pub aspect: [f32; 4],
pub texsize: [f32; 4],
pub rand_preset: [f32; 4],
pub rand_frame: [f32; 4],
pub slow_roam_cos: [f32; 4],
pub slow_roam_sin: [f32; 4],
pub roam_cos: [f32; 4],
pub roam_sin: [f32; 4],
pub hue_shader: [f32; 4],
pub q: [[f32; 4]; 8],
}Expand description
Rust mirror of the WGSL ShaderUniforms struct.
Field order, alignment, and padding must exactly match
SHADER_UNIFORMS_WGSL; the tests module in this file enforces
this with a byte-for-byte naga round-trip.
Fields§
§time: f32Wall-clock time in seconds since preset load.
fps: f32Smoothed FPS estimate.
frame: f32Frame counter (cast from u32).
progress: f32Position within the preset’s display window, [0, 1]. 0 at load,
1 just before the next hard cut.
bass: f32Bass band level (raw, ~0 baseline, can spike >1 on beats).
mid: f32Mid band level.
treb: f32Treble band level.
vol: f32(bass + mid + treb) / 3.
bass_att: f32Smoothed (attenuated) bass level — exponential moving average.
mid_att: f32§treb_att: f32§vol_att: f32§blur1_min: f32bN_min / bN_max are remap bounds — the comp shader applies
lerp(min, max, sample) to recover usable contrast from the
downsampled blur pyramid.
blur1_max: f32§blur2_min: f32§blur2_max: f32§blur3_min: f32§blur3_max: f32§gamma_adj: f32MilkDrop’s f_gamma_adj. Display-only multiplier (not a true gamma);
applied in the comp pass after any user shader work.
_reserved1: f32Reserved for a future scalar; keeps the slot count a multiple of 4.
echo_zoom: f32MilkDrop’s f_video_echo_zoom. Comp pass samples the previous
frame’s display at (uv-0.5)*echo_zoom + 0.5 and blends it with
the current warp output. 0.0 disables the echo branch entirely
(treated as echo_alpha = 0).
echo_alpha: f32MilkDrop’s f_video_echo_alpha. Mix weight: 0.0 = no echo, full
current frame; 1.0 = pure echo from the previous frame.
echo_orient: f32MilkDrop’s n_video_echo_orientation. 0 = no flip, 1 = flip X,
2 = flip Y, 3 = flip both. Stored as f32 to avoid mixed
scalar types in the uniform layout; the comp shader casts to
an integer at use site.
red_blue_stereo: f32MilkDrop’s b_red_blue_stereo. 1.0 = anaglyph mode active,
0.0 = off. Wired through to comp.wgsl.
aspect: [f32; 4](aspect_x, aspect_y, 1/aspect_x, 1/aspect_y). MD2 historically
supplies all four to spare the shader an extra division.
texsize: [f32; 4](width, height, 1/width, 1/height) of the warp/comp render
target — the texture user shaders sample as sampler_main.
rand_preset: [f32; 4]Four [0, 1) floats sampled once at preset load. MD2’s rand_preset.
rand_frame: [f32; 4]Four [0, 1) floats resampled every frame.
slow_roam_cos: [f32; 4]Pre-computed cos of the four MD2 “slow roam” oscillators.
slow_roam_sin: [f32; 4]Pre-computed sin of the same.
roam_cos: [f32; 4]Faster-cycling roam oscillators.
roam_sin: [f32; 4]§hue_shader: [f32; 4]MD2’s per-frame RGB tint (.xyz). Many comp shaders multiply
ret * hue_shader for a slow rainbow rotation across frames;
without this populated, the multiplication degrades to identity
(vec3(1, 1, 1)) and the rotation disappears. The engine
computes a time-driven tri-phase oscillator each frame; the
.w lane is reserved for a future per-corner mix factor.
q: [[f32; 4]; 8]q[0] packs q1..q4, q[1] packs q5..q8, etc. Filled from
MilkEngine::q_snapshot().
Implementations§
Trait Implementations§
Source§impl Clone for ShaderUniforms
impl Clone for ShaderUniforms
Source§fn clone(&self) -> ShaderUniforms
fn clone(&self) -> ShaderUniforms
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ShaderUniforms
impl Debug for ShaderUniforms
Source§impl Default for ShaderUniforms
impl Default for ShaderUniforms
impl Copy for ShaderUniforms
impl Pod for ShaderUniforms
Auto Trait Implementations§
impl Freeze for ShaderUniforms
impl RefUnwindSafe for ShaderUniforms
impl Send for ShaderUniforms
impl Sync for ShaderUniforms
impl Unpin for ShaderUniforms
impl UnwindSafe for ShaderUniforms
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self.