Skip to main content

MilkBundle

Struct MilkBundle 

Source
pub struct MilkBundle {
    pub per_frame_init: EelProgram,
    pub per_frame: EelProgram,
    pub per_vertex: EelProgram,
    pub waves: Vec<MilkElement>,
    pub shapes: Vec<MilkElement>,
    pub warp_wgsl: Option<String>,
    pub comp_wgsl: Option<String>,
    pub blur_level: u8,
    pub quantize_steps: f32,
}
Expand description

A converted preset’s compiled programs: what a bundle carries beyond an ordinary Ritmolux preset.

Cloned into the warp mesh’s structural config at load and never touched again — the runtime state lives in MilkRuntime, not here, so the same bundle can drive two scenes (the roster’s and a [layer]’s) without them sharing a register file.

Fields§

§per_frame_init: EelProgram

Run once at preset load.

§per_frame: EelProgram

Run once per frame.

§per_vertex: EelProgram

Run once per mesh vertex.

§waves: Vec<MilkElement>

Up to four custom waves — extra traces the preset draws with their own per-point programs (Plan 0100 Phase 4). 47 % of the corpus enables at least one, which is why they are here rather than warned about.

§shapes: Vec<MilkElement>

Up to four custom shapes — filled polygons with their own per-instance programs. 63 % of the corpus enables at least one.

§warp_wgsl: Option<String>

The translated MilkDrop 2 warp shader, as a complete WGSL fragment module (Plan 0100 Phase 6). None — most of MilkDrop 1.x, and any MilkDrop 2 preset that never wrote one — takes the engine’s built-in decay path. Validated through naga at load (shader::validate_wgsl).

§comp_wgsl: Option<String>

The translated comp shader — replaces the built-in present remaps when present. See warp_wgsl.

§blur_level: u8

The deepest GetBlur/sampler_blur level either shader reaches, 0..=3. Zero means the blur chain never runs for this preset.

§quantize_steps: f32

How many levels this bundle’s feedback field quantizes to at the end of the warp pass (ADR-0118), defaulting to DEFAULT_QUANTIZE_STEPS.

The presence of a bundle is what turns this on, which is the whole per-bundle shape: the reference’s 8-bit target truncates a decay-scaled dim pixel to zero and this engine’s Rgba16Float field does not, so an imported preset wants the emulation and a native warp_mesh world — which carries no bundle and so never reaches this field — does not.

0.0 is off. Negative selects ADR-0118’s Alternative D (floor to zero at one step, no ladder between). Both are reachable from [milk] quantize_steps, so the look gate’s A/B is a preset edit rather than a re-convert.

Implementations§

Source§

impl MilkBundle

Source

pub fn from_assembly( per_frame_init: Option<&str>, per_frame: Option<&str>, per_vertex: Option<&str>, ) -> Result<Self, BundleError>

Decode a bundle from the three assembly sections. An absent section is the empty program, which runs nothing.

Source

pub fn push_element( &mut self, kind: ElementKind, init: Option<&str>, per_frame: Option<&str>, per_point: Option<&str>, count: u32, instances: u32, use_dots: bool, thick: bool, additive: bool, ) -> Result<(), BundleError>

Attach one custom wave or shape, decoded from its own three assembly sections.

Its own register file, not the bundle’s — an element’s programs share a scope with each other and with nothing else (see ElementRuntime), so the roster check here is within the element and there is deliberately no comparison against per_frame’s. Only q1-q32 cross, by copy.

Silently over-count is not an option: count and instances are what the draw layer’s buffers were sized from, so they are clamped to the format’s own limits by ElementRuntime::spec on the way out rather than trusted.

Source

pub fn uses_random(&self) -> bool

Whether any program in the bundle draws from the RNG.

Trait Implementations§

Source§

impl Clone for MilkBundle

Source§

fn clone(&self) -> MilkBundle

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MilkBundle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for MilkBundle

Source§

fn eq(&self, other: &MilkBundle) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for MilkBundle

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,